mirror of
https://github.com/litruv/lit.ruv.wtf.git
synced 2026-07-24 02:36:02 +10:00
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/**
|
|
* @file PureNode.js
|
|
* @UCLASS(BlueprintType, Blueprintable)
|
|
*/
|
|
|
|
import { NodeBase } from './NodeBase.js';
|
|
import { NodeRegistry } from './NodeRegistry.js';
|
|
|
|
/**
|
|
* @UCLASS(BlueprintType)
|
|
* Pure data node — optionally renders an image body. No exec logic.
|
|
*/
|
|
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
|
|
* @param {import('../GraphNode.js').GraphNode} graphNode
|
|
*/
|
|
BlueprintNativeEvent_OnRender(article, graphNode) {
|
|
if (!graphNode.imageSrc) return;
|
|
|
|
const body = document.createElement("div");
|
|
body.className = "node-body node-body--image";
|
|
|
|
const img = document.createElement("img");
|
|
img.src = graphNode.imageSrc;
|
|
img.alt = "";
|
|
img.className = "node-image";
|
|
body.appendChild(img);
|
|
|
|
article.appendChild(body);
|
|
}
|
|
}
|
|
|
|
NodeRegistry.UCLASS_Register(PureNode);
|