sunrize 2.4.1 → 2.5.0

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.
Files changed (48) hide show
  1. package/package.json +7 -7
  2. package/src/Application/Application.js +21 -2
  3. package/src/Application/Dashboard.js +21 -19
  4. package/src/Application/DataStorage.js +10 -37
  5. package/src/Application/Document.js +149 -22
  6. package/src/Application/Footer.js +62 -16
  7. package/src/Application/Hierarchy.js +1 -1
  8. package/src/Application/Interface.js +1 -1
  9. package/src/Application/Sidebar.js +12 -9
  10. package/src/Application/Tabs.js +79 -11
  11. package/src/Controls/Splitter.js +146 -19
  12. package/src/Controls/Tabs.js +17 -12
  13. package/src/Editors/AnimationEditor.js +69 -59
  14. package/src/Editors/AnimationMemberList.js +37 -6
  15. package/src/Editors/BrowserFrame.js +17 -10
  16. package/src/Editors/Console.js +9 -13
  17. package/src/Editors/MediaRecorder.js +27 -0
  18. package/src/Editors/NodeList.js +35 -0
  19. package/src/Editors/OutlineEditor.js +20 -20
  20. package/src/Editors/OutlineView.js +85 -61
  21. package/src/Editors/Panel.js +6 -3
  22. package/src/Editors/RouteGraph.js +22 -65
  23. package/src/Editors/SceneProperties.js +4 -4
  24. package/src/Editors/ScriptEditor.js +37 -23
  25. package/src/Tools/Core/X3DBaseTool.js +11 -10
  26. package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
  27. package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
  28. package/src/Tools.js +0 -3
  29. package/src/Undo/Editor.js +19 -16
  30. package/src/Undo/UndoManager.js +1 -1
  31. package/src/assets/fonts/Roboto/OFL.txt +93 -0
  32. package/src/assets/fonts/Roboto/README.txt +118 -0
  33. package/src/assets/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
  34. package/src/assets/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
  35. package/src/assets/fonts/Roboto_Mono/OFL.txt +93 -0
  36. package/src/assets/fonts/Roboto_Mono/README.txt +77 -0
  37. package/src/assets/fonts/Roboto_Mono/RobotoMono-Italic-VariableFont_wght.ttf +0 -0
  38. package/src/assets/fonts/Roboto_Mono/RobotoMono-VariableFont_wght.ttf +0 -0
  39. package/src/assets/html/application.html +34 -9
  40. package/src/assets/html/window.html +6 -7
  41. package/src/assets/themes/default.css +132 -155
  42. package/src/assets/themes/{system-colors.css → definitions.css} +50 -7
  43. package/src/assets/themes/media-template.css +3 -2
  44. package/src/assets/themes/media.css +3 -2
  45. package/src/assets/themes/prompt-template.css +4 -1
  46. package/src/assets/themes/prompt.css +4 -1
  47. package/src/assets/html/application-template.html +0 -164
  48. package/src/assets/html/window-template.html +0 -39
@@ -58,12 +58,14 @@ module .exports = class RouteGraph extends Interface
58
58
  .on ("sortupdate", (event, ui) => this .reorderPages (ui .item))
59
59
  .appendTo (this .top);
60
60
 
61
+ // Toolbar
62
+
61
63
  this .toolbar = $("<div></div>")
62
64
  .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "routing-toolbar"])
63
65
  .appendTo (this .editor);
64
66
 
65
67
  this .addPageButton = $("<span></span>")
66
- .addClass ("material-icons")
68
+ .addClass ("material-symbols-outlined")
67
69
  .attr ("title", _("Add new logic page."))
68
70
  .text ("add")
69
71
  .appendTo (this .toolbar)
@@ -74,7 +76,7 @@ module .exports = class RouteGraph extends Interface
74
76
  this .snapToGridButton = $("<span></span>")
75
77
  .addClass ("material-symbols-outlined")
76
78
  .attr ("title", _("Toggle snap to grid."))
77
- .css ({ transform: "scale(0.9)" })
79
+ .css ("scale", "0.9")
78
80
  .text ("grid_4x4")
