lexgui 8.0.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/components/AlertDialog.d.ts +7 -0
- package/build/components/Counter.d.ts +1 -0
- package/build/components/Dialog.d.ts +1 -1
- package/build/components/Footer.d.ts +1 -1
- package/build/components/Menubar.d.ts +2 -2
- package/build/core/Area.d.ts +22 -22
- package/build/core/Namespace.js +34 -34
- package/build/core/Namespace.js.map +1 -1
- package/build/core/Panel.d.ts +2 -3
- package/build/extensions/AssetView.d.ts +136 -134
- package/build/extensions/AssetView.js +1367 -1320
- package/build/extensions/AssetView.js.map +1 -1
- package/build/extensions/Audio.js +19 -19
- package/build/extensions/Audio.js.map +1 -1
- package/build/extensions/CodeEditor.js +867 -647
- package/build/extensions/CodeEditor.js.map +1 -1
- package/build/extensions/DocMaker.d.ts +1 -1
- package/build/extensions/DocMaker.js +73 -61
- package/build/extensions/DocMaker.js.map +1 -1
- package/build/extensions/GraphEditor.js +406 -305
- package/build/extensions/GraphEditor.js.map +1 -1
- package/build/extensions/ImUi.js +21 -20
- package/build/extensions/ImUi.js.map +1 -1
- package/build/extensions/Timeline.d.ts +29 -36
- package/build/extensions/Timeline.js +421 -424
- package/build/extensions/Timeline.js.map +1 -1
- package/build/extensions/VideoEditor.js +101 -97
- package/build/extensions/VideoEditor.js.map +1 -1
- package/build/extensions/index.d.ts +8 -8
- package/build/extensions/index.js +1 -1
- package/build/index.all.d.ts +2 -2
- package/build/index.css.d.ts +1 -1
- package/build/index.d.ts +56 -55
- package/build/lexgui.all.js +28488 -27640
- package/build/lexgui.all.js.map +1 -1
- package/build/lexgui.all.min.js +1 -1
- package/build/lexgui.all.module.js +28412 -27565
- package/build/lexgui.all.module.js.map +1 -1
- package/build/lexgui.all.module.min.js +1 -1
- package/build/lexgui.css +176 -69
- package/build/lexgui.js +13796 -13330
- package/build/lexgui.js.map +1 -1
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +13733 -13268
- package/build/lexgui.module.js.map +1 -1
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +22 -1
- package/demo.js +6 -5
- package/examples/all-components.html +3 -0
- package/examples/asset-view.html +52 -6
- package/examples/dialogs.html +3 -3
- package/examples/editor.html +1 -1
- package/examples/index.html +1 -1
- package/package.json +4 -1
|
@@ -3,7 +3,7 @@ import { LX } from '../core/Namespace.js';
|
|
|
3
3
|
|
|
4
4
|
// GraphEditor.ts @jxarco
|
|
5
5
|
if (!LX) {
|
|
6
|
-
throw (
|
|
6
|
+
throw ('Missing LX namespace!');
|
|
7
7
|
}
|
|
8
8
|
LX.extensions.push('GraphEditor');
|
|
9
9
|
const g = globalThis;
|
|
@@ -77,7 +77,7 @@ class GraphEditor {
|
|
|
77
77
|
groups = {};
|
|
78
78
|
supportedCastTypes = {};
|
|
79
79
|
selectedNodes = [];
|
|
80
|
-
main =
|
|
80
|
+
main = '';
|
|
81
81
|
mustStop = false;
|
|
82
82
|
state = GraphEditor.STOPPED;
|
|
83
83
|
isFocused = false;
|
|
@@ -113,16 +113,16 @@ class GraphEditor {
|
|
|
113
113
|
this._sidebar = area.addSidebar((m) => {
|
|
114
114
|
}, {
|
|
115
115
|
displaySelected: true,
|
|
116
|
-
headerIcon:
|
|
117
|
-
headerTitle:
|
|
118
|
-
headerSubtitle:
|
|
116
|
+
headerIcon: 'EllipsisVertical',
|
|
117
|
+
headerTitle: 'Create',
|
|
118
|
+
headerSubtitle: 'Press to rename',
|
|
119
119
|
onHeaderPressed: () => this._showRenameGraphDialog(),
|
|
120
|
-
footerIcon:
|
|
121
|
-
footerTitle:
|
|
122
|
-
footerSubtitle:
|
|
120
|
+
footerIcon: 'Plus',
|
|
121
|
+
footerTitle: 'Create',
|
|
122
|
+
footerSubtitle: 'Graph or Function',
|
|
123
123
|
onFooterPressed: (e) => this._onSidebarCreate(e)
|
|
124
124
|
});
|
|
125
|
-
this.area = new Area({ className:
|
|
125
|
+
this.area = new Area({ className: 'lexgraph' });
|
|
126
126
|
area.root.classList.add('grapharea');
|
|
127
127
|
this.root = this.area.root;
|
|
128
128
|
this.root.tabIndex = -1;
|
|
@@ -140,44 +140,46 @@ class GraphEditor {
|
|
|
140
140
|
area.addOverlayButtons([
|
|
141
141
|
[
|
|
142
142
|
{
|
|
143
|
-
name:
|
|
144
|
-
icon:
|
|
143
|
+
name: 'Start Graph',
|
|
144
|
+
icon: 'Play@solid',
|
|
145
145
|
callback: () => this.start(),
|
|
146
146
|
selectable: true
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
name:
|
|
150
|
-
icon:
|
|
149
|
+
name: 'Stop Graph',
|
|
150
|
+
icon: 'Stop@solid',
|
|
151
151
|
callback: () => this.stop(),
|
|
152
152
|
selectable: true
|
|
153
153
|
}
|
|
154
154
|
],
|
|
155
155
|
[
|
|
156
156
|
{
|
|
157
|
-
name:
|
|
158
|
-
icon:
|
|
157
|
+
name: 'Enable Snapping',
|
|
158
|
+
icon: 'Frame',
|
|
159
159
|
callback: () => this._toggleSnapping(),
|
|
160
160
|
selectable: true
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
name: 1,
|
|
164
164
|
options: [1, 2, 3],
|
|
165
|
-
callback: (value) => this._setSnappingValue(value)
|
|
165
|
+
callback: (value) => this._setSnappingValue(value)
|
|
166
166
|
}
|
|
167
167
|
],
|
|
168
168
|
[
|
|
169
169
|
{
|
|
170
|
-
name:
|
|
171
|
-
icon:
|
|
172
|
-
callback: () => {
|
|
170
|
+
name: 'Import',
|
|
171
|
+
icon: 'Upload',
|
|
172
|
+
callback: () => {
|
|
173
|
+
this.loadGraph('../../data/graph_sample.json');
|
|
174
|
+
}
|
|
173
175
|
},
|
|
174
176
|
{
|
|
175
|
-
name:
|
|
176
|
-
icon:
|
|
177
|
+
name: 'Export',
|
|
178
|
+
icon: 'ArrowRightFromLine',
|
|
177
179
|
callback: () => this.currentGraph?.export()
|
|
178
180
|
}
|
|
179
181
|
]
|
|
180
|
-
], { float:
|
|
182
|
+
], { float: 'htc' });
|
|
181
183
|
this.root.addEventListener('keydown', this._processKeyDown.bind(this), true);
|
|
182
184
|
this.root.addEventListener('keyup', this._processKeyUp.bind(this), true);
|
|
183
185
|
this.root.addEventListener('mousedown', this._processMouse.bind(this));
|
|
@@ -189,33 +191,59 @@ class GraphEditor {
|
|
|
189
191
|
this.root.addEventListener('contextmenu', this._processMouse.bind(this));
|
|
190
192
|
this.root.addEventListener('focus', this._processFocus.bind(this, true));
|
|
191
193
|
this.root.addEventListener('focusout', this._processFocus.bind(this, false));
|
|
192
|
-
this.propertiesDialog = new PocketDialog(
|
|
193
|
-
size: [
|
|
194
|
-
position: [
|
|
195
|
-
float:
|
|
194
|
+
this.propertiesDialog = new PocketDialog('Properties', null, {
|
|
195
|
+
size: ['350px', null],
|
|
196
|
+
position: ['8px', '8px'],
|
|
197
|
+
float: 'left',
|
|
196
198
|
class: 'lexgraphpropdialog'
|
|
197
199
|
});
|
|
198
200
|
// Avoid closing the dialog on click..
|
|
199
|
-
this.propertiesDialog.root.addEventListener(
|
|
201
|
+
this.propertiesDialog.root.addEventListener('mousedown', function (e) {
|
|
200
202
|
e.stopImmediatePropagation();
|
|
201
203
|
e.stopPropagation();
|
|
202
204
|
});
|
|
203
|
-
this.propertiesDialog.root.addEventListener(
|
|
205
|
+
this.propertiesDialog.root.addEventListener('mouseup', function (e) {
|
|
204
206
|
e.stopImmediatePropagation();
|
|
205
207
|
e.stopPropagation();
|
|
206
208
|
});
|
|
207
209
|
// Move to root..
|
|
208
210
|
this.root.appendChild(this.propertiesDialog.root);
|
|
209
|
-
this.addCastType('float', 'vec2', (v) => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.addCastType('float', '
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this.addCastType('
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.addCastType('
|
|
211
|
+
this.addCastType('float', 'vec2', (v) => {
|
|
212
|
+
return [v, v];
|
|
213
|
+
});
|
|
214
|
+
this.addCastType('float', 'vec3', (v) => {
|
|
215
|
+
return [v, v, v];
|
|
216
|
+
});
|
|
217
|
+
this.addCastType('float', 'vec4', (v) => {
|
|
218
|
+
return [v, v, v, v];
|
|
219
|
+
});
|
|
220
|
+
this.addCastType('float', 'bool', (v) => {
|
|
221
|
+
return !!v;
|
|
222
|
+
});
|
|
223
|
+
this.addCastType('vec4', 'vec3', (v) => {
|
|
224
|
+
v.slice(0, 3);
|
|
225
|
+
return v;
|
|
226
|
+
});
|
|
227
|
+
this.addCastType('vec4', 'vec2', (v) => {
|
|
228
|
+
v.slice(0, 2);
|
|
229
|
+
return v;
|
|
230
|
+
});
|
|
231
|
+
this.addCastType('vec3', 'vec2', (v) => {
|
|
232
|
+
v.slice(0, 2);
|
|
233
|
+
return v;
|
|
234
|
+
});
|
|
235
|
+
this.addCastType('vec3', 'vec4', (v) => {
|
|
236
|
+
v.push(1);
|
|
237
|
+
return v;
|
|
238
|
+
});
|
|
239
|
+
this.addCastType('vec2', 'vec3', (v) => {
|
|
240
|
+
v.push(1);
|
|
241
|
+
return v;
|
|
242
|
+
});
|
|
243
|
+
this.addCastType('vec2', 'vec4', (v) => {
|
|
244
|
+
v.push(0, 1);
|
|
245
|
+
return v;
|
|
246
|
+
});
|
|
219
247
|
this._nodeBackgroundOpacity = options.disableNodeOpacity ? 1.0 : this._nodeBackgroundOpacity;
|
|
220
248
|
// Back pattern
|
|
221
249
|
this._generatePattern();
|
|
@@ -240,10 +268,10 @@ class GraphEditor {
|
|
|
240
268
|
*/
|
|
241
269
|
static registerCustomNode(type, baseClass) {
|
|
242
270
|
if (!baseClass.prototype) {
|
|
243
|
-
throw
|
|
271
|
+
throw 'Cannot register a simple object, it must be a class with a prototype!';
|
|
244
272
|
}
|
|
245
273
|
// Get info from path
|
|
246
|
-
const pos = type.lastIndexOf(
|
|
274
|
+
const pos = type.lastIndexOf('/');
|
|
247
275
|
baseClass.category = type.substring(0, pos);
|
|
248
276
|
baseClass.title = baseClass.title ?? type.substring(pos + 1);
|
|
249
277
|
baseClass.type = type;
|
|
@@ -341,9 +369,12 @@ class GraphEditor {
|
|
|
341
369
|
*/
|
|
342
370
|
loadGraph(url, callback) {
|
|
343
371
|
const onComplete = (json) => {
|
|
344
|
-
let graph = (json.type == 'Graph')
|
|
345
|
-
|
|
372
|
+
let graph = (json.type == 'Graph')
|
|
373
|
+
? this.addGraph(json)
|
|
374
|
+
: this.addGraphFunction(json);
|
|
375
|
+
if (callback) {
|
|
346
376
|
callback(graph);
|
|
377
|
+
}
|
|
347
378
|
};
|
|
348
379
|
const onError = (v) => console.error(v);
|
|
349
380
|
LX.requestJSON(url, onComplete, onError);
|
|
@@ -363,7 +394,9 @@ class GraphEditor {
|
|
|
363
394
|
graph.configure(o);
|
|
364
395
|
}
|
|
365
396
|
this.setGraph(graph);
|
|
366
|
-
this._sidebar.add(graph.name, { icon:
|
|
397
|
+
this._sidebar.add(graph.name, { icon: 'CircleNodes', className: graph.id, callback: () => {
|
|
398
|
+
this.setGraph(graph);
|
|
399
|
+
} });
|
|
367
400
|
this._sidebar.update();
|
|
368
401
|
this._sidebar.select(graph.name);
|
|
369
402
|
return graph;
|
|
@@ -388,8 +421,8 @@ class GraphEditor {
|
|
|
388
421
|
static func;
|
|
389
422
|
static gid;
|
|
390
423
|
onCreate() {
|
|
391
|
-
this.addInput(null,
|
|
392
|
-
this.addOutput(null,
|
|
424
|
+
this.addInput(null, 'float');
|
|
425
|
+
this.addOutput(null, 'any');
|
|
393
426
|
}
|
|
394
427
|
onExecute() {
|
|
395
428
|
const func = NodeFunction.func;
|
|
@@ -399,8 +432,10 @@ class GraphEditor {
|
|
|
399
432
|
}
|
|
400
433
|
NodeFunction.func = func;
|
|
401
434
|
NodeFunction.gid = func.id;
|
|
402
|
-
GraphEditor.registerCustomNode(
|
|
403
|
-
this._sidebar.add(func.name, { icon:
|
|
435
|
+
GraphEditor.registerCustomNode('function/' + func.name, NodeFunction);
|
|
436
|
+
this._sidebar.add(func.name, { icon: 'Function', className: func.id, callback: () => {
|
|
437
|
+
this.setGraph(func);
|
|
438
|
+
} });
|
|
404
439
|
this._sidebar.update();
|
|
405
440
|
this._sidebar.select(func.name);
|
|
406
441
|
return func;
|
|
@@ -409,8 +444,8 @@ class GraphEditor {
|
|
|
409
444
|
* @method clear
|
|
410
445
|
*/
|
|
411
446
|
clear() {
|
|
412
|
-
this._domNodes.innerHTML =
|
|
413
|
-
this._domLinks.innerHTML =
|
|
447
|
+
this._domNodes.innerHTML = '';
|
|
448
|
+
this._domLinks.innerHTML = '';
|
|
414
449
|
this.nodes = {};
|
|
415
450
|
}
|
|
416
451
|
setVariable(name, value) {
|
|
@@ -425,12 +460,12 @@ class GraphEditor {
|
|
|
425
460
|
}
|
|
426
461
|
const nodes = this.currentGraph.nodes;
|
|
427
462
|
for (let node of nodes) {
|
|
428
|
-
if (!node[eventName])
|
|
463
|
+
if (!node[eventName]) {
|
|
429
464
|
continue;
|
|
465
|
+
}
|
|
430
466
|
node[eventName].apply(this, params);
|
|
431
467
|
}
|
|
432
468
|
}
|
|
433
|
-
;
|
|
434
469
|
/**
|
|
435
470
|
* @method addCastType
|
|
436
471
|
* @param {String} type: Type to cast
|
|
@@ -444,7 +479,7 @@ class GraphEditor {
|
|
|
444
479
|
* @method unSelectAll
|
|
445
480
|
*/
|
|
446
481
|
unSelectAll(keepPropDialog = false) {
|
|
447
|
-
this._domNodes.querySelectorAll('.lexgraphnode').forEach(v => v.classList.remove('selected'));
|
|
482
|
+
this._domNodes.querySelectorAll('.lexgraphnode').forEach((v) => v.classList.remove('selected'));
|
|
448
483
|
this.selectedNodes.length = 0;
|
|
449
484
|
if (!keepPropDialog) {
|
|
450
485
|
this._togglePropertiesDialog(false);
|
|
@@ -455,8 +490,8 @@ class GraphEditor {
|
|
|
455
490
|
node.graphID = this.currentGraph?.id;
|
|
456
491
|
var nodeContainer = document.createElement('div');
|
|
457
492
|
nodeContainer.classList.add('lexgraphnode');
|
|
458
|
-
nodeContainer.style.left =
|
|
459
|
-
nodeContainer.style.top =
|
|
493
|
+
nodeContainer.style.left = '0';
|
|
494
|
+
nodeContainer.style.top = '0';
|
|
460
495
|
this._translateNode(nodeContainer, node.position);
|
|
461
496
|
var color;
|
|
462
497
|
// Get color from type if color if not manually specified
|
|
@@ -465,7 +500,7 @@ class GraphEditor {
|
|
|
465
500
|
nodeContainer.classList.add(category);
|
|
466
501
|
}
|
|
467
502
|
else {
|
|
468
|
-
const pos = node.type.lastIndexOf(
|
|
503
|
+
const pos = node.type.lastIndexOf('/');
|
|
469
504
|
const category = node.type.substring(0, pos);
|
|
470
505
|
nodeContainer.classList.add(category);
|
|
471
506
|
}
|
|
@@ -481,12 +516,13 @@ class GraphEditor {
|
|
|
481
516
|
color = LX.hexToRgb(color);
|
|
482
517
|
color.forEach((v, i) => color[i] = v * 255);
|
|
483
518
|
}
|
|
484
|
-
nodeContainer.style.backgroundColor =
|
|
519
|
+
nodeContainer.style.backgroundColor = 'rgba(' + color + ', ' + this._nodeBackgroundOpacity + ')';
|
|
485
520
|
}
|
|
486
521
|
nodeContainer.addEventListener('mousedown', (e) => {
|
|
487
522
|
// Only for left click..
|
|
488
|
-
if (e.button != LX.MOUSE_LEFT_CLICK)
|
|
523
|
+
if (e.button != LX.MOUSE_LEFT_CLICK) {
|
|
489
524
|
return;
|
|
525
|
+
}
|
|
490
526
|
if (e.altKey) {
|
|
491
527
|
this._unSelectNode(nodeContainer);
|
|
492
528
|
}
|
|
@@ -495,16 +531,16 @@ class GraphEditor {
|
|
|
495
531
|
this.unSelectAll(true);
|
|
496
532
|
}
|
|
497
533
|
if (!nodeContainer.classList.contains('selected')) {
|
|
498
|
-
this._selectNode(nodeContainer,
|
|
534
|
+
this._selectNode(nodeContainer, e.ctrlKey || e.shiftKey);
|
|
499
535
|
}
|
|
500
536
|
}
|
|
501
537
|
});
|
|
502
|
-
nodeContainer.addEventListener('contextmenu', e => {
|
|
538
|
+
nodeContainer.addEventListener('contextmenu', (e) => {
|
|
503
539
|
e.preventDefault();
|
|
504
540
|
e.stopPropagation();
|
|
505
541
|
e.stopImmediatePropagation();
|
|
506
542
|
LX.addContextMenu(null, e, (m) => {
|
|
507
|
-
m.add(
|
|
543
|
+
m.add('Copy', () => {
|
|
508
544
|
this._clipboardData = {
|
|
509
545
|
id: node.id,
|
|
510
546
|
gid: this.currentGraph?.id
|
|
@@ -513,16 +549,17 @@ class GraphEditor {
|
|
|
513
549
|
// TODO
|
|
514
550
|
// m.add( "Paste", () => {
|
|
515
551
|
// } );
|
|
516
|
-
m.add(
|
|
517
|
-
m.add(
|
|
552
|
+
m.add('');
|
|
553
|
+
m.add('Delete', () => {
|
|
518
554
|
this._deleteNode(nodeContainer.dataset['id']);
|
|
519
555
|
});
|
|
520
556
|
});
|
|
521
557
|
});
|
|
522
|
-
nodeContainer.addEventListener('dblclick', e => {
|
|
558
|
+
nodeContainer.addEventListener('dblclick', (e) => {
|
|
523
559
|
// Only for left click..
|
|
524
|
-
if (e.button != LX.MOUSE_LEFT_CLICK)
|
|
560
|
+
if (e.button != LX.MOUSE_LEFT_CLICK) {
|
|
525
561
|
return;
|
|
562
|
+
}
|
|
526
563
|
// Open graph function..
|
|
527
564
|
if (node.constructor.func) {
|
|
528
565
|
this._sidebar.select(node.constructor.func.name);
|
|
@@ -569,7 +606,7 @@ class GraphEditor {
|
|
|
569
606
|
if (hasInputs) {
|
|
570
607
|
const nodeInputs = document.createElement('div');
|
|
571
608
|
nodeInputs.classList.add('lexgraphnodeinputs');
|
|
572
|
-
nodeInputs.style.width = hasOutputs ?
|
|
609
|
+
nodeInputs.style.width = hasOutputs ? '50%' : '100%';
|
|
573
610
|
nodeIO.appendChild(nodeInputs);
|
|
574
611
|
for (let i of node.inputs) {
|
|
575
612
|
if (!i.type) {
|
|
@@ -601,7 +638,7 @@ class GraphEditor {
|
|
|
601
638
|
if (hasOutputs) {
|
|
602
639
|
const nodeOutputs = document.createElement('div');
|
|
603
640
|
nodeOutputs.classList.add('lexgraphnodeoutputs');
|
|
604
|
-
nodeOutputs.style.width = hasInputs ?
|
|
641
|
+
nodeOutputs.style.width = hasInputs ? '50%' : '100%';
|
|
605
642
|
nodeIO.appendChild(nodeOutputs);
|
|
606
643
|
for (let o of node.outputs) {
|
|
607
644
|
if (!o.type) {
|
|
@@ -644,11 +681,12 @@ class GraphEditor {
|
|
|
644
681
|
this.main = id;
|
|
645
682
|
}
|
|
646
683
|
node.size = new vec2(nodeContainer.offsetWidth, nodeContainer.offsetHeight);
|
|
647
|
-
node.resizeObserver = new ResizeObserver(entries => {
|
|
684
|
+
node.resizeObserver = new ResizeObserver((entries) => {
|
|
648
685
|
for (const entry of entries) {
|
|
649
686
|
const bb = entry.contentRect;
|
|
650
|
-
if (!bb.width || !bb.height)
|
|
687
|
+
if (!bb.width || !bb.height) {
|
|
651
688
|
continue;
|
|
689
|
+
}
|
|
652
690
|
node.size = new vec2(nodeContainer.offsetWidth, nodeContainer.offsetHeight);
|
|
653
691
|
}
|
|
654
692
|
});
|
|
@@ -663,7 +701,7 @@ class GraphEditor {
|
|
|
663
701
|
// Inputs
|
|
664
702
|
if (hasInputs) {
|
|
665
703
|
const nodeInputs = nodeIO?.querySelector('.lexgraphnodeinputs');
|
|
666
|
-
nodeInputs.innerHTML =
|
|
704
|
+
nodeInputs.innerHTML = '';
|
|
667
705
|
for (let i of node.inputs) {
|
|
668
706
|
if (!i.type) {
|
|
669
707
|
console.warn(`Missing type for node [${node.constructor.name}], skipping...`);
|
|
@@ -692,7 +730,7 @@ class GraphEditor {
|
|
|
692
730
|
// Outputs
|
|
693
731
|
if (hasOutputs) {
|
|
694
732
|
const nodeOutputs = nodeIO?.querySelector('.lexgraphnodeoutputs');
|
|
695
|
-
nodeOutputs.innerHTML =
|
|
733
|
+
nodeOutputs.innerHTML = '';
|
|
696
734
|
for (let o of node.outputs) {
|
|
697
735
|
if (!o.type) {
|
|
698
736
|
console.warn(`Missing type for node [${node.constructor.name}], skipping...`);
|
|
@@ -725,8 +763,9 @@ class GraphEditor {
|
|
|
725
763
|
nodeIO?.querySelectorAll('.lexgraphnodeio').forEach((el) => {
|
|
726
764
|
el.addEventListener('mousedown', (e) => {
|
|
727
765
|
// Only for left click..
|
|
728
|
-
if (e.button != LX.MOUSE_LEFT_CLICK)
|
|
766
|
+
if (e.button != LX.MOUSE_LEFT_CLICK) {
|
|
729
767
|
return;
|
|
768
|
+
}
|
|
730
769
|
this._lastMouseDown = LX.getTime();
|
|
731
770
|
this._generatingLink = {
|
|
732
771
|
index: parseInt(el.dataset['index']),
|
|
@@ -755,8 +794,9 @@ class GraphEditor {
|
|
|
755
794
|
}
|
|
756
795
|
});
|
|
757
796
|
el.addEventListener('click', (e) => {
|
|
758
|
-
if (!el.links)
|
|
797
|
+
if (!el.links) {
|
|
759
798
|
return;
|
|
799
|
+
}
|
|
760
800
|
const nodeId = nodeContainer.dataset['id'];
|
|
761
801
|
this._deleteLinks(nodeId, el);
|
|
762
802
|
});
|
|
@@ -771,7 +811,7 @@ class GraphEditor {
|
|
|
771
811
|
elements = Array.from(this._domNodes.childNodes).filter((v) => v.classList.contains('lexgraphnode'));
|
|
772
812
|
}
|
|
773
813
|
if (exclude) {
|
|
774
|
-
elements = elements.filter(v => v != exclude);
|
|
814
|
+
elements = elements.filter((v) => v != exclude);
|
|
775
815
|
}
|
|
776
816
|
return elements;
|
|
777
817
|
}
|
|
@@ -785,8 +825,9 @@ class GraphEditor {
|
|
|
785
825
|
}
|
|
786
826
|
}
|
|
787
827
|
_onDragNode(target, e) {
|
|
788
|
-
if (!e.shiftKey)
|
|
828
|
+
if (!e.shiftKey) {
|
|
789
829
|
return;
|
|
830
|
+
}
|
|
790
831
|
this._cloneNodes();
|
|
791
832
|
}
|
|
792
833
|
_onMoveGroup(target) {
|
|
@@ -815,8 +856,9 @@ class GraphEditor {
|
|
|
815
856
|
const x = parseFloat(dom.style.left);
|
|
816
857
|
const y = parseFloat(dom.style.top);
|
|
817
858
|
const node_bb = new BoundingBox(new vec2(x, y), new vec2(dom.offsetWidth - 6, dom.offsetHeight - 6));
|
|
818
|
-
if (!group_bb.inside(node_bb))
|
|
859
|
+
if (!group_bb.inside(node_bb)) {
|
|
819
860
|
continue;
|
|
861
|
+
}
|
|
820
862
|
groupNodeIds.push(dom.dataset['id'] ?? dom);
|
|
821
863
|
}
|
|
822
864
|
target.nodes = groupNodeIds;
|
|
@@ -852,27 +894,39 @@ class GraphEditor {
|
|
|
852
894
|
switch (p.type) {
|
|
853
895
|
case 'float':
|
|
854
896
|
case 'int':
|
|
855
|
-
panel.addNumber(p.name, p.value, (v) => {
|
|
897
|
+
panel.addNumber(p.name, p.value, (v) => {
|
|
898
|
+
p.value = v;
|
|
899
|
+
});
|
|
856
900
|
break;
|
|
857
901
|
case 'string':
|
|
858
|
-
panel.addText(p.name, p.value, (v) => {
|
|
902
|
+
panel.addText(p.name, p.value, (v) => {
|
|
903
|
+
p.value = v;
|
|
904
|
+
});
|
|
859
905
|
break;
|
|
860
906
|
case 'vec2':
|
|
861
|
-
panel.addVector2(p.name, p.value, (v) => {
|
|
907
|
+
panel.addVector2(p.name, p.value, (v) => {
|
|
908
|
+
p.value = v;
|
|
909
|
+
});
|
|
862
910
|
break;
|
|
863
911
|
case 'vec3':
|
|
864
|
-
panel.addVector3(p.name, p.value, (v) => {
|
|
912
|
+
panel.addVector3(p.name, p.value, (v) => {
|
|
913
|
+
p.value = v;
|
|
914
|
+
});
|
|
865
915
|
break;
|
|
866
916
|
case 'vec4':
|
|
867
|
-
panel.addVector4(p.name, p.value, (v) => {
|
|
917
|
+
panel.addVector4(p.name, p.value, (v) => {
|
|
918
|
+
p.value = v;
|
|
919
|
+
});
|
|
868
920
|
break;
|
|
869
921
|
case 'select':
|
|
870
|
-
panel.addSelect(p.name, p.options, p.value, (v) => {
|
|
922
|
+
panel.addSelect(p.name, p.options, p.value, (v) => {
|
|
923
|
+
p.value = v;
|
|
924
|
+
});
|
|
871
925
|
break;
|
|
872
926
|
case 'array':
|
|
873
927
|
panel.addArray(p.name, p.value, (v) => {
|
|
874
928
|
p.value = v;
|
|
875
|
-
if (node.type ==
|
|
929
|
+
if (node.type == 'function/Input') {
|
|
876
930
|
node.setOutputs(v);
|
|
877
931
|
this._updateNodeDOMIOs(dom, node);
|
|
878
932
|
}
|
|
@@ -887,8 +941,9 @@ class GraphEditor {
|
|
|
887
941
|
// Delete from selected..
|
|
888
942
|
const idx = this.selectedNodes.indexOf(dom.dataset['id']);
|
|
889
943
|
this.selectedNodes.splice(idx, 1);
|
|
890
|
-
if (!this.selectedNodes.length)
|
|
944
|
+
if (!this.selectedNodes.length) {
|
|
891
945
|
this._togglePropertiesDialog(false);
|
|
946
|
+
}
|
|
892
947
|
}
|
|
893
948
|
_translateNode(dom, deltaTranslation, updateBasePosition = true) {
|
|
894
949
|
const translation = deltaTranslation.add(new vec2(parseFloat(dom.style.left), parseFloat(dom.style.top)));
|
|
@@ -898,8 +953,8 @@ class GraphEditor {
|
|
|
898
953
|
translation.y = Math.floor(translation.y / snapSize) * snapSize;
|
|
899
954
|
dom.mustSnap = false;
|
|
900
955
|
}
|
|
901
|
-
dom.style.left = (translation.x) +
|
|
902
|
-
dom.style.top = (translation.y) +
|
|
956
|
+
dom.style.left = (translation.x) + 'px';
|
|
957
|
+
dom.style.top = (translation.y) + 'px';
|
|
903
958
|
// Update base node position..
|
|
904
959
|
if (updateBasePosition && dom.dataset['id']) {
|
|
905
960
|
let baseNode = this.nodes[dom.dataset['id']];
|
|
@@ -921,13 +976,14 @@ class GraphEditor {
|
|
|
921
976
|
// Delete from the editor
|
|
922
977
|
delete this.nodes[nodeId];
|
|
923
978
|
// Delete from the graph data
|
|
924
|
-
const idx = this.currentGraph.nodes.findIndex(v => v.id === nodeId);
|
|
979
|
+
const idx = this.currentGraph.nodes.findIndex((v) => v.id === nodeId);
|
|
925
980
|
console.assert(idx >= 0);
|
|
926
981
|
this.currentGraph.nodes.splice(idx, 1);
|
|
927
982
|
// Delete connected links..
|
|
928
983
|
for (let key in this.currentGraph.links) {
|
|
929
|
-
if (!key.includes(nodeId))
|
|
984
|
+
if (!key.includes(nodeId)) {
|
|
930
985
|
continue;
|
|
986
|
+
}
|
|
931
987
|
const aIdx = key.indexOf('@');
|
|
932
988
|
const targetIsInput = key.substring(aIdx + 1) != nodeId;
|
|
933
989
|
// Remove the connection from the other before deleting..
|
|
@@ -950,14 +1006,16 @@ class GraphEditor {
|
|
|
950
1006
|
else {
|
|
951
1007
|
var active = false;
|
|
952
1008
|
for (var links of io.links) {
|
|
953
|
-
if (!links)
|
|
1009
|
+
if (!links) {
|
|
954
1010
|
continue;
|
|
1011
|
+
}
|
|
955
1012
|
for (var j of links) {
|
|
956
1013
|
active = active || (!!j);
|
|
957
1014
|
}
|
|
958
1015
|
}
|
|
959
|
-
if (!active)
|
|
1016
|
+
if (!active) {
|
|
960
1017
|
delete io.dataset['active'];
|
|
1018
|
+
}
|
|
961
1019
|
}
|
|
962
1020
|
}
|
|
963
1021
|
delete this.currentGraph.links[key];
|
|
@@ -971,7 +1029,7 @@ class GraphEditor {
|
|
|
971
1029
|
// Delete from the editor
|
|
972
1030
|
delete this.groups[groupId];
|
|
973
1031
|
// Delete from the graph data
|
|
974
|
-
const idx = this.currentGraph.groups.findIndex(v => v.id === groupId);
|
|
1032
|
+
const idx = this.currentGraph.groups.findIndex((v) => v.id === groupId);
|
|
975
1033
|
console.assert(idx >= 0);
|
|
976
1034
|
this.currentGraph.groups.splice(idx, 1);
|
|
977
1035
|
}
|
|
@@ -980,8 +1038,9 @@ class GraphEditor {
|
|
|
980
1038
|
return;
|
|
981
1039
|
const graph = this.graphs[graphId ?? this.currentGraph.id];
|
|
982
1040
|
const nodeData = graph.getNodeById(nodeId);
|
|
983
|
-
if (!nodeData)
|
|
1041
|
+
if (!nodeData) {
|
|
984
1042
|
return;
|
|
1043
|
+
}
|
|
985
1044
|
const el = this._getNodeDOMElement(nodeId);
|
|
986
1045
|
const newNode = GraphEditor.addNode(nodeData.type);
|
|
987
1046
|
newNode.properties = LX.deepCopy(nodeData.properties);
|
|
@@ -1012,10 +1071,12 @@ class GraphEditor {
|
|
|
1012
1071
|
_deleteLinks(nodeId, io) {
|
|
1013
1072
|
const isInput = io.classList.contains('ioinput');
|
|
1014
1073
|
const srcIndex = parseInt(io.dataset['index']);
|
|
1015
|
-
if (isInput) // Only one "link to output" to delete
|
|
1016
|
-
{
|
|
1074
|
+
if (isInput) { // Only one "link to output" to delete
|
|
1017
1075
|
let targetIndex = -1;
|
|
1018
|
-
const targets = io.links.filter((v, i) => {
|
|
1076
|
+
const targets = io.links.filter((v, i) => {
|
|
1077
|
+
targetIndex = i;
|
|
1078
|
+
return v !== undefined;
|
|
1079
|
+
})[0];
|
|
1019
1080
|
const targetId = targets[0];
|
|
1020
1081
|
// It has been deleted..
|
|
1021
1082
|
if (!targetId) {
|
|
@@ -1046,14 +1107,15 @@ class GraphEditor {
|
|
|
1046
1107
|
delete targetIO.dataset['active'];
|
|
1047
1108
|
}
|
|
1048
1109
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1110
|
+
// Delete ALL "to input links"
|
|
1111
|
+
else {
|
|
1051
1112
|
const numLinks = io.links.length;
|
|
1052
1113
|
for (let targetIndex = 0; targetIndex < numLinks; ++targetIndex) {
|
|
1053
1114
|
const targets = io.links[targetIndex];
|
|
1054
|
-
if (!targets)
|
|
1115
|
+
if (!targets) {
|
|
1055
1116
|
continue;
|
|
1056
|
-
|
|
1117
|
+
}
|
|
1118
|
+
for (let it = targets.length - 1; it >= 0; --it) {
|
|
1057
1119
|
const targetId = targets[it];
|
|
1058
1120
|
var links = this._getLinks(nodeId, targetId);
|
|
1059
1121
|
var linkIdx = links.findIndex((i) => (i.inputIdx == targetIndex && i.outputIdx == srcIndex));
|
|
@@ -1078,8 +1140,9 @@ class GraphEditor {
|
|
|
1078
1140
|
}
|
|
1079
1141
|
_processKeyDown(e) {
|
|
1080
1142
|
// Prevent processing keys on inputs and others
|
|
1081
|
-
if (document.activeElement != this.root)
|
|
1143
|
+
if (document.activeElement != this.root) {
|
|
1082
1144
|
return;
|
|
1145
|
+
}
|
|
1083
1146
|
const detail = e.detail;
|
|
1084
1147
|
var key = e.key ?? detail.key;
|
|
1085
1148
|
switch (key) {
|
|
@@ -1114,8 +1177,9 @@ class GraphEditor {
|
|
|
1114
1177
|
}
|
|
1115
1178
|
_processKeyUp(e) {
|
|
1116
1179
|
// Prevent processing keys on inputs and others
|
|
1117
|
-
if (document.activeElement != this.root)
|
|
1180
|
+
if (document.activeElement != this.root) {
|
|
1118
1181
|
return;
|
|
1182
|
+
}
|
|
1119
1183
|
const detail = e.detail;
|
|
1120
1184
|
const key = e.key ?? detail.key;
|
|
1121
1185
|
delete this.keys[key];
|
|
@@ -1146,8 +1210,7 @@ class GraphEditor {
|
|
|
1146
1210
|
else if (e.type == 'mousemove') {
|
|
1147
1211
|
this._processMouseMove(e);
|
|
1148
1212
|
}
|
|
1149
|
-
else if (e.type == 'click') // trick
|
|
1150
|
-
{
|
|
1213
|
+
else if (e.type == 'click') { // trick
|
|
1151
1214
|
switch (e.detail) {
|
|
1152
1215
|
case LX.MOUSE_DOUBLE_CLICK:
|
|
1153
1216
|
break;
|
|
@@ -1205,8 +1268,9 @@ class GraphEditor {
|
|
|
1205
1268
|
this._processContextMenu(e, linkInfo);
|
|
1206
1269
|
}
|
|
1207
1270
|
else if (this._boxSelecting) {
|
|
1208
|
-
if (!e.ctrlKey && !e.altKey)
|
|
1271
|
+
if (!e.ctrlKey && !e.altKey) {
|
|
1209
1272
|
this.unSelectAll();
|
|
1273
|
+
}
|
|
1210
1274
|
this._selectNodesInBox(this._boxSelecting, this._mousePosition, e.altKey);
|
|
1211
1275
|
LX.deleteElement(this._currentBoxSelectionSVG);
|
|
1212
1276
|
delete this._currentBoxSelectionSVG;
|
|
@@ -1218,7 +1282,7 @@ class GraphEditor {
|
|
|
1218
1282
|
if (!this.currentGraph) {
|
|
1219
1283
|
return;
|
|
1220
1284
|
}
|
|
1221
|
-
const rightPressed =
|
|
1285
|
+
const rightPressed = e.which == 3;
|
|
1222
1286
|
if (rightPressed) {
|
|
1223
1287
|
this.currentGraph.translation.add(this._deltaMousePosition.div(this.currentGraph.scale), this.currentGraph.translation);
|
|
1224
1288
|
this._updatePattern();
|
|
@@ -1234,8 +1298,9 @@ class GraphEditor {
|
|
|
1234
1298
|
}
|
|
1235
1299
|
}
|
|
1236
1300
|
_processWheel(e) {
|
|
1237
|
-
if (this._boxSelecting || !this.currentGraph)
|
|
1301
|
+
if (this._boxSelecting || !this.currentGraph) {
|
|
1238
1302
|
return;
|
|
1303
|
+
}
|
|
1239
1304
|
// Compute zoom center in pattern space using current scale
|
|
1240
1305
|
const rect = this.root.getBoundingClientRect();
|
|
1241
1306
|
const zoomCenter = this._mousePosition ?? new vec2(rect.width * 0.5, rect.height * 0.5);
|
|
@@ -1244,7 +1309,7 @@ class GraphEditor {
|
|
|
1244
1309
|
if (delta > 0.0)
|
|
1245
1310
|
this.currentGraph.scale *= 0.9;
|
|
1246
1311
|
else
|
|
1247
|
-
this.currentGraph.scale *=
|
|
1312
|
+
this.currentGraph.scale *= 1.0 / 0.9;
|
|
1248
1313
|
this.currentGraph.scale = LX.clamp(this.currentGraph.scale, GraphEditor.MIN_SCALE, GraphEditor.MAX_SCALE);
|
|
1249
1314
|
// Compute zoom center in pattern space using new scale
|
|
1250
1315
|
// and get delta..
|
|
@@ -1264,17 +1329,18 @@ class GraphEditor {
|
|
|
1264
1329
|
eventPosition = this._getPatternPosition(localPosition);
|
|
1265
1330
|
}
|
|
1266
1331
|
if (this._clipboardData) {
|
|
1267
|
-
m.add(
|
|
1332
|
+
m.add('Paste', () => {
|
|
1268
1333
|
const nodeId = this._clipboardData.id;
|
|
1269
1334
|
const graphId = this._clipboardData.gid;
|
|
1270
1335
|
this._cloneNode(nodeId, graphId, eventPosition);
|
|
1271
1336
|
});
|
|
1272
|
-
m.add(
|
|
1337
|
+
m.add('');
|
|
1273
1338
|
}
|
|
1274
1339
|
for (let type in GraphEditor.NODE_TYPES) {
|
|
1275
1340
|
const baseClass = GraphEditor.NODE_TYPES[type];
|
|
1276
|
-
if (baseClass.blockAdd)
|
|
1341
|
+
if (baseClass.blockAdd) {
|
|
1277
1342
|
continue;
|
|
1343
|
+
}
|
|
1278
1344
|
m.add(type, () => {
|
|
1279
1345
|
const newNode = GraphEditor.addNode(type);
|
|
1280
1346
|
const dom = this._createNodeDOM(newNode);
|
|
@@ -1295,7 +1361,7 @@ class GraphEditor {
|
|
|
1295
1361
|
inputType: srcIsInput ? srcType : newNode.inputs[0].type,
|
|
1296
1362
|
outputNode: srcIsInput ? newNode.id : srcId,
|
|
1297
1363
|
outputIdx: srcIsInput ? 0 : autoConnect.index,
|
|
1298
|
-
outputType: srcIsInput ? newNode.inputs[0].type : srcType
|
|
1364
|
+
outputType: srcIsInput ? newNode.inputs[0].type : srcType
|
|
1299
1365
|
};
|
|
1300
1366
|
// Store link
|
|
1301
1367
|
const pathId = newLink.outputNode + '@' + newLink.inputNode;
|
|
@@ -1354,10 +1420,10 @@ class GraphEditor {
|
|
|
1354
1420
|
pattern.appendChild(circle);
|
|
1355
1421
|
}
|
|
1356
1422
|
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1357
|
-
svg.classList.add(
|
|
1358
|
-
svg.style.width =
|
|
1359
|
-
svg.style.height =
|
|
1360
|
-
svg.style.stroke =
|
|
1423
|
+
svg.classList.add('background-svg');
|
|
1424
|
+
svg.style.width = '100%';
|
|
1425
|
+
svg.style.height = '100%';
|
|
1426
|
+
svg.style.stroke = 'none';
|
|
1361
1427
|
svg.appendChild(pattern);
|
|
1362
1428
|
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
|
1363
1429
|
rect.setAttribute('x', '0');
|
|
@@ -1433,12 +1499,12 @@ class GraphEditor {
|
|
|
1433
1499
|
const dst_node = this.nodes[dst_nodeId].data;
|
|
1434
1500
|
const dst_ioIndex = parseInt(e.target.parentElement.dataset['index']);
|
|
1435
1501
|
// Discard different types
|
|
1436
|
-
const srcIsInput =
|
|
1502
|
+
const srcIsInput = linkData.ioType == GraphEditor.NODE_IO_INPUT;
|
|
1437
1503
|
const src_ios = src_node[srcIsInput ? 'inputs' : 'outputs'];
|
|
1438
1504
|
const src_ioType = src_ios[src_ioIndex].type;
|
|
1439
1505
|
const dst_ios = dst_node[ioType == GraphEditor.NODE_IO_INPUT ? 'inputs' : 'outputs'];
|
|
1440
1506
|
const dst_ioType = dst_ios[dst_ioIndex].type;
|
|
1441
|
-
if (src_ioType != dst_ioType && src_ioType !=
|
|
1507
|
+
if (src_ioType != dst_ioType && src_ioType != 'any' && dst_ioType != 'any') {
|
|
1442
1508
|
// Different types, but it might be possible to cast types
|
|
1443
1509
|
const inputType = srcIsInput ? src_ioType : dst_ioType;
|
|
1444
1510
|
const outputType = srcIsInput ? dst_ioType : src_ioType;
|
|
@@ -1477,7 +1543,7 @@ class GraphEditor {
|
|
|
1477
1543
|
inputType: srcIsInput ? src_ioType : dst_ioType,
|
|
1478
1544
|
outputNode: srcIsInput ? dst_nodeId : src_nodeId,
|
|
1479
1545
|
outputIdx: srcIsInput ? dst_ioIndex : src_ioIndex,
|
|
1480
|
-
outputType: srcIsInput ? dst_ioType : src_ioType
|
|
1546
|
+
outputType: srcIsInput ? dst_ioType : src_ioType
|
|
1481
1547
|
});
|
|
1482
1548
|
path.dataset['id'] = pathId;
|
|
1483
1549
|
// Mark as active links...
|
|
@@ -1490,9 +1556,9 @@ class GraphEditor {
|
|
|
1490
1556
|
var path = this._generatingLink.path;
|
|
1491
1557
|
if (!path) {
|
|
1492
1558
|
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1493
|
-
svg.classList.add(
|
|
1494
|
-
svg.style.width =
|
|
1495
|
-
svg.style.height =
|
|
1559
|
+
svg.classList.add('link-svg');
|
|
1560
|
+
svg.style.width = '100%';
|
|
1561
|
+
svg.style.height = '100%';
|
|
1496
1562
|
this._domLinks.appendChild(svg);
|
|
1497
1563
|
path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1498
1564
|
path.setAttribute('fill', 'none');
|
|
@@ -1539,16 +1605,17 @@ class GraphEditor {
|
|
|
1539
1605
|
startPos = tmp;
|
|
1540
1606
|
}
|
|
1541
1607
|
let color = getComputedStyle(ioEl).backgroundColor;
|
|
1542
|
-
if (type == GraphEditor.NODE_IO_OUTPUT && endioEl)
|
|
1608
|
+
if (type == GraphEditor.NODE_IO_OUTPUT && endioEl) {
|
|
1543
1609
|
color = getComputedStyle(endioEl).backgroundColor;
|
|
1610
|
+
}
|
|
1544
1611
|
this._createLinkPath(path, startPos, endPos, color, !!e);
|
|
1545
1612
|
return path;
|
|
1546
1613
|
}
|
|
1547
1614
|
_createLink(link) {
|
|
1548
1615
|
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1549
|
-
svg.classList.add(
|
|
1550
|
-
svg.style.width =
|
|
1551
|
-
svg.style.height =
|
|
1616
|
+
svg.classList.add('link-svg');
|
|
1617
|
+
svg.style.width = '100%';
|
|
1618
|
+
svg.style.height = '100%';
|
|
1552
1619
|
this._domLinks.appendChild(svg);
|
|
1553
1620
|
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1554
1621
|
path.setAttribute('fill', 'none');
|
|
@@ -1611,14 +1678,16 @@ class GraphEditor {
|
|
|
1611
1678
|
const nodeDOM = this._getNodeDOMElement(nodeId);
|
|
1612
1679
|
// Update input links
|
|
1613
1680
|
for (let input of nodeDOM.querySelectorAll('.ioinput')) {
|
|
1614
|
-
if (!input.links)
|
|
1681
|
+
if (!input.links) {
|
|
1615
1682
|
continue;
|
|
1683
|
+
}
|
|
1616
1684
|
// Get first and only target output..
|
|
1617
1685
|
const targets = input.links.filter((v) => v !== undefined)[0];
|
|
1618
1686
|
const targetNodeId = targets[0];
|
|
1619
1687
|
// It has been deleted..
|
|
1620
|
-
if (!targetNodeId)
|
|
1688
|
+
if (!targetNodeId) {
|
|
1621
1689
|
continue;
|
|
1690
|
+
}
|
|
1622
1691
|
const ioIndex = parseInt(input.dataset['index']);
|
|
1623
1692
|
var links = this._getLinks(targetNodeId, nodeId);
|
|
1624
1693
|
// Inputs only have 1 possible output connected
|
|
@@ -1637,13 +1706,15 @@ class GraphEditor {
|
|
|
1637
1706
|
}
|
|
1638
1707
|
// Update output links
|
|
1639
1708
|
for (let output of nodeDOM.querySelectorAll('.iooutput')) {
|
|
1640
|
-
if (!output.links)
|
|
1709
|
+
if (!output.links) {
|
|
1641
1710
|
continue;
|
|
1711
|
+
}
|
|
1642
1712
|
const srcIndex = parseInt(output.dataset['index']);
|
|
1643
1713
|
for (let targetIndex = 0; targetIndex < output.links.length; ++targetIndex) {
|
|
1644
1714
|
const targets = output.links[targetIndex];
|
|
1645
|
-
if (!targets)
|
|
1715
|
+
if (!targets) {
|
|
1646
1716
|
continue;
|
|
1717
|
+
}
|
|
1647
1718
|
for (let targetId of targets) {
|
|
1648
1719
|
var links = this._getLinks(nodeId, targetId);
|
|
1649
1720
|
var link = links.find((i) => (i.inputIdx == targetIndex && i.outputIdx == srcIndex));
|
|
@@ -1668,12 +1739,12 @@ class GraphEditor {
|
|
|
1668
1739
|
var svg = this._currentBoxSelectionSVG;
|
|
1669
1740
|
if (!svg) {
|
|
1670
1741
|
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1671
|
-
svg.classList.add(
|
|
1742
|
+
svg.classList.add('box-selection-svg');
|
|
1672
1743
|
if (this._boxSelectRemoving) {
|
|
1673
|
-
svg.classList.add(
|
|
1744
|
+
svg.classList.add('removing');
|
|
1674
1745
|
}
|
|
1675
|
-
svg.style.width =
|
|
1676
|
-
svg.style.height =
|
|
1746
|
+
svg.style.width = '100%';
|
|
1747
|
+
svg.style.height = '100%';
|
|
1677
1748
|
this._domLinks.appendChild(svg);
|
|
1678
1749
|
this._currentBoxSelectionSVG = svg;
|
|
1679
1750
|
}
|
|
@@ -1694,7 +1765,7 @@ class GraphEditor {
|
|
|
1694
1765
|
_getNonVisibleNodes() {
|
|
1695
1766
|
const nonVisibleNodes = [];
|
|
1696
1767
|
if (!this.currentGraph) {
|
|
1697
|
-
console.warn(
|
|
1768
|
+
console.warn('No graph set');
|
|
1698
1769
|
return [];
|
|
1699
1770
|
}
|
|
1700
1771
|
const graph_bb = new BoundingBox(new vec2(0, 0), new vec2(this.root.offsetWidth, this.root.offsetHeight));
|
|
@@ -1734,12 +1805,15 @@ class GraphEditor {
|
|
|
1734
1805
|
for (let nodeEl of nodes) {
|
|
1735
1806
|
let pos = this._getNodePosition(nodeEl);
|
|
1736
1807
|
let size = new vec2(nodeEl.offsetWidth, nodeEl.offsetHeight);
|
|
1737
|
-
if ((!(pos.x < lt.x && (pos.x + size.x) < lt.x) && !(pos.x > rb.x && (pos.x + size.x) > rb.x))
|
|
1738
|
-
(!(pos.y < lt.y && (pos.y + size.y) < lt.y)
|
|
1739
|
-
|
|
1808
|
+
if ((!(pos.x < lt.x && (pos.x + size.x) < lt.x) && !(pos.x > rb.x && (pos.x + size.x) > rb.x))
|
|
1809
|
+
&& (!(pos.y < lt.y && (pos.y + size.y) < lt.y)
|
|
1810
|
+
&& !(pos.y > rb.y && (pos.y + size.y) > rb.y))) {
|
|
1811
|
+
if (remove) {
|
|
1740
1812
|
this._unSelectNode(nodeEl);
|
|
1741
|
-
|
|
1813
|
+
}
|
|
1814
|
+
else {
|
|
1742
1815
|
this._selectNode(nodeEl, true, false);
|
|
1816
|
+
}
|
|
1743
1817
|
}
|
|
1744
1818
|
}
|
|
1745
1819
|
}
|
|
@@ -1795,10 +1869,10 @@ class GraphEditor {
|
|
|
1795
1869
|
let groupDOM = document.createElement('div');
|
|
1796
1870
|
groupDOM.id = group_id;
|
|
1797
1871
|
groupDOM.classList.add('lexgraphgroup');
|
|
1798
|
-
groupDOM.style.left = group_bb.origin.x +
|
|
1799
|
-
groupDOM.style.top = group_bb.origin.y +
|
|
1800
|
-
groupDOM.style.width = group_bb.size.x +
|
|
1801
|
-
groupDOM.style.height = group_bb.size.y +
|
|
1872
|
+
groupDOM.style.left = group_bb.origin.x + 'px';
|
|
1873
|
+
groupDOM.style.top = group_bb.origin.y + 'px';
|
|
1874
|
+
groupDOM.style.width = group_bb.size.x + 'px';
|
|
1875
|
+
groupDOM.style.height = group_bb.size.y + 'px';
|
|
1802
1876
|
let groupResizer = document.createElement('div');
|
|
1803
1877
|
groupResizer.classList.add('lexgraphgroupresizer');
|
|
1804
1878
|
groupResizer.addEventListener('mousedown', inner_mousedown);
|
|
@@ -1819,8 +1893,8 @@ class GraphEditor {
|
|
|
1819
1893
|
function inner_mousemove(e) {
|
|
1820
1894
|
let dt = new vec2(lastPos[0] - e.x, lastPos[1] - e.y);
|
|
1821
1895
|
dt.div(that.currentGraph?.scale, dt);
|
|
1822
|
-
groupDOM.style.width = (parseFloat(groupDOM.style.width) - dt.x) +
|
|
1823
|
-
groupDOM.style.height = (parseFloat(groupDOM.style.height) - dt.y) +
|
|
1896
|
+
groupDOM.style.width = (parseFloat(groupDOM.style.width) - dt.x) + 'px';
|
|
1897
|
+
groupDOM.style.height = (parseFloat(groupDOM.style.height) - dt.y) + 'px';
|
|
1824
1898
|
lastPos[0] = e.x;
|
|
1825
1899
|
lastPos[1] = e.y;
|
|
1826
1900
|
e.stopPropagation();
|
|
@@ -1839,37 +1913,39 @@ class GraphEditor {
|
|
|
1839
1913
|
groupTitle.classList.add('lexgraphgrouptitle');
|
|
1840
1914
|
groupTitle.disabled = true;
|
|
1841
1915
|
// Dbl click to rename
|
|
1842
|
-
groupTitle.addEventListener('mousedown', e => {
|
|
1916
|
+
groupTitle.addEventListener('mousedown', (e) => {
|
|
1843
1917
|
e.stopPropagation();
|
|
1844
1918
|
e.stopImmediatePropagation();
|
|
1845
1919
|
});
|
|
1846
|
-
groupTitle.addEventListener('focusout', e => {
|
|
1920
|
+
groupTitle.addEventListener('focusout', (e) => {
|
|
1847
1921
|
groupTitle.disabled = true;
|
|
1848
|
-
if (!groupTitle.value.length)
|
|
1922
|
+
if (!groupTitle.value.length) {
|
|
1849
1923
|
groupTitle.value = defaultName;
|
|
1924
|
+
}
|
|
1850
1925
|
});
|
|
1851
|
-
groupTitle.addEventListener('keyup', e => {
|
|
1926
|
+
groupTitle.addEventListener('keyup', (e) => {
|
|
1852
1927
|
if (e.key == 'Enter') {
|
|
1853
1928
|
groupTitle.blur();
|
|
1854
1929
|
}
|
|
1855
1930
|
else if (e.key == 'Escape') {
|
|
1856
|
-
groupTitle.value =
|
|
1931
|
+
groupTitle.value = '';
|
|
1857
1932
|
groupTitle.blur();
|
|
1858
1933
|
}
|
|
1859
1934
|
});
|
|
1860
|
-
groupDOM.addEventListener('dblclick', e => {
|
|
1935
|
+
groupDOM.addEventListener('dblclick', (e) => {
|
|
1861
1936
|
// Only for left click..
|
|
1862
|
-
if (e.button != LX.MOUSE_LEFT_CLICK)
|
|
1937
|
+
if (e.button != LX.MOUSE_LEFT_CLICK) {
|
|
1863
1938
|
return;
|
|
1939
|
+
}
|
|
1864
1940
|
groupTitle.disabled = false;
|
|
1865
1941
|
groupTitle.focus();
|
|
1866
1942
|
});
|
|
1867
|
-
groupDOM.addEventListener('contextmenu', e => {
|
|
1943
|
+
groupDOM.addEventListener('contextmenu', (e) => {
|
|
1868
1944
|
e.preventDefault();
|
|
1869
1945
|
e.stopPropagation();
|
|
1870
1946
|
e.stopImmediatePropagation();
|
|
1871
1947
|
LX.addContextMenu(null, e, (m) => {
|
|
1872
|
-
m.add(
|
|
1948
|
+
m.add('Delete', () => {
|
|
1873
1949
|
this._deleteGroup(group_id);
|
|
1874
1950
|
});
|
|
1875
1951
|
});
|
|
@@ -1904,7 +1980,7 @@ class GraphEditor {
|
|
|
1904
1980
|
this._undoSteps.pop();
|
|
1905
1981
|
// Set old state
|
|
1906
1982
|
// TODO
|
|
1907
|
-
console.log(
|
|
1983
|
+
console.log('Undo!!');
|
|
1908
1984
|
}
|
|
1909
1985
|
_addRedoStep() {
|
|
1910
1986
|
this._redoSteps.push({
|
|
@@ -1920,7 +1996,7 @@ class GraphEditor {
|
|
|
1920
1996
|
this._redoSteps.pop();
|
|
1921
1997
|
// Set old state
|
|
1922
1998
|
// TODO
|
|
1923
|
-
console.log(
|
|
1999
|
+
console.log('Redo!!');
|
|
1924
2000
|
}
|
|
1925
2001
|
_togglePropertiesDialog(force = false) {
|
|
1926
2002
|
this.propertiesDialog.root.classList.toggle('opened', force);
|
|
@@ -1942,26 +2018,26 @@ class GraphEditor {
|
|
|
1942
2018
|
}
|
|
1943
2019
|
_onSidebarCreate(e) {
|
|
1944
2020
|
new LX.DropdownMenu(e.target, [
|
|
1945
|
-
{ name:
|
|
1946
|
-
{ name:
|
|
1947
|
-
], { side:
|
|
2021
|
+
{ name: 'Create Graph', icon: 'Workflow', callback: () => this.addGraph() },
|
|
2022
|
+
{ name: 'Create Function', icon: 'Function', callback: () => this.addGraphFunction() }
|
|
2023
|
+
], { side: 'right', align: 'start' });
|
|
1948
2024
|
}
|
|
1949
2025
|
_showRenameGraphDialog() {
|
|
1950
2026
|
if (!this.currentGraph)
|
|
1951
2027
|
return;
|
|
1952
2028
|
const dialog = new LX.Dialog(this.currentGraph.constructor.name, (p) => {
|
|
1953
|
-
p.addText(
|
|
2029
|
+
p.addText('Name', this.currentGraph?.name, (v) => {
|
|
1954
2030
|
this._updateGraphName(v);
|
|
1955
2031
|
dialog.close();
|
|
1956
2032
|
});
|
|
1957
|
-
}, { modal: true, size: [
|
|
2033
|
+
}, { modal: true, size: ['350px', null] });
|
|
1958
2034
|
}
|
|
1959
2035
|
_updateGraphName(name) {
|
|
1960
2036
|
if (!this.currentGraph)
|
|
1961
2037
|
return;
|
|
1962
2038
|
const newNameKey = name.replace(/\s/g, '').replaceAll('.', '');
|
|
1963
2039
|
// Change graph name button
|
|
1964
|
-
const nameDom = this._sidebar.root.querySelectorAll(
|
|
2040
|
+
const nameDom = this._sidebar.root.querySelectorAll('.lexsidebarheader span')[1];
|
|
1965
2041
|
console.assert(nameDom);
|
|
1966
2042
|
nameDom.innerText = name;
|
|
1967
2043
|
// Change name in sidebar
|
|
@@ -1978,7 +2054,7 @@ class GraphEditor {
|
|
|
1978
2054
|
if (nodeClass) {
|
|
1979
2055
|
delete GraphEditor.NODE_TYPES[oldType];
|
|
1980
2056
|
nodeClass.title = name;
|
|
1981
|
-
GraphEditor.registerCustomNode(
|
|
2057
|
+
GraphEditor.registerCustomNode('function/' + name, nodeClass);
|
|
1982
2058
|
}
|
|
1983
2059
|
this.currentGraph.name = name;
|
|
1984
2060
|
}
|
|
@@ -1990,9 +2066,9 @@ LX.GraphEditor = GraphEditor;
|
|
|
1990
2066
|
* @class Graph
|
|
1991
2067
|
*/
|
|
1992
2068
|
class Graph {
|
|
1993
|
-
name =
|
|
2069
|
+
name = 'Unnamed Graph';
|
|
1994
2070
|
type = 'Graph';
|
|
1995
|
-
id =
|
|
2071
|
+
id = '';
|
|
1996
2072
|
editor;
|
|
1997
2073
|
nodes = [];
|
|
1998
2074
|
groups = [];
|
|
@@ -2049,13 +2125,15 @@ class Graph {
|
|
|
2049
2125
|
// Reser variables each step?
|
|
2050
2126
|
this.variables = {};
|
|
2051
2127
|
const addNode = (id) => {
|
|
2052
|
-
if (visitedNodes[id])
|
|
2128
|
+
if (visitedNodes[id]) {
|
|
2053
2129
|
return;
|
|
2130
|
+
}
|
|
2054
2131
|
visitedNodes[id] = true;
|
|
2055
2132
|
for (let linkId in this.links) {
|
|
2056
2133
|
const idx = linkId.indexOf('@' + id);
|
|
2057
|
-
if (idx < 0)
|
|
2134
|
+
if (idx < 0) {
|
|
2058
2135
|
continue;
|
|
2136
|
+
}
|
|
2059
2137
|
const preNodeId = linkId.substring(0, idx);
|
|
2060
2138
|
this._executionNodes.push(preNodeId);
|
|
2061
2139
|
addNode(preNodeId);
|
|
@@ -2067,11 +2145,13 @@ class Graph {
|
|
|
2067
2145
|
addNode(mainId);
|
|
2068
2146
|
for (var i = this._executionNodes.length - 1; i >= 0; --i) {
|
|
2069
2147
|
const node = nodes[this._executionNodes[i]];
|
|
2070
|
-
if (node.onBeforeStep)
|
|
2148
|
+
if (node.onBeforeStep) {
|
|
2071
2149
|
node.onBeforeStep();
|
|
2150
|
+
}
|
|
2072
2151
|
node.execute();
|
|
2073
|
-
if (node.onBeforeStep)
|
|
2152
|
+
if (node.onBeforeStep) {
|
|
2074
2153
|
node.onAfterStep();
|
|
2154
|
+
}
|
|
2075
2155
|
}
|
|
2076
2156
|
}
|
|
2077
2157
|
/**
|
|
@@ -2123,7 +2203,7 @@ class Graph {
|
|
|
2123
2203
|
*/
|
|
2124
2204
|
export() {
|
|
2125
2205
|
const o = this.serialize();
|
|
2126
|
-
LX.downloadFile(this.name +
|
|
2206
|
+
LX.downloadFile(this.name + '.json', o);
|
|
2127
2207
|
}
|
|
2128
2208
|
}
|
|
2129
2209
|
LX.Graph = Graph;
|
|
@@ -2134,10 +2214,10 @@ class GraphNode {
|
|
|
2134
2214
|
static title;
|
|
2135
2215
|
static blockDelete = false;
|
|
2136
2216
|
static blockAdd = false;
|
|
2137
|
-
static description =
|
|
2138
|
-
id =
|
|
2139
|
-
type =
|
|
2140
|
-
title =
|
|
2217
|
+
static description = '';
|
|
2218
|
+
id = '';
|
|
2219
|
+
type = '';
|
|
2220
|
+
title = '';
|
|
2141
2221
|
inputs = [];
|
|
2142
2222
|
outputs = [];
|
|
2143
2223
|
properties = [];
|
|
@@ -2155,8 +2235,9 @@ class GraphNode {
|
|
|
2155
2235
|
// This should be empty
|
|
2156
2236
|
}
|
|
2157
2237
|
execute() {
|
|
2158
|
-
if (!this._hasOutputsConnected())
|
|
2238
|
+
if (!this._hasOutputsConnected()) {
|
|
2159
2239
|
return;
|
|
2240
|
+
}
|
|
2160
2241
|
if (this.onExecute) {
|
|
2161
2242
|
this.onExecute();
|
|
2162
2243
|
}
|
|
@@ -2171,38 +2252,45 @@ class GraphNode {
|
|
|
2171
2252
|
this.properties.push({ name, type, value, options: selectOptions });
|
|
2172
2253
|
}
|
|
2173
2254
|
getInput(index) {
|
|
2174
|
-
if (!this.inputs || !this.inputs.length || !this.inputs[index])
|
|
2255
|
+
if (!this.inputs || !this.inputs.length || !this.inputs[index]) {
|
|
2175
2256
|
return;
|
|
2257
|
+
}
|
|
2176
2258
|
const graph = this.editor?.graphs[this.graphID];
|
|
2177
2259
|
// Get data from link
|
|
2178
2260
|
for (let linkId in graph.links) {
|
|
2179
2261
|
const idx = linkId.indexOf('@' + this.id);
|
|
2180
|
-
if (idx < 0)
|
|
2262
|
+
if (idx < 0) {
|
|
2181
2263
|
continue;
|
|
2264
|
+
}
|
|
2182
2265
|
const nodeLinks = graph.links[linkId];
|
|
2183
2266
|
for (var link of nodeLinks) {
|
|
2184
|
-
if (link.inputIdx != index)
|
|
2267
|
+
if (link.inputIdx != index) {
|
|
2185
2268
|
continue;
|
|
2269
|
+
}
|
|
2186
2270
|
// This is the value!!
|
|
2187
2271
|
return link.data;
|
|
2188
2272
|
}
|
|
2189
2273
|
}
|
|
2190
2274
|
}
|
|
2191
2275
|
setOutput(index, data) {
|
|
2192
|
-
if (!this.outputs || !this.outputs.length || !this.outputs[index])
|
|
2276
|
+
if (!this.outputs || !this.outputs.length || !this.outputs[index]) {
|
|
2193
2277
|
return;
|
|
2278
|
+
}
|
|
2194
2279
|
const graph = this.editor?.graphs[this.graphID];
|
|
2195
2280
|
// Set data in link
|
|
2196
2281
|
for (let linkId in graph.links) {
|
|
2197
2282
|
const idx = linkId.indexOf(this.id + '@');
|
|
2198
|
-
if (idx < 0)
|
|
2283
|
+
if (idx < 0) {
|
|
2199
2284
|
continue;
|
|
2285
|
+
}
|
|
2200
2286
|
const nodeLinks = graph.links[linkId];
|
|
2201
2287
|
for (var link of nodeLinks) {
|
|
2202
|
-
if (link.outputIdx != index)
|
|
2288
|
+
if (link.outputIdx != index) {
|
|
2203
2289
|
continue;
|
|
2290
|
+
}
|
|
2204
2291
|
let innerData = data;
|
|
2205
|
-
if (innerData != undefined && link.inputType != link.outputType && link.inputType !=
|
|
2292
|
+
if (innerData != undefined && link.inputType != link.outputType && link.inputType != 'any'
|
|
2293
|
+
&& link.outputType != 'any') {
|
|
2206
2294
|
// In case of supported casting, use function to cast..
|
|
2207
2295
|
var fn = this.editor?.supportedCastTypes[link.outputType + '@' + link.inputType];
|
|
2208
2296
|
// Use function if it's possible to cast!
|
|
@@ -2232,12 +2320,12 @@ LX.GraphNode = GraphNode;
|
|
|
2232
2320
|
class GraphFunction extends Graph {
|
|
2233
2321
|
constructor(name, options = {}) {
|
|
2234
2322
|
super();
|
|
2235
|
-
this.name = name ?? (
|
|
2323
|
+
this.name = name ?? ('GraphFunction' + GraphEditor.LAST_FUNCTION_ID);
|
|
2236
2324
|
this.type = 'GraphFunction';
|
|
2237
2325
|
GraphEditor.LAST_FUNCTION_ID++;
|
|
2238
|
-
const nodeInput = GraphEditor.addNode(
|
|
2326
|
+
const nodeInput = GraphEditor.addNode('function/Input');
|
|
2239
2327
|
nodeInput.position = new vec2(150, 250);
|
|
2240
|
-
const nodeOutput = GraphEditor.addNode(
|
|
2328
|
+
const nodeOutput = GraphEditor.addNode('function/Output');
|
|
2241
2329
|
nodeOutput.position = new vec2(650, 350);
|
|
2242
2330
|
this.nodes.push(nodeInput, nodeOutput);
|
|
2243
2331
|
}
|
|
@@ -2265,8 +2353,9 @@ LX.GraphFunction = GraphFunction;
|
|
|
2265
2353
|
*/
|
|
2266
2354
|
class NodeFuncInput extends GraphNode {
|
|
2267
2355
|
onCreate() {
|
|
2268
|
-
this.addOutput(null,
|
|
2269
|
-
this.addProperty(
|
|
2356
|
+
this.addOutput(null, 'float');
|
|
2357
|
+
this.addProperty('Outputs', 'array', ['float'], ['float', 'int', 'bool', 'vec2', 'vec3', 'vec4',
|
|
2358
|
+
'mat44']);
|
|
2270
2359
|
}
|
|
2271
2360
|
onExecute() {
|
|
2272
2361
|
// var a = this.getInput( 0 ) ?? this.properties[ 0 ].value;
|
|
@@ -2282,10 +2371,10 @@ class NodeFuncInput extends GraphNode {
|
|
|
2282
2371
|
}
|
|
2283
2372
|
NodeFuncInput.blockDelete = true;
|
|
2284
2373
|
NodeFuncInput.blockAdd = true;
|
|
2285
|
-
GraphEditor.registerCustomNode(
|
|
2374
|
+
GraphEditor.registerCustomNode('function/Input', NodeFuncInput);
|
|
2286
2375
|
class NodeFuncOutput extends GraphNode {
|
|
2287
2376
|
onCreate() {
|
|
2288
|
-
this.addInput(null,
|
|
2377
|
+
this.addInput(null, 'any');
|
|
2289
2378
|
}
|
|
2290
2379
|
onExecute() {
|
|
2291
2380
|
// var a = this.getInput( 0 ) ?? this.properties[ 0 ].value;
|
|
@@ -2295,17 +2384,17 @@ class NodeFuncOutput extends GraphNode {
|
|
|
2295
2384
|
}
|
|
2296
2385
|
NodeFuncOutput.blockDelete = true;
|
|
2297
2386
|
NodeFuncOutput.blockAdd = true;
|
|
2298
|
-
GraphEditor.registerCustomNode(
|
|
2387
|
+
GraphEditor.registerCustomNode('function/Output', NodeFuncOutput);
|
|
2299
2388
|
/*
|
|
2300
2389
|
Math nodes
|
|
2301
2390
|
*/
|
|
2302
2391
|
class NodeAdd extends GraphNode {
|
|
2303
2392
|
onCreate() {
|
|
2304
|
-
this.addInput(null,
|
|
2305
|
-
this.addInput(null,
|
|
2306
|
-
this.addOutput(null,
|
|
2307
|
-
this.addProperty(
|
|
2308
|
-
this.addProperty(
|
|
2393
|
+
this.addInput(null, 'float');
|
|
2394
|
+
this.addInput(null, 'float');
|
|
2395
|
+
this.addOutput(null, 'float');
|
|
2396
|
+
this.addProperty('A', 'float', 0);
|
|
2397
|
+
this.addProperty('B', 'float', 0);
|
|
2309
2398
|
}
|
|
2310
2399
|
onExecute() {
|
|
2311
2400
|
var a = this.getInput(0) ?? this.properties[0].value;
|
|
@@ -2313,15 +2402,15 @@ class NodeAdd extends GraphNode {
|
|
|
2313
2402
|
this.setOutput(0, a + b);
|
|
2314
2403
|
}
|
|
2315
2404
|
}
|
|
2316
|
-
NodeAdd.description =
|
|
2317
|
-
GraphEditor.registerCustomNode(
|
|
2405
|
+
NodeAdd.description = 'Addition of 2 values (A+B).';
|
|
2406
|
+
GraphEditor.registerCustomNode('math/Add', NodeAdd);
|
|
2318
2407
|
class NodeSubstract extends GraphNode {
|
|
2319
2408
|
onCreate() {
|
|
2320
|
-
this.addInput(null,
|
|
2321
|
-
this.addInput(null,
|
|
2322
|
-
this.addOutput(null,
|
|
2323
|
-
this.addProperty(
|
|
2324
|
-
this.addProperty(
|
|
2409
|
+
this.addInput(null, 'float');
|
|
2410
|
+
this.addInput(null, 'float');
|
|
2411
|
+
this.addOutput(null, 'float');
|
|
2412
|
+
this.addProperty('A', 'float', 0);
|
|
2413
|
+
this.addProperty('B', 'float', 0);
|
|
2325
2414
|
}
|
|
2326
2415
|
onExecute() {
|
|
2327
2416
|
var a = this.getInput(0) ?? this.properties[0].value;
|
|
@@ -2329,15 +2418,15 @@ class NodeSubstract extends GraphNode {
|
|
|
2329
2418
|
this.setOutput(0, a - b);
|
|
2330
2419
|
}
|
|
2331
2420
|
}
|
|
2332
|
-
NodeSubstract.description =
|
|
2333
|
-
GraphEditor.registerCustomNode(
|
|
2421
|
+
NodeSubstract.description = 'Substraction of 2 values (A-B).';
|
|
2422
|
+
GraphEditor.registerCustomNode('math/Substract', NodeSubstract);
|
|
2334
2423
|
class NodeMultiply extends GraphNode {
|
|
2335
2424
|
onCreate() {
|
|
2336
|
-
this.addInput(null,
|
|
2337
|
-
this.addInput(null,
|
|
2338
|
-
this.addOutput(null,
|
|
2339
|
-
this.addProperty(
|
|
2340
|
-
this.addProperty(
|
|
2425
|
+
this.addInput(null, 'float');
|
|
2426
|
+
this.addInput(null, 'float');
|
|
2427
|
+
this.addOutput(null, 'float');
|
|
2428
|
+
this.addProperty('A', 'float', 0);
|
|
2429
|
+
this.addProperty('B', 'float', 0);
|
|
2341
2430
|
}
|
|
2342
2431
|
onExecute() {
|
|
2343
2432
|
var a = this.getInput(0) ?? this.properties[0].value;
|
|
@@ -2345,15 +2434,15 @@ class NodeMultiply extends GraphNode {
|
|
|
2345
2434
|
this.setOutput(0, a * b);
|
|
2346
2435
|
}
|
|
2347
2436
|
}
|
|
2348
|
-
NodeMultiply.description =
|
|
2349
|
-
GraphEditor.registerCustomNode(
|
|
2437
|
+
NodeMultiply.description = 'Multiplication of 2 values (A*B).';
|
|
2438
|
+
GraphEditor.registerCustomNode('math/Multiply', NodeMultiply);
|
|
2350
2439
|
class NodeDivide extends GraphNode {
|
|
2351
2440
|
onCreate() {
|
|
2352
|
-
this.addInput(null,
|
|
2353
|
-
this.addInput(null,
|
|
2354
|
-
this.addOutput(null,
|
|
2355
|
-
this.addProperty(
|
|
2356
|
-
this.addProperty(
|
|
2441
|
+
this.addInput(null, 'float');
|
|
2442
|
+
this.addInput(null, 'float');
|
|
2443
|
+
this.addOutput(null, 'float');
|
|
2444
|
+
this.addProperty('A', 'float', 0);
|
|
2445
|
+
this.addProperty('B', 'float', 0);
|
|
2357
2446
|
}
|
|
2358
2447
|
onExecute() {
|
|
2359
2448
|
var a = this.getInput(0) ?? this.properties[0].value;
|
|
@@ -2361,21 +2450,21 @@ class NodeDivide extends GraphNode {
|
|
|
2361
2450
|
this.setOutput(0, a / b);
|
|
2362
2451
|
}
|
|
2363
2452
|
}
|
|
2364
|
-
NodeDivide.description =
|
|
2365
|
-
GraphEditor.registerCustomNode(
|
|
2453
|
+
NodeDivide.description = 'Division of 2 values (A/B).';
|
|
2454
|
+
GraphEditor.registerCustomNode('math/Divide', NodeDivide);
|
|
2366
2455
|
class NodeSqrt extends GraphNode {
|
|
2367
2456
|
onCreate() {
|
|
2368
|
-
this.addInput(null,
|
|
2369
|
-
this.addOutput(null,
|
|
2370
|
-
this.addProperty(
|
|
2457
|
+
this.addInput(null, 'float');
|
|
2458
|
+
this.addOutput(null, 'float');
|
|
2459
|
+
this.addProperty('Value', 'float', 0);
|
|
2371
2460
|
}
|
|
2372
2461
|
onExecute() {
|
|
2373
2462
|
var a = this.getInput(0) ?? this.properties[0].value;
|
|
2374
2463
|
this.setOutput(0, Math.sqrt(a));
|
|
2375
2464
|
}
|
|
2376
2465
|
}
|
|
2377
|
-
NodeSqrt.description =
|
|
2378
|
-
GraphEditor.registerCustomNode(
|
|
2466
|
+
NodeSqrt.description = 'Square root of a scalar.';
|
|
2467
|
+
GraphEditor.registerCustomNode('math/SQRT', NodeSqrt);
|
|
2379
2468
|
/*
|
|
2380
2469
|
Math Missing:
|
|
2381
2470
|
- abs
|
|
@@ -2400,270 +2489,282 @@ Math Missing:
|
|
|
2400
2489
|
*/
|
|
2401
2490
|
class NodeAnd extends GraphNode {
|
|
2402
2491
|
onCreate() {
|
|
2403
|
-
this.addInput(null,
|
|
2404
|
-
this.addInput(null,
|
|
2405
|
-
this.addOutput(null,
|
|
2492
|
+
this.addInput(null, 'bool');
|
|
2493
|
+
this.addInput(null, 'bool');
|
|
2494
|
+
this.addOutput(null, 'bool');
|
|
2406
2495
|
}
|
|
2407
2496
|
onExecute() {
|
|
2408
2497
|
var a = this.getInput(0), b = this.getInput(1);
|
|
2409
|
-
if (a == undefined || b == undefined)
|
|
2498
|
+
if (a == undefined || b == undefined) {
|
|
2410
2499
|
return;
|
|
2411
|
-
|
|
2500
|
+
}
|
|
2501
|
+
this.setOutput(0, !!a && !!b);
|
|
2412
2502
|
}
|
|
2413
2503
|
}
|
|
2414
|
-
GraphEditor.registerCustomNode(
|
|
2504
|
+
GraphEditor.registerCustomNode('logic/And', NodeAnd);
|
|
2415
2505
|
class NodeOr extends GraphNode {
|
|
2416
2506
|
onCreate() {
|
|
2417
|
-
this.addInput(null,
|
|
2418
|
-
this.addInput(null,
|
|
2419
|
-
this.addOutput(null,
|
|
2507
|
+
this.addInput(null, 'bool');
|
|
2508
|
+
this.addInput(null, 'bool');
|
|
2509
|
+
this.addOutput(null, 'bool');
|
|
2420
2510
|
}
|
|
2421
2511
|
onExecute() {
|
|
2422
2512
|
var a = this.getInput(0), b = this.getInput(1);
|
|
2423
|
-
if (a == undefined || b == undefined)
|
|
2513
|
+
if (a == undefined || b == undefined) {
|
|
2424
2514
|
return;
|
|
2425
|
-
|
|
2515
|
+
}
|
|
2516
|
+
this.setOutput(0, !!a || !!b);
|
|
2426
2517
|
}
|
|
2427
2518
|
}
|
|
2428
|
-
GraphEditor.registerCustomNode(
|
|
2519
|
+
GraphEditor.registerCustomNode('logic/Or', NodeOr);
|
|
2429
2520
|
class NodeEqual extends GraphNode {
|
|
2430
2521
|
onCreate() {
|
|
2431
|
-
this.addInput(null,
|
|
2432
|
-
this.addInput(null,
|
|
2433
|
-
this.addOutput(null,
|
|
2522
|
+
this.addInput(null, 'float');
|
|
2523
|
+
this.addInput(null, 'float');
|
|
2524
|
+
this.addOutput(null, 'bool');
|
|
2434
2525
|
}
|
|
2435
2526
|
logicOp(a, b) {
|
|
2436
2527
|
return a == b;
|
|
2437
2528
|
}
|
|
2438
2529
|
onExecute() {
|
|
2439
2530
|
var a = this.getInput(0), b = this.getInput(1);
|
|
2440
|
-
if (a == undefined || b == undefined)
|
|
2531
|
+
if (a == undefined || b == undefined) {
|
|
2441
2532
|
return;
|
|
2533
|
+
}
|
|
2442
2534
|
this.setOutput(0, this.logicOp(a, b));
|
|
2443
2535
|
}
|
|
2444
2536
|
}
|
|
2445
|
-
GraphEditor.registerCustomNode(
|
|
2537
|
+
GraphEditor.registerCustomNode('logic/Equal', NodeEqual);
|
|
2446
2538
|
class NodeNotEqual extends NodeEqual {
|
|
2447
2539
|
logicOp(a, b) {
|
|
2448
2540
|
return a != b;
|
|
2449
2541
|
}
|
|
2450
2542
|
}
|
|
2451
|
-
GraphEditor.registerCustomNode(
|
|
2543
|
+
GraphEditor.registerCustomNode('logic/NotEqual', NodeNotEqual);
|
|
2452
2544
|
class NodeLess extends NodeEqual {
|
|
2453
2545
|
logicOp(a, b) {
|
|
2454
2546
|
return a < b;
|
|
2455
2547
|
}
|
|
2456
2548
|
}
|
|
2457
|
-
GraphEditor.registerCustomNode(
|
|
2549
|
+
GraphEditor.registerCustomNode('logic/Less', NodeLess);
|
|
2458
2550
|
class NodeLessEqual extends NodeEqual {
|
|
2459
2551
|
logicOp(a, b) {
|
|
2460
2552
|
return a <= b;
|
|
2461
2553
|
}
|
|
2462
2554
|
}
|
|
2463
|
-
GraphEditor.registerCustomNode(
|
|
2555
|
+
GraphEditor.registerCustomNode('logic/LessEqual', NodeLessEqual);
|
|
2464
2556
|
class NodeGreater extends NodeEqual {
|
|
2465
2557
|
logicOp(a, b) {
|
|
2466
2558
|
return a > b;
|
|
2467
2559
|
}
|
|
2468
2560
|
}
|
|
2469
|
-
GraphEditor.registerCustomNode(
|
|
2561
|
+
GraphEditor.registerCustomNode('logic/Greater', NodeGreater);
|
|
2470
2562
|
class NodeGreaterEqual extends NodeEqual {
|
|
2471
2563
|
logicOp(a, b) {
|
|
2472
2564
|
return a >= b;
|
|
2473
2565
|
}
|
|
2474
2566
|
}
|
|
2475
|
-
GraphEditor.registerCustomNode(
|
|
2567
|
+
GraphEditor.registerCustomNode('logic/GreaterEqual', NodeGreaterEqual);
|
|
2476
2568
|
class NodeSelect extends GraphNode {
|
|
2477
2569
|
onCreate() {
|
|
2478
|
-
this.addInput(
|
|
2479
|
-
this.addInput(
|
|
2480
|
-
this.addInput(
|
|
2481
|
-
this.addOutput(null,
|
|
2570
|
+
this.addInput('True', 'any');
|
|
2571
|
+
this.addInput('False', 'any');
|
|
2572
|
+
this.addInput('Condition', 'bool');
|
|
2573
|
+
this.addOutput(null, 'any');
|
|
2482
2574
|
}
|
|
2483
2575
|
onExecute() {
|
|
2484
2576
|
var a = this.getInput(0), b = this.getInput(1), cond = this.getInput(2);
|
|
2485
|
-
if (a == undefined || b == undefined || cond == undefined)
|
|
2577
|
+
if (a == undefined || b == undefined || cond == undefined) {
|
|
2486
2578
|
return;
|
|
2579
|
+
}
|
|
2487
2580
|
this.setOutput(0, cond ? a : b);
|
|
2488
2581
|
}
|
|
2489
2582
|
}
|
|
2490
|
-
GraphEditor.registerCustomNode(
|
|
2583
|
+
GraphEditor.registerCustomNode('logic/Select', NodeSelect);
|
|
2491
2584
|
class NodeCompare extends GraphNode {
|
|
2492
2585
|
onCreate() {
|
|
2493
|
-
this.addInput(
|
|
2494
|
-
this.addInput(
|
|
2495
|
-
this.addInput(
|
|
2496
|
-
this.addInput(
|
|
2497
|
-
this.addProperty(
|
|
2498
|
-
|
|
2586
|
+
this.addInput('A', 'any');
|
|
2587
|
+
this.addInput('B', 'any');
|
|
2588
|
+
this.addInput('True', 'any');
|
|
2589
|
+
this.addInput('False', 'any');
|
|
2590
|
+
this.addProperty('Condition', 'select', 'Equal', ['Equal', 'Not Equal', 'Less', 'Less Equal', 'Greater',
|
|
2591
|
+
'Greater Equal']);
|
|
2592
|
+
this.addOutput(null, 'any');
|
|
2499
2593
|
}
|
|
2500
2594
|
onExecute() {
|
|
2501
2595
|
var a = this.getInput(0), b = this.getInput(1), TrueVal = this.getInput(2), FalseVal = this.getInput(3);
|
|
2502
2596
|
var cond = this.properties[0].value;
|
|
2503
|
-
if (a == undefined || b == undefined || TrueVal == undefined || FalseVal == undefined)
|
|
2597
|
+
if (a == undefined || b == undefined || TrueVal == undefined || FalseVal == undefined) {
|
|
2504
2598
|
return;
|
|
2599
|
+
}
|
|
2505
2600
|
var output;
|
|
2506
2601
|
switch (cond) {
|
|
2507
2602
|
case 'Equal':
|
|
2508
|
-
output =
|
|
2603
|
+
output = a == b ? TrueVal : FalseVal;
|
|
2509
2604
|
break;
|
|
2510
2605
|
case 'Not Equal':
|
|
2511
|
-
output =
|
|
2606
|
+
output = a != b ? TrueVal : FalseVal;
|
|
2512
2607
|
break;
|
|
2513
2608
|
case 'Less':
|
|
2514
|
-
output =
|
|
2609
|
+
output = a < b ? TrueVal : FalseVal;
|
|
2515
2610
|
break;
|
|
2516
2611
|
case 'Less Equal':
|
|
2517
|
-
output =
|
|
2612
|
+
output = a <= b ? TrueVal : FalseVal;
|
|
2518
2613
|
break;
|
|
2519
2614
|
case 'Greater':
|
|
2520
|
-
output =
|
|
2615
|
+
output = a > b ? TrueVal : FalseVal;
|
|
2521
2616
|
break;
|
|
2522
2617
|
case 'Greater Equal':
|
|
2523
|
-
output =
|
|
2618
|
+
output = a >= b ? TrueVal : FalseVal;
|
|
2524
2619
|
break;
|
|
2525
2620
|
}
|
|
2526
2621
|
this.setOutput(0, output);
|
|
2527
2622
|
}
|
|
2528
2623
|
}
|
|
2529
|
-
NodeCompare.description =
|
|
2530
|
-
|
|
2624
|
+
NodeCompare.description =
|
|
2625
|
+
'Compare A to B given the selected operator. If true, return value of True else return value of False.';
|
|
2626
|
+
GraphEditor.registerCustomNode('logic/Compare', NodeCompare);
|
|
2531
2627
|
/*
|
|
2532
2628
|
Event nodes
|
|
2533
2629
|
*/
|
|
2534
2630
|
class NodeKeyDown extends GraphNode {
|
|
2535
2631
|
onCreate() {
|
|
2536
|
-
this.addOutput(null,
|
|
2537
|
-
this.addProperty(
|
|
2632
|
+
this.addOutput(null, 'bool');
|
|
2633
|
+
this.addProperty('Key', 'string', ' ');
|
|
2538
2634
|
}
|
|
2539
2635
|
onExecute() {
|
|
2540
2636
|
this.setOutput(0, !!this.editor?.keys[this.properties[0].value]);
|
|
2541
2637
|
}
|
|
2542
2638
|
}
|
|
2543
|
-
GraphEditor.registerCustomNode(
|
|
2639
|
+
GraphEditor.registerCustomNode('events/KeyDown', NodeKeyDown);
|
|
2544
2640
|
/*
|
|
2545
2641
|
Input nodes
|
|
2546
2642
|
*/
|
|
2547
2643
|
class NodeString extends GraphNode {
|
|
2548
2644
|
onCreate() {
|
|
2549
|
-
this.addOutput(null,
|
|
2550
|
-
this.addProperty(null,
|
|
2645
|
+
this.addOutput(null, 'string');
|
|
2646
|
+
this.addProperty(null, 'string', 'text');
|
|
2551
2647
|
}
|
|
2552
2648
|
onExecute() {
|
|
2553
2649
|
this.setOutput(0, this.properties[0].value);
|
|
2554
2650
|
}
|
|
2555
2651
|
}
|
|
2556
|
-
GraphEditor.registerCustomNode(
|
|
2652
|
+
GraphEditor.registerCustomNode('inputs/String', NodeString);
|
|
2557
2653
|
class NodeFloat extends GraphNode {
|
|
2558
2654
|
onCreate() {
|
|
2559
|
-
this.addOutput(null,
|
|
2560
|
-
this.addProperty(null,
|
|
2655
|
+
this.addOutput(null, 'float');
|
|
2656
|
+
this.addProperty(null, 'float', 0.0);
|
|
2561
2657
|
}
|
|
2562
2658
|
onExecute() {
|
|
2563
2659
|
this.setOutput(0, this.properties[0].value);
|
|
2564
2660
|
}
|
|
2565
2661
|
}
|
|
2566
|
-
GraphEditor.registerCustomNode(
|
|
2662
|
+
GraphEditor.registerCustomNode('inputs/Float', NodeFloat);
|
|
2567
2663
|
class NodeVector2 extends GraphNode {
|
|
2568
2664
|
onCreate() {
|
|
2569
|
-
this.addOutput(
|
|
2570
|
-
this.addProperty(
|
|
2665
|
+
this.addOutput('Value', 'vec2');
|
|
2666
|
+
this.addProperty('Value', 'vec2', [0, 0]);
|
|
2571
2667
|
}
|
|
2572
2668
|
onExecute() {
|
|
2573
2669
|
this.setOutput(0, this.properties[0].value);
|
|
2574
2670
|
}
|
|
2575
2671
|
}
|
|
2576
|
-
GraphEditor.registerCustomNode(
|
|
2672
|
+
GraphEditor.registerCustomNode('inputs/Vector2', NodeVector2);
|
|
2577
2673
|
class NodeVector3 extends GraphNode {
|
|
2578
2674
|
onCreate() {
|
|
2579
|
-
this.addOutput(
|
|
2580
|
-
this.addProperty(
|
|
2675
|
+
this.addOutput('Value', 'vec3');
|
|
2676
|
+
this.addProperty('Value', 'vec3', [0, 0, 0]);
|
|
2581
2677
|
}
|
|
2582
2678
|
onExecute() {
|
|
2583
2679
|
this.setOutput(0, this.properties[0].value);
|
|
2584
2680
|
}
|
|
2585
2681
|
}
|
|
2586
|
-
GraphEditor.registerCustomNode(
|
|
2682
|
+
GraphEditor.registerCustomNode('inputs/Vector3', NodeVector3);
|
|
2587
2683
|
class NodeVector4 extends GraphNode {
|
|
2588
2684
|
onCreate() {
|
|
2589
|
-
this.addOutput(
|
|
2590
|
-
this.addProperty(
|
|
2685
|
+
this.addOutput('Value', 'vec4');
|
|
2686
|
+
this.addProperty('Value', 'vec4', [0, 0, 0, 0]);
|
|
2591
2687
|
}
|
|
2592
2688
|
onExecute() {
|
|
2593
2689
|
this.setOutput(0, this.properties[0].value);
|
|
2594
2690
|
}
|
|
2595
2691
|
}
|
|
2596
|
-
GraphEditor.registerCustomNode(
|
|
2692
|
+
GraphEditor.registerCustomNode('inputs/Vector4', NodeVector4);
|
|
2597
2693
|
/*
|
|
2598
2694
|
Variable nodes
|
|
2599
2695
|
*/
|
|
2600
2696
|
class NodeSetVariable extends GraphNode {
|
|
2601
2697
|
onCreate() {
|
|
2602
|
-
this.addInput(
|
|
2603
|
-
this.addOutput(null,
|
|
2604
|
-
this.addProperty(
|
|
2698
|
+
this.addInput('Value', 'any');
|
|
2699
|
+
this.addOutput(null, 'any');
|
|
2700
|
+
this.addProperty('Name', 'string', '');
|
|
2605
2701
|
}
|
|
2606
2702
|
onExecute() {
|
|
2607
2703
|
var varName = this.getInput(0);
|
|
2608
|
-
if (varName == undefined)
|
|
2704
|
+
if (varName == undefined) {
|
|
2609
2705
|
return;
|
|
2706
|
+
}
|
|
2610
2707
|
var varValue = this.getInput(1);
|
|
2611
|
-
if (varValue == undefined)
|
|
2708
|
+
if (varValue == undefined) {
|
|
2612
2709
|
return;
|
|
2710
|
+
}
|
|
2613
2711
|
this.editor?.setVariable(varName, varValue);
|
|
2614
2712
|
this.setOutput(0, varValue);
|
|
2615
2713
|
}
|
|
2616
2714
|
}
|
|
2617
|
-
NodeSetVariable.title =
|
|
2618
|
-
GraphEditor.registerCustomNode(
|
|
2715
|
+
NodeSetVariable.title = 'Set Variable';
|
|
2716
|
+
GraphEditor.registerCustomNode('variables/SetVariable', NodeSetVariable);
|
|
2619
2717
|
class NodeGetVariable extends GraphNode {
|
|
2620
2718
|
onCreate() {
|
|
2621
|
-
this.addOutput(null,
|
|
2622
|
-
this.addProperty(
|
|
2719
|
+
this.addOutput(null, 'any');
|
|
2720
|
+
this.addProperty('Name', 'string', '');
|
|
2623
2721
|
}
|
|
2624
2722
|
onExecute() {
|
|
2625
2723
|
var varName = this.getInput(0);
|
|
2626
|
-
if (varName == undefined)
|
|
2724
|
+
if (varName == undefined) {
|
|
2627
2725
|
return;
|
|
2726
|
+
}
|
|
2628
2727
|
var data = this.editor?.getVariable(varName);
|
|
2629
|
-
if (data != undefined)
|
|
2728
|
+
if (data != undefined) {
|
|
2630
2729
|
this.setOutput(0, data);
|
|
2730
|
+
}
|
|
2631
2731
|
}
|
|
2632
2732
|
}
|
|
2633
|
-
NodeGetVariable.title =
|
|
2634
|
-
GraphEditor.registerCustomNode(
|
|
2733
|
+
NodeGetVariable.title = 'Get Variable';
|
|
2734
|
+
GraphEditor.registerCustomNode('variables/GetVariable', NodeGetVariable);
|
|
2635
2735
|
/*
|
|
2636
2736
|
System nodes
|
|
2637
2737
|
*/
|
|
2638
2738
|
class NodeConsoleLog extends GraphNode {
|
|
2639
2739
|
onCreate() {
|
|
2640
|
-
this.addInput(null,
|
|
2740
|
+
this.addInput(null, 'any');
|
|
2641
2741
|
}
|
|
2642
2742
|
onExecute() {
|
|
2643
2743
|
var data = this.getInput(0);
|
|
2644
|
-
if (data == undefined)
|
|
2744
|
+
if (data == undefined) {
|
|
2645
2745
|
return;
|
|
2746
|
+
}
|
|
2646
2747
|
console.log(data);
|
|
2647
2748
|
}
|
|
2648
2749
|
}
|
|
2649
|
-
NodeConsoleLog.title =
|
|
2650
|
-
GraphEditor.registerCustomNode(
|
|
2750
|
+
NodeConsoleLog.title = 'Console Log';
|
|
2751
|
+
GraphEditor.registerCustomNode('system/ConsoleLog', NodeConsoleLog);
|
|
2651
2752
|
class NodeMain extends GraphNode {
|
|
2652
2753
|
onCreate() {
|
|
2653
|
-
this.addInput(
|
|
2654
|
-
this.addInput(
|
|
2655
|
-
this.addInput(
|
|
2754
|
+
this.addInput('a', 'float');
|
|
2755
|
+
this.addInput('b', 'bool');
|
|
2756
|
+
this.addInput('Color', 'vec4');
|
|
2656
2757
|
}
|
|
2657
2758
|
onExecute() {
|
|
2658
2759
|
var data = this.getInput(2);
|
|
2659
|
-
if (data == undefined)
|
|
2760
|
+
if (data == undefined) {
|
|
2660
2761
|
return;
|
|
2762
|
+
}
|
|
2661
2763
|
console.log(data);
|
|
2662
2764
|
}
|
|
2663
|
-
;
|
|
2664
2765
|
}
|
|
2665
2766
|
NodeMain.blockDelete = true;
|
|
2666
|
-
GraphEditor.registerCustomNode(
|
|
2767
|
+
GraphEditor.registerCustomNode('system/Main', NodeMain);
|
|
2667
2768
|
|
|
2668
2769
|
export { BoundingBox, GraphEditor, GraphNode };
|
|
2669
2770
|
//# sourceMappingURL=GraphEditor.js.map
|