Files
armorpaint/base/Sources/LogicNode.ts
T
luboslenco 705045dfd4 Format
2024-03-07 20:37:30 +01:00

52 lines
886 B
TypeScript

class LogicNode {
inputs: LogicNodeInput[] = [];
outputs: LogicNode[][] = [];
constructor() {}
add_input = (node: LogicNode, from: i32) => {
this.inputs.push(new LogicNodeInput(node, from));
}
add_outputs = (nodes: LogicNode[]) => {
this.outputs.push(nodes);
}
get = (from: i32, done: (a: any)=>void) => {
done(null);
}
get_as_image = (from: i32, done: (img: image_t)=>void) => {
done(null);
}
get_cached_image = (): image_t => {
return null;
}
set = (value: any) => {}
}
class LogicNodeInput {
node: LogicNode;
from: i32; // Socket index
constructor(node: LogicNode, from: i32) {
this.node = node;
this.from = from;
}
get = (done: (a: any)=>void) => {
this.node.get(this.from, done);
}
get_as_image = (done: (img: image_t)=>void) => {
this.node.get_as_image(this.from, done);
}
set = (value: any) => {
this.node.set(value);
}
}