79
81
  .appendTo (this .toolbar)
80
82
  .on ("click", () => this .setSnapToGrid (!this .config .global .snapToGrid));
@@ -84,7 +86,7 @@ module .exports = class RouteGraph extends Interface
84
86
  this .addConnectedNodesButton = $("<span></span>")
85
87
  .addClass ("material-symbols-outlined")
86
88
  .attr ("title", _("Toggle add connected nodes."))
87
- .css ({ transform: "scale(0.8)" })
89
+ .css ("scale", "0.8")
88
90
  .text ("hub")
89
91
  .appendTo (this .toolbar)
90
92
  .on ("click", () => this .setAddConnectedNodes (!this .config .global .addConnectedNodes));
@@ -92,38 +94,29 @@ module .exports = class RouteGraph extends Interface
92
94
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
93
95
 
94
96
  this .zoomOutIcon = $("<span></span>")
95
- .addClass ("material-icons")
96
- .attr ("title", _("Zoom nodes out. (-)"))
97
- .css ("transform", "scale(1.5)")
98
- .css ("margin-top", "13px")
99
- .css ("margin-bottom", "15px")
97
+ .addClass ("material-symbols-outlined")
98
+ .attr ("title", _("Zoom timeline out. (-)"))
100
99
  .text ("zoom_out")
101
100
  .appendTo (this .toolbar)
102
101
  .on ("click", () => this .zoomOut ());
103
102
 
104
103
  this .zoomInIcon = $("<span></span>")
105
- .addClass ("material-icons")
106
- .attr ("title", _("Zoom nodes in. (+)"))
107
- .css ("transform", "scale(1.5)")
108
- .css ("margin-bottom", "15px")
104
+ .addClass ("material-symbols-outlined")
105
+ .attr ("title", _("Zoom timeline in. (+)"))
109
106
  .text ("zoom_in")
110
107
  .appendTo (this .toolbar)
111
108
  .on ("click", () => this .zoomIn ());
112
109
 
113
110
  this .zoomFitIcon = $("<span></span>")
114
- .addClass ("material-icons")
115
- .attr ("title", _("Zoom nodes to fit in window. (0)"))
116
- .css ("transform", "scale(1.4)")
117
- .css ("margin-bottom", "15px")
111
+ .addClass ("material-symbols-outlined")
112
+ .attr ("title", _("Zoom timeline to fit in window. (0)"))
118
113
  .text ("fit_screen")
119
114
  .appendTo (this .toolbar)
120
115
  .on ("click", () => this .zoomFit ());
121
116
 
122
117
  this .zoom100Icon = $("<span></span>")
123
- .addClass ("material-icons")
124
- .attr ("title", _("Default nodes zoom. (1)"))
125
- .css ("transform", "scale(1.4)")
126
- .css ("margin-bottom", "15px")
118
+ .addClass ("material-symbols-outlined")
119
+ .attr ("title", _("Default timeline zoom. (1)"))
127
120
  .text ("1x_mobiledata")
128
121
  .appendTo (this .toolbar)
129
122
  .on ("click", () => this .zoom100 ());
@@ -332,7 +325,7 @@ module .exports = class RouteGraph extends Interface
332
325
  .attr ("title", title)
333
326
  .text (title))
334
327
  .append ($("<span></span>")
335
- .addClass (["material-icons", "button"])
328
+ .addClass (["material-symbols-outlined", "button"])
336
329
  .text ("close")
337
330
  .on ("click", () => this .closePage (index)))
338
331
  .appendTo (this .tabs);
@@ -496,7 +489,7 @@ module .exports = class RouteGraph extends Interface
496
489
  {
497
490
  path .push (i);
498
491
 
499
- this .getPathsFromNode (importedNode .getExportedNode (), false, ids, path, paths, seen);
492
+ this .getPathsFromNode (importedNode .getInstance (), false, ids, path, paths, seen);
500
493
 
501
494
  path .pop ();
502
495
  }
