this repo has no description
1import { NodeManager } from "../Mangers/NodeManager";
2import { Node, NodeType } from "../structs/node";
3import { NodeDefinition } from "./Nodes";
4
5export let NodeArray: NodeDefinition = {
6 os: 'any',
7
8 isSingle: true,
9 name: 'Array',
10 typeId: 'array',
11
12 w: 200,
13
14 statics: [
15 {
16 name: "Key",
17 type: NodeType.Label,
18 value: null
19 }
20 ],
21
22 outputs: [
23 {
24 name: "Flow",
25 type: NodeType.Flow,
26 },
27 {
28 name: "Array",
29 type: NodeType.Array
30 }
31 ],
32
33 inputs: [
34 {
35 name: "Flow",
36 type: NodeType.Flow,
37 },
38 {
39 name: "Value",
40 type: NodeType.Any
41 }
42 ],
43
44 onInputsUpdate: async ( node: Node ) => {
45 let lastInput = node.inputs[node.inputs.length - 1];
46
47 if(lastInput.connections.length != 0){
48 node.inputs.push({
49 name: "Value",
50 type: NodeType.Any,
51 connections: [],
52 parent: node,
53 index: node.inputs.length
54 });
55 } else{
56 if(node.inputs.length > 2){
57 let prevInput = node.inputs[node.inputs.length - 2];
58 if(prevInput.connections.length == 0)
59 node.inputs.pop();
60 }
61 }
62
63 node.updateSize();
64 NodeManager.Instance.UpdateConfig();
65 }
66};