mirror of
https://github.com/litruv/lit.ruv.wtf.git
synced 2026-07-24 18:56:02 +10:00
can now add nodes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user