@@ -645,7 +638,7 @@ module .exports = class RouteGraph extends Interface
645
638
  {
646
639
  path .push (i);
647
640
 
648
- this .getIdsFromNode (importedNode .getExportedNode (), false, paths, path, ids, seen);
641
+ this .getIdsFromNode (importedNode .getInstance (), false, paths, path, ids, seen);
649
642
 
650
643
  path .pop ();
651
644
  }
@@ -1155,7 +1148,7 @@ module .exports = class RouteGraph extends Interface
1155
1148
  node .getPredefinedFields () .addInterest ("updateNodeElement", this, id);
1156
1149
  node .getUserDefinedFields () .addInterest ("updateNodeElement", this, id);
1157
1150
 
1158
- if (node instanceof X3D .X3DImportedNodeProxy)
1151
+ if (node instanceof X3D .X3DImportedNodeInstance)
1159
1152
  {
1160
1153
  // These events are connected and must never be removed.
1161
1154
  node .getImportedNode () .getInlineNode () .getLoadState () .addInterest ("updateNodeElement", this, id);
@@ -1181,7 +1174,7 @@ module .exports = class RouteGraph extends Interface
1181
1174
  if (selected)
1182
1175
  element .addClass ("selected");
1183
1176
 
1184
- if (node instanceof X3D .X3DImportedNodeProxy)
1177
+ if (node instanceof X3D .X3DImportedNodeInstance)
1185
1178
  element .addClass ("imported-node");
1186
1179
 
1187
1180
  const header = $("<div></div>")
@@ -1192,7 +1185,7 @@ module .exports = class RouteGraph extends Interface
1192
1185
  .addClass ("icon")
1193
1186
  .appendTo (header);
1194
1187
 
1195
- if (node instanceof X3D .X3DImportedNodeProxy)
1188
+ if (node instanceof X3D .X3DImportedNodeInstance)
1196
1189
  icon .attr ("src", "../images/OutlineEditor/Node/ImportedNode.svg");
1197
1190
  else
1198
1191
  icon .attr ("src", "../images/OutlineEditor/Node/X3DBaseNode.svg");
@@ -1448,35 +1441,7 @@ module .exports = class RouteGraph extends Interface
1448
1441
 
1449
1442
  findNode (id, add)
1450
1443
  {
1451
- const
1452
- node = this .getNode (id),
1453
- outlineEditor = this .outlineEditor;
1454
-
1455
- outlineEditor .expandTo (node, { expandObject: true, expandInlineNodes: true, expandAll: true });
1456
-
1457
- const elements = Array .from (outlineEditor .sceneGraph .find (`.node[node-id=${id}], .imported-node[node-id=${id}]`));
1458
-
1459
- if (!elements .length)
1460
- return;
1461
-
1462
- for (const [i, element] of elements .entries ())
1463
- {
1464
- if ($(element) .is (".node"))
1465
- outlineEditor .selectNodeElement ($(element), { add: add || i > 0, target: true });
1466
-
1467
- else if ($(element) .is (".imported-node"))
1468
- outlineEditor .selectPrimaryElement ($(element), { add: add || i > 0, target: true });
1469
- }
1470
-
1471
- // Scroll element into view.
1472
- // Hide scrollbars during scroll to prevent overlay issue.
1473
-
1474
- outlineEditor .treeView .css ("overflow", "hidden");
1475
-
1476
- elements [0] ?.scrollIntoView ({ block: "center", inline: "start", behavior: "smooth" });
1477
- $(window) .scrollTop (0);
1478
-
1479
- setTimeout (() => outlineEditor .treeView .css ("overflow", ""), 1000);
1444
+ this .outlineEditor .findNode (this .getNode (id), add);
1480
1445
  }
1481
1446
 
1482
1447
  selectNode (event, id)
@@ -1580,7 +1545,7 @@ module .exports = class RouteGraph extends Interface
1580
1545
  node = this .getNode (id),
1581
1546
  executionContext = node .getExecutionContext ();
1582
1547
 
1583
- if (executionContext .importedNodes .find (importedNode => importedNode .getExportedNode () === node))
1548
+ if (executionContext .importedNodes .find (importedNode => importedNode .getInstance () === node))
1584
1549
  continue;
1585
1550
 
1586
1551
  this .removeNode (id);
@@ -2243,15 +2208,7 @@ module .exports = class RouteGraph extends Interface
2243
2208
  {
2244
2209
  context .fillStyle = selectedColor;
2245
2210
 
2246
- const sourceNodeName = route .getSourceNode () instanceof X3D .X3DNode
2247
- ? route .getSourceNode () .getName ()
2248
- : route .getSourceNode () .getImportedName ();
2249
-
2250
- const destinationNodeName = route .getDestinationNode () instanceof X3D .X3DNode
2251
- ? route .getDestinationNode () .getName ()
2252
- : route .getDestinationNode () .getImportedName ();
2253
-
2254
- this .nodes .attr ("title", util .format (_("Route from %s<%s>.%s to %s<%s>.%s"), route .getSourceNode () .getTypeName (), sourceNodeName || _("unnamed"), route .sourceField, route .getDestinationNode () .getTypeName (), destinationNodeName || _("unnamed"), route .destinationField));
2211
+ this .nodes .attr ("title", util .format (_("Route from %s<%s>.%s to %s<%s>.%s"), route .getSourceNode () .getTypeName (), route .getSourceNode () .getName () || _("unnamed"), route .sourceField, route .getDestinationNode () .getTypeName (), route .getDestinationNode () .getName () || _("unnamed"), route .destinationField));
2255
2212
  }
2256
2213
 
2257
2214
  context .beginPath ();
@@ -228,7 +228,7 @@ module .exports = new class SceneProperties extends Dialog
228
228
  .append ($("<span></span>") .text (_("Key")))
229
229
  .append ($("<span></span>")
230
230
  .attr ("title", "Sort column alphabetically.")
231
- .addClass (["material-icons", "sort-key"])
231
+ .addClass (["material-symbols-outlined", "sort-key"])
232
232
  .addClass (this .config .file .sortMetaData ? ["active"] : [ ])
233
233
  .css ("font-size", "inherit")
234
234
  .text ("sort_by_alpha"))
@@ -487,7 +487,7 @@ module .exports = new class SceneProperties extends Dialog
487
487
  .append ($("<span></span>")
488
488
  .attr ("title", _("Drag to move key/value pair."))
489
489
  .css ("font-size", "120%")
490
- .addClass (["material-icons", "button", "drag"])
490
+ .addClass (["material-symbols-outlined", "button", "drag"])
491
491
  .addClass (this .config .file .sortMetaData ? ["disabled"] : [ ])
492
492
  .text ("drag_handle")))
