mirror of
https://github.com/litruv/lit.ruv.wtf.git
synced 2026-07-24 02:36:02 +10:00
can now add nodes
This commit is contained in:
@@ -15,6 +15,21 @@ export class BindEventNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "bind_event";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' },
|
||||
{ id: 'event_name', name: 'Event', direction: 'input', kind: 'string', defaultValue: 'click' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintCallable)
|
||||
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
|
||||
|
||||
@@ -14,6 +14,18 @@ export class ButtonNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "button";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -14,6 +14,22 @@ export class ChatConnectNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "chat_connect";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' },
|
||||
{ id: 'on_message', name: 'On Message', direction: 'output', kind: 'exec' },
|
||||
{ id: 'message', name: 'Message', direction: 'output', kind: 'string' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintCallable)
|
||||
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
|
||||
|
||||
@@ -16,6 +16,18 @@ export class CustomEventNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "custom_event";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -16,6 +16,18 @@ export class GetMatrixChatNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "get_matrix_chat";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{ id: 'chat', name: 'Chat', direction: 'output', kind: 'table' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -14,6 +14,16 @@ export class InfoNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "info";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: []
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -16,6 +16,16 @@ export class LottieNode extends NodeBase {
|
||||
/** @type {string} */
|
||||
static NodeType = "lottie";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: []
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -17,6 +17,22 @@ export class MatrixChatNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "chat";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' },
|
||||
{ id: 'homeserver', name: 'Homeserver', direction: 'input', kind: 'string', defaultValue: 'https://matrix.org' },
|
||||
{ id: 'room_id', name: 'Room ID', direction: 'input', kind: 'string', defaultValue: '' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -27,6 +27,17 @@ export class NodeBase {
|
||||
*/
|
||||
static NodeType = "";
|
||||
|
||||
/**
|
||||
* Returns default pin configuration for this node type.
|
||||
* Override in subclasses to define node-specific pins.
|
||||
*
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
* @returns {{ inputs: Array<{id: string, name: string, direction: string, kind: string, defaultValue?: string, min?: number, max?: number}>, outputs: Array<{id: string, name: string, direction: string, kind: string}> }}
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return { inputs: [], outputs: [] };
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the node's base DOM (header, pins) has been built.
|
||||
* Override to inject type-specific UI into the article element.
|
||||
|
||||
@@ -47,4 +47,19 @@ export class NodeRegistry {
|
||||
static BlueprintPure_GetRegisteredTypes() {
|
||||
return [...this.#registry.keys()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns default pin configuration for a node type by delegating to the node class.
|
||||
*
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
* @param {string} nodeType
|
||||
* @returns {{ inputs: Array<{id: string, name: string, direction: string, kind: string, defaultValue?: string}>, outputs: Array<{id: string, name: string, direction: string, kind: string}> }}
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins(nodeType) {
|
||||
const handler = this.BlueprintPure_Get(nodeType);
|
||||
if (!handler) {
|
||||
return { inputs: [], outputs: [] };
|
||||
}
|
||||
return handler.constructor.BlueprintPure_GetDefaultPins();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,21 @@ export class PrintNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "print";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' },
|
||||
{ id: 'value', name: 'Value', direction: 'input', kind: 'string', defaultValue: 'Hello!' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintCallable)
|
||||
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
|
||||
|
||||
@@ -14,6 +14,18 @@ export class PureNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "pure";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{ id: 'val_out', name: 'Value', direction: 'output', kind: 'string', defaultValue: '' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -24,6 +24,21 @@ export class RandomNameNode extends NodeBase {
|
||||
/** @type {Promise<void> | null} */
|
||||
static #loadPromise = null;
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' },
|
||||
{ id: 'name', name: 'Name', direction: 'output', kind: 'string' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load name parts from JSON
|
||||
*/
|
||||
@@ -59,6 +74,28 @@ export class RandomNameNode extends NodeBase {
|
||||
return `${first}${second}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintCallable)
|
||||
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
|
||||
*/
|
||||
async BlueprintCallable_Execute(ctx) {
|
||||
const graphNode = ctx.BlueprintPure_GetNode();
|
||||
if (!graphNode) return;
|
||||
|
||||
// Generate new name
|
||||
graphNode._generatedName = RandomNameNode.generateName();
|
||||
|
||||
// Update DOM if rendered
|
||||
const nodeEl = document.querySelector(`[data-node-id="${graphNode.id}"]`);
|
||||
if (nodeEl) {
|
||||
const nameDisplay = nodeEl.querySelector('.node-name-display');
|
||||
if (nameDisplay) {
|
||||
nameDisplay.textContent = graphNode._generatedName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
@@ -14,6 +14,21 @@ export class SequenceNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "sequence";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'exec_in', name: '', direction: 'input', kind: 'exec' }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'then_1', name: 'Then 1', direction: 'output', kind: 'exec' },
|
||||
{ id: 'then_2', name: 'Then 2', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintCallable)
|
||||
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
|
||||
|
||||
@@ -14,6 +14,20 @@ export class TimerNode extends NodeBase {
|
||||
/** @UCLASS(BlueprintType) */
|
||||
static NodeType = "timer";
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintPure)
|
||||
*/
|
||||
static BlueprintPure_GetDefaultPins() {
|
||||
return {
|
||||
inputs: [
|
||||
{ id: 'interval', name: 'Interval (s)', direction: 'input', kind: 'number', defaultValue: '1', min: 0.1, max: 10 }
|
||||
],
|
||||
outputs: [
|
||||
{ id: 'exec_out', name: '', direction: 'output', kind: 'exec' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @UFUNCTION(BlueprintNativeEvent)
|
||||
* @param {HTMLElement} article
|
||||
|
||||
Reference in New Issue
Block a user