493
493
  .append ($("<td></td>")
@@ -508,7 +508,7 @@ module .exports = new class SceneProperties extends Dialog
508
508
  .append ($("<span></span>")
509
509
  .attr ("title", _("Delete key/value pair."))
510
510
  .css ("font-size", "120%")
511
- .addClass (["material-icons", "button"])
511
+ .addClass (["material-symbols-outlined", "button"])
512
512
  .text ("delete_forever")
513
513
  .on ("click", (event) => this .removeMetaData (event, key))));
514
514
 
@@ -526,7 +526,7 @@ module .exports = new class SceneProperties extends Dialog
526
526
  .addClass ("open-link")
527
527
  .attr ("title", _("Open link in web browser."))
528
528
  .css ("font-size", "120%")
529
- .addClass (["material-icons", "button"])
529
+ .addClass (["material-symbols-outlined", "button"])
530
530
  .text ("open_in_new")
531
531
  .appendTo (column)
532
532
  .on ("click", () => electron .shell .openExternal (match [1]));
@@ -24,10 +24,14 @@ monacoLoader .require .config ({
24
24
 
25
25
  module .exports = class ScriptEditor extends Interface
26
26
  {
27
+ maximizeSeparator = false;
28
+
27
29
  constructor (element)
28
30
  {
29
31
  super (`Sunrize.ScriptEditor.${element .attr ("id")}.`);
30
32
 
33
+ const darwin = process .platform === "darwin";
34
+
31
35
  this .scriptEditor = element;
32
36
 
33
37
  this .verticalSplitter = $("<div></div>")
@@ -36,6 +40,7 @@ module .exports = class ScriptEditor extends Interface
36
40
  .appendTo (this .scriptEditor);
37
41
 
38
42
  this .verticalSplitterLeft = $("<div></div>")
43
+ .attr ("id", "script-editor-horizontal")
39
44
  .addClass ("vertical-splitter-left")
40
45
  .css ("width", "30%")
41
46
  .appendTo (this .verticalSplitter);
@@ -47,14 +52,18 @@ module .exports = class ScriptEditor extends Interface
47
52
 
48
53
  this .vSplitter = new Splitter (this .verticalSplitter, "vertical");
49
54
 
50
- this .verticalSplitter .on ("position", () => this .onSplitterPosition ());
55
+ this .vSplitter .snapToBorder = true;
56
+
57
+ this .vSplitter .handle .on ("position", () => this .splitterPosition ());
58
+
59
+ // Toolbar
51
60
 
52
61
  this .toolbar = $("<div></div>")
53
62
  .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "script-editor-toolbar"])
54
63
  .appendTo (this .scriptEditor);
55
64
 
56
65
  this .toggleSidebarButton = $("<span></span>")
57
- .addClass (["material-symbols-outlined"])
66
+ .addClass ("material-symbols-outlined")
58
67
  .attr ("title", _("Toggle sidebar."))
59
68
  .text ("dock_to_right")
60
69
  .appendTo (this .toolbar)
@@ -63,15 +72,18 @@ module .exports = class ScriptEditor extends Interface
63
72
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
64
73
 
65
74
  this .createButton = $("<span></span>")
66
- .addClass ("material-icons")
67
- .attr ("title", _("Create new Script node or shader."))
75
+ .addClass ("material-symbols-outlined")
76
+ .attr ("title", _("Create new Script or ComposedShader node."))
68
77
  .text ("add")
69
78
  .appendTo (this .toolbar)
70
79
  .on ("click", () => this .create ());
71
80
 
72
81
  this .applyButton = $("<span></span>")
73
- .addClass ("material-icons")
74
- .attr ("title", _("Apply script source to node."))
82
+ .addClass ("material-symbols-outlined")
83
+ .css ("scale", "0.8")
84
+ .attr ("title", darwin
85
+ ? _("Save source code in url field. (⌘S)")
86
+ : _("Save source code in url field. (Ctrl+S)"))
75
87
  .text ("check_circle")
76
88
  .appendTo (this .toolbar)
77
89
  .on ("click", () => this .apply (true));
@@ -79,23 +91,26 @@ module .exports = class ScriptEditor extends Interface
79
91
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
80
92
 
81
93
  this .directOutputButton = $("<span></span>")
82
- .addClass ("material-icons")
94
+ .addClass ("material-symbols-outlined")
95
+ .css ("scale", "0.8")
83
96
  .attr ("title", _("Toggle direct output."))
84
97
  .text ("radio_button_checked")
85
98
  .appendTo (this .toolbar)
86
99
  .on ("click", () => this .toggleDirectOutput ());
87
100
 
88
101
  this .mustEvaluateButton = $("<span></span>")
89
- .addClass ("material-icons")
102
+ .addClass ("material-symbols-outlined")
103
+ .css ("scale", "0.8")
90
104
  .attr ("title", _("Toggle must evaluate."))
91
105
  .text ("priority_high")
92
106
  .appendTo (this .toolbar)
93
107
  .on ("click", () => this .toggleMustEvaluate ());
94
108
 
95
109
  this .shaderTypeButton = $("<span></span>")
96
- .addClass ("material-icons")
110
+ .addClass ("material-symbols-outlined")
111
+ .css ("scale", "0.9")
97
112
  .attr ("title", _("Change shader type."))
98
- .text ("auto_awesome")
113
+ .text ("change_history")
99
114
  .appendTo (this .toolbar)
100
115
  .on ("click", () => this .changeShaderType ());
101
116
 
@@ -843,7 +858,7 @@ module .exports = class ScriptEditor extends Interface
843
858
  args: ["createScript"],
844
859
  },
845
860
  {
846
- label: _("Create New Shader"),
861
+ label: _("Create New ComposedShader"),
847
862
  args: ["createShader"],
848
863
  },
849
864
  ];
@@ -1035,10 +1050,14 @@ main ()
1035
1050
  const menu = [
1036
1051
  {
1037
1052
  label: "VERTEX",
1053
+ type: "radio",
1054
+ checked: !this .node ._type .equals ("FRAGMENT"),
1038
1055
  args: ["changeShaderTypeTo", "VERTEX"],
1039
1056
  },
1040
1057
  {
1041
1058
  label: "FRAGMENT",
1059
+ type: "radio",
1060
+ checked: this .node ._type .equals ("FRAGMENT"),
1042
1061
  args: ["changeShaderTypeTo", "FRAGMENT"],
1043
1062
  },
1044
1063
  ];
@@ -1057,35 +1076,30 @@ main ()
1057
1076
  {
1058
1077
  case "VERTEX":
1059
1078
  {
1060
- this .shaderTypeButton .text ("timeline");
1079
+ this .shaderTypeButton .text ("change_history");
1061
1080
  break;
1062
1081
  }
1063
1082
  case "FRAGMENT":
1064
1083
  {
1065
- this .shaderTypeButton .text ("auto_awesome");
1084
+ this .shaderTypeButton .text ("grain");
1066
1085
  break;
1067
1086
  }
1068
1087
  }
1069
1088
  }
1070
1089
 
1071
- onSplitterPosition ()
1090
+ splitterPosition ()
1072
1091
  {
1073
1092
  if (this .vSplitter .position)
1074
- this .toggleSidebarButton .addClass ("active");
1093
+ this .toggleSidebarButton .addClass (["active", "fill"]);
1075
1094
  else
1076
- this .toggleSidebarButton .removeClass ("active");
1095
+ this .toggleSidebarButton .removeClass (["active", "fill"]);
1077
1096
  }
1078
1097
 
1079
1098
  toggleSidebar ()
1080
1099
  {
1081
1100
  if (this .vSplitter .position)
1082
- {
1083
- this .config .file .vSplitterPosition = this .vSplitter .position;
1084
- this .vSplitter .position = 0;
1085
- }
1101
+ this .vSplitter .toggle ("minimize");
1086
1102
  else
1087
- {
1088
- this .vSplitter .position = this .config .file .vSplitterPosition;
1089
- }
1103
+ this .vSplitter .toggle ("restore");
1090
1104
  }
1091
1105
  };
@@ -4,8 +4,8 @@ const handler =
4
4
  {
5
5
  get (target, key)
6
6
  {
7
- if (key in target)
8
- return target [key];
7
+ if (Reflect .has (target, key))
8
+ return Reflect .get (target, key);
9
9
 
10
10
  const property = target .node [key];
11
11
 
@@ -16,24 +16,25 @@ const handler =
16
16
  },
17
17
  set (target, key, value)
18
18
  {
19
- if (key in target)
20
- target [key] = value;
21
- else
22
- target .node [key] = value;
19
+ if (Reflect .has (target, key))
20
+ return Reflect .set (target, key, value);
23
21
 
24
- return true;
22
+ return Reflect .set (target .node, key, value);
25
23
  },
26
24
  has (target, key)
27
25
  {
28
- return key in target .node;
26
+ return Reflect .has (target, key)
27
+ || Reflect .has (target .node, key);
29
28
  },
30
29
  ownKeys (target)
31
30
  {
32
- return Object .keys (target .node);
31
+ return Array .from (new Set (Reflect .ownKeys (target)
32
+ .concat (Reflect .ownKeys (target .node))));
33
33
  },
34
34
  getOwnPropertyDescriptor (target, key)
35
35
  {
36
- return Object .getOwnPropertyDescriptor (target .node, key);
36
+ return Reflect .getOwnPropertyDescriptor (target, key)
37
+ ?? Reflect .getOwnPropertyDescriptor (target .node, key);
37
38
  },
38
39
  getPrototypeOf (target)
39
40
  {
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ const X3DNodeTool = require ("./X3DNodeTool");
4
+
5
+ class X3DImportedNodeInstanceTool extends X3DNodeTool
6
+ {
7
+ #tool;
8
+
9
+ constructor (node)
10
+ {
11
+ super (node);
12
+
13
+ node .typeName_changed .addInterest ("updateTool", this);
14
+
15
+ this .updateTool ();
16
+ }
17
+
18
+ updateTool ()
19
+ {
20
+ try
21
+ {
22
+ this .#tool = this .node .getInnerNode () .addTool ();
23
+
24
+ this .#tool .toolPointing = false;
25
+ }
26
+ catch
27
+ {
28
+ this .#tool = null;
29
+ }
30
+ }
31
+
32
+ disposeTool ()
33
+ {
34
+ try
35
+ {
36
+ this .node .typeName_changed .removeInterest ("updateTool", this);
37
+
38
+ this .node .getInnerNode () .removeTool ();
39
+ }
40
+ catch
41
+ { }
42
+
43
+ super .disposeTool ();
44
+ }
45
+
46
+ getInnerNode ()
47
+ {
48
+ return this .#tool;
49
+ }
50
+ }
51
+
52
+ module .exports = X3DImportedNodeInstanceTool;
@@ -10,13 +10,13 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
10
10
  {
11
11
  super (node);
12
12
 
13
- node .getProtoNode () ._updateInstances .addInterest ("set_toolRootNodes", this);
14
- node .getBody () .rootNodes .addInterest ("set_toolRootNodes", this);
13
+ node .getProtoNode () ._updateInstances .addInterest ("updateTool", this);
14
+ node .getBody () .rootNodes .addInterest ("updateTool", this);
15
15
 
16
- this .set_toolRootNodes ();
16
+ this .updateTool ();
17
17
  }
18
18
 
19
- set_toolRootNodes ()
19
+ updateTool ()
20
20
  {
21
21
  try
22
22
  {
@@ -34,8 +34,8 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
34
34
  {
35
35
  try
36
36
  {
37
- this .node .getProtoNode () ._updateInstances .removeInterest ("set_toolRootNodes", this);
38
- this .node .getBody () .rootNodes .removeInterest ("set_toolRootNodes", this);
37
+ this .node .getProtoNode () ._updateInstances .removeInterest ("updateTool", this);
38
+ this .node .getBody () .rootNodes .removeInterest ("updateTool", this);
39
39
 
40
40
  this .node .getInnerNode () .removeTool ();
41
41
  }
package/src/Tools.js CHANGED
@@ -19,9 +19,6 @@ Object .assign (X3D .X3DNode .prototype,
19
19
  if (this .getExecutionContext () .getOuterNode () instanceof X3D .X3DProtoDeclaration)
20
20
  return this;
21
21
 
22
- if (this instanceof X3D .X3DImportedNodeProxy)
23
- return this;
24
-
25
22
  const module = path .resolve (__dirname, "Tools", this .constructor .componentInfo .name, this .constructor .typeName + "Tool.js");
26
23
 
27
24
  if (!fs .existsSync (module))
@@ -178,7 +178,8 @@ module .exports = class Editor
178
178
 
179
179
  // Filter out routes.
180
180
 
181
- const routes = [... childRoutes] .filter (route => children .has (route .getSourceNode () .valueOf ()) && children .has (route .getDestinationNode () .valueOf ()));
181
+ const routes = [... childRoutes] .filter (route => children .has (route .getSourceNode () .valueOf ())
182
+ && children .has (route .getDestinationNode () .valueOf ()));
182
183
 
183
184
  // Store world url.
184
185
 
@@ -207,7 +208,7 @@ module .exports = class Editor
207
208
  // Add routes.
208
209
 
209
210
  for (const route of routes)
210
- scene .routes .add (route .getRouteId (), route);
211
+ scene .routes .add (route .getId (), route);
211
212
 
212
213
  // Return XML string.
213
214
 
@@ -1016,14 +1017,14 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1016
1017
  inlineNode = importedNode .getInlineNode (),
1017
1018
  exportedName = importedNode .getExportedName (),
1018
1019
  description = importedNode .getDescription (),
1019
- exportedNode = importedNode .getExportedNode ();
1020
+ instance = importedNode .getInstance ();
1020
1021
 
1021
1022
  const routes = executionContext .getRoutes () .filter (route =>
1022
1023
  {
1023
- if (route .getSourceNode () === exportedNode)
1024
+ if (route .getSourceNode () === instance)
1024
1025
  return true;
1025
1026
 
1026
- if (route .getDestinationNode () === exportedNode)
1027
+ if (route .getDestinationNode () === instance)
1027
1028
  return true;
1028
1029
 
1029
1030
  return false;
@@ -1039,7 +1040,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1039
1040
 
1040
1041
  for (const index of Array .from (field .keys ()) .reverse ())
1041
1042
  {
1042
- if (field [index] .getValue () === exportedNode)
1043
+ if (field [index] .getValue () === instance)
1043
1044
  this .removeValueFromArray (executionContext, node, field, index, undoManager);
1044
1045
  }
1045
1046
  }
@@ -1057,7 +1058,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1057
1058
  {
1058
1059
  case X3D .X3DConstants .SFNode:
1059
1060
  {
1060
- if (field .getValue () === exportedNode)
1061
+ if (field .getValue () === instance)
1061
1062
  this .setFieldValue (executionContext, node, field, null, undoManager);
1062
1063
 
1063
1064
  break;
@@ -1066,7 +1067,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1066
1067
  {
1067
1068
  for (const index of Array .from (field .keys ()) .reverse ())
1068
1069
  {
1069
- if (field [index] .getValue () === exportedNode)
1070
+ if (field [index] .getValue () === instance)
1070
1071
  this .removeValueFromArray (executionContext, node, field, index, undoManager);
1071
1072
  }
1072
1073
 
@@ -1082,17 +1083,19 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1082
1083
  {
1083
1084
  this .updateImportedNode (executionContext, inlineNode, exportedName, importedName, "", description, undoManager);
1084
1085
 
1085
- const newImportedNode = executionContext .getImportedNodes () .get (importedName);
1086
+ const newInstance = executionContext .getImportedNode (importedName) .getValue ();
1086
1087
 
1087
- for (let { sourceNode, sourceField, destinationNode, destinationField } of routes)
1088
+ for (const route of routes)
1088
1089
  {
1089
- if (sourceNode === exportedNode)
1090
- sourceNode = newImportedNode;
1090
+ const sourceNode = route .getSourceNode () === instance
1091
+ ? newInstance
1092
+ : route .getSourceNode ();
1091
1093
 
1092
- if (destinationNode === exportedNode)
1093
- destinationNode = newImportedNode;
1094
+ const destinationNode = route .getDestinationNode () === instance
1095
+ ? newInstance
1096
+ : route .getDestinationNode ();
1094
1097
 
1095
- this .addRoute (executionContext, sourceNode, sourceField, destinationNode, destinationField, undoManager);
1098
+ executionContext .addRoute (sourceNode, route .sourceField, destinationNode, route .destinationField);
1096
1099
  }
1097
1100
  });
1098
1101
 
@@ -3732,7 +3735,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
3732
3735
 
3733
3736
  for (const node of children)
3734
3737
  {
3735
- if (executionContext .getLocalizedNode (node) instanceof X3D .X3DImportedNode)
3738
+ if (executionContext .getNodeOrImportedNode (node) instanceof X3D .X3DImportedNodeInstance)
3736
3739
  continue;
3737
3740
 
3738
3741
  // Rebind X3DBindableNode nodes.
@@ -6,7 +6,7 @@ const
6
6
 
7
7
  module .exports = class UndoManager
8
8
  {
9
- static shared = new UndoManager (true);
9
+ static shared = new UndoManager ();
10
10
 
11
11
  undoStack = [ ];
12
12
  undoFunctions = [ ];