sunrize 2.0.11 → 2.0.12

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "2.0.11",
4
+ "version": "2.0.12",
5
5
  "description": "Sunrize — A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -93,7 +93,7 @@
93
93
  "@vscode/codicons": "^0.0.45",
94
94
  "capitalize": "^2.0.4",
95
95
  "console": "^0.7.2",
96
- "electron": "^41.1.0",
96
+ "electron": "^41.1.1",
97
97
  "electron-prompt": "^1.7.0",
98
98
  "electron-squirrel-startup": "^1.0.1",
99
99
  "electron-tabs": "^1.0.4",
@@ -102,7 +102,7 @@
102
102
  "jquery-ui-dist": "^1.13.3",
103
103
  "jstree": "^3.3.17",
104
104
  "material-icons": "^1.13.14",
105
- "material-symbols": "^0.42.3",
105
+ "material-symbols": "^0.44.0",
106
106
  "md5": "^2.3.0",
107
107
  "mime-types": "^3.0.2",
108
108
  "monaco-editor": "^0.55.1",
@@ -112,7 +112,7 @@
112
112
  "string-similarity": "^4.0.4",
113
113
  "tweakpane": "^4.0.5",
114
114
  "update-electron-app": "^3.1.2",
115
- "x_ite": "^14.1.2",
115
+ "x_ite": "^14.1.3",
116
116
  "x3d-traverse": "^1.0.22"
117
117
  }
118
118
  }
@@ -483,8 +483,6 @@ module .exports = class AnimationMembersList extends Interface
483
483
  if (!this .#editor .fields .has (field))
484
484
  continue;
485
485
 
486
- const fieldItem = this .#list .find (`.field[field-id=${field .getId ()}] > .item`);
487
-
488
486
  keyframes .push ({ node, field });
489
487
  }
490
488
  }
@@ -60,9 +60,7 @@ module .exports = class MaterialsLibrary extends LibraryPane
60
60
 
61
61
  // Materials
62
62
 
63
- const
64
- materials = scene .getExportedNode ("Materials"),
65
- nodes = [ ];
63
+ const materials = scene .getExportedNode ("Materials");
66
64
 
67
65
  for (const [g, group] of materials .children .entries ())
68
66
  {
@@ -75,7 +73,7 @@ module .exports = class MaterialsLibrary extends LibraryPane
75
73
  {
76
74
  const material = node .children [0] .appearance .material;
77
75
 
78
- nodes .push ($("<li></li>")
76
+ $("<li></li>")
79
77
  .addClass (["node", "icon"])
80
78
  .attr ("title", material .getNodeDisplayName ())
81
79
  .attr ("group", g)
@@ -84,7 +82,7 @@ module .exports = class MaterialsLibrary extends LibraryPane
84
82
  .addClass ("text")
85
83
  .text (`${group .getNodeName ()} ${c + 1}`))
86
84
  .appendTo (this .#list)
87
- .on ("dblclick", () => this .importMaterial (material .getNodeName ())));
85
+ .on ("dblclick", () => this .importMaterial (material .getNodeName ()));
88
86
  }
89
87
  }
90
88
 
@@ -9,7 +9,6 @@ const
9
9
  mime = require ("../Bits/MimeTypes"),
10
10
  X3D = require ("../X3D"),
11
11
  OutlineRouteGraph = require ("./OutlineRouteGraph"),
12
- Traverse = require ("x3d-traverse") (X3D),
13
12
  Editor = require ("../Undo/Editor"),
14
13
  UndoManager = require ("../Undo/UndoManager"),
15
14
  _ = require ("../Application/GetText");
@@ -1036,8 +1035,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1036
1035
 
1037
1036
  for (const node of nodes)
1038
1037
  {
1038
+ if (!node)
1039
+ continue;
1040
+
1039
1041
  const
1040
- containerField = $.try (() => node .getInnerNode () .getContainerField ()) ?? node ?.getContainerField (),
1042
+ containerField = $.try (() => node .getInnerNode () .getContainerField ()) ?? node .getContainerField (),
1041
1043
  field = targetField ?? $.try (() => targetNode ?.getField (containerField));
1042
1044
 
1043
1045
  if (!field)
@@ -1045,7 +1047,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1045
1047
 
1046
1048
  // Adjust matrix.
1047
1049
 
1048
- if (node ?.getType () .some (type => this .transformLikeNodes .has (type)))
1050
+ if (node .getType () .some (type => this .transformLikeNodes .has (type)))
1049
1051
  {
1050
1052
  const
1051
1053
  sourceModelMatrix = node .getMatrix (),
@@ -1113,7 +1115,6 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1113
1115
  {
1114
1116
  const
1115
1117
  element = $(`#${id}`),
1116
- node = this .getNode (element),
1117
1118
  parentFieldElement = element .closest (".field, .scene", this .sceneGraph),
1118
1119
  parentNodeElement = parentFieldElement .closest (".node, .scene, .proto", this .sceneGraph),
1119
1120
  parentNode = this .getNode (parentNodeElement),
@@ -962,10 +962,11 @@ module .exports = class OutlineView extends Interface
962
962
  }
963
963
  }
964
964
 
965
- #nodeSymbol = Symbol ();
966
- #updateNodeBoundSymbol = Symbol ();
967
- #updateNodeLoadStateSymbol = Symbol ();
968
- #updateNodePlaySymbol = Symbol ();
965
+ #nodeSymbol = Symbol ();
966
+ #updateNodeVisibilitySymbol = Symbol ();
967
+ #updateNodeBoundSymbol = Symbol ();
968
+ #updateNodeLoadStateSymbol = Symbol ();
969
+ #updateNodePlaySymbol = Symbol ();
969
970
 
970
971
  createNodeElement (type, parent, node, index)
971
972
  {
@@ -1093,7 +1094,7 @@ module .exports = class OutlineView extends Interface
1093
1094
 
1094
1095
  if (!(node .getExecutionContext () .getOuterNode () instanceof X3D .X3DProtoDeclaration))
1095
1096
  {
1096
- if (node .setHidden)
1097
+ if (node ._hidden)
1097
1098
  {
1098
1099
  buttons .push ($("<span></span>")
1099
1100
  .attr ("order", "0")
@@ -1102,6 +1103,8 @@ module .exports = class OutlineView extends Interface
1102
1103
  .addClass (["button", "material-symbols-outlined"])
1103
1104
  .addClass (node .isHidden () ? "off" : "on")
1104
1105
  .text (node .isHidden () ? "visibility_off" : "visibility"));
1106
+
1107
+ node ._hidden .addFieldCallback (this .#updateNodeVisibilitySymbol, this .updateNodeVisibility .bind (this, node));
1105
1108
  }
1106
1109
 
1107
1110
  if (node .getType () .some (type => this .onDemandToolNodes .has (type)))
@@ -1330,6 +1333,18 @@ module .exports = class OutlineView extends Interface
1330
1333
  .addClass ("on");
1331
1334
  }
1332
1335
 
1336
+ updateNodeVisibility (node)
1337
+ {
1338
+ this .sceneGraph
1339
+ .find (`.node[node-id=${node .getId ()}],
1340
+ .imported-node[node-id=${node .getId ()}],
1341
+ .exported-node[node-id=${node .getId ()}]`)
1342
+ .find ("> .item [action=toggle-visibility]")
1343
+ .removeClass (["on", "off"])
1344
+ .addClass (node .isHidden () ? "off" : "on")
1345
+ .text (node .isHidden () ? "visibility_off" : "visibility");
1346
+ }
1347
+
1333
1348
  updateNodeBound (node)
1334
1349
  {
1335
1350
  this .sceneGraph
@@ -3086,6 +3101,8 @@ module .exports = class OutlineView extends Interface
3086
3101
  return;
3087
3102
  }
3088
3103
 
3104
+ node ._hidden ?.removeFieldCallback (this .#updateNodeVisibilitySymbol);
3105
+
3089
3106
  for (const type of node .getType ())
3090
3107
  {
3091
3108
  switch (type)
@@ -3260,14 +3277,6 @@ module .exports = class OutlineView extends Interface
3260
3277
  event .stopImmediatePropagation ();
3261
3278
 
3262
3279
  node .setHidden (hidden);
3263
-
3264
- this .sceneGraph .find (`.node[node-id=${node .getId ()}],
3265
- .imported-node[node-id=${node .getId ()}],
3266
- .exported-node[node-id=${node .getId ()}]`)
3267
- .find ("> .item [action=toggle-visibility]")
3268
- .removeClass (["on", "off"])
3269
- .addClass (hidden ? "off" : "on")
3270
- .text (hidden ? "visibility_off" : "visibility");
3271
3280
  }
3272
3281
 
3273
3282
  toggleTool (event)
@@ -3413,14 +3422,6 @@ module .exports = class OutlineView extends Interface
3413
3422
  continue;
3414
3423
 
3415
3424
  node .setHidden (node .getType () .includes (X3D .X3DConstants .X3DShapeNode));
3416
-
3417
- this .sceneGraph .find (`.node[node-id=${node .getId ()}],
3418
- .imported-node[node-id=${node .getId ()}],
3419
- .exported-node[node-id=${node .getId ()}]`)
3420
- .find ("> .item [action=toggle-visibility]")
3421
- .removeClass (["on", "off"])
3422
- .addClass (node .isHidden () ? "off" : "on")
3423
- .text (node .isHidden () ? "visibility_off" : "visibility");
3424
3425
  }
3425
3426
 
3426
3427
  // Show all nodes in selection.
@@ -3441,14 +3442,6 @@ module .exports = class OutlineView extends Interface
3441
3442
  continue;
3442
3443
 
3443
3444
  node .setHidden (false);
3444
-
3445
- this .sceneGraph .find (`.node[node-id=${node .getId ()}],
3446
- .imported-node[node-id=${node .getId ()}],
3447
- .exported-node[node-id=${node .getId ()}]`)
3448
- .find ("> .item .toggle-visibility")
3449
- .removeClass ("off")
3450
- .addClass ("on")
3451
- .text ("visibility");
3452
3445
  }
3453
3446
  }
3454
3447
 
@@ -3467,14 +3460,6 @@ module .exports = class OutlineView extends Interface
3467
3460
  continue;
3468
3461
 
3469
3462
  node .setHidden (false);
3470
-
3471
- this .sceneGraph .find (`.node[node-id=${node .getId ()}],
3472
- .imported-node[node-id=${node .getId ()}],
3473
- .exported-node[node-id=${node .getId ()}]`)
3474
- .find ("> .item .toggle-visibility")
3475
- .removeClass ("off")
3476
- .addClass ("on")
3477
- .text ("visibility");
3478
3463
  }
3479
3464
  }
3480
3465
 
@@ -3491,14 +3476,6 @@ module .exports = class OutlineView extends Interface
3491
3476
  continue;
3492
3477
 
3493
3478
  node .setHidden (false);
3494
-
3495
- this .sceneGraph .find (`.node[node-id=${node .getId ()}],
3496
- .imported-node[node-id=${node .getId ()}],
3497
- .exported-node[node-id=${node .getId ()}]`)
3498
- .find ("> .item .toggle-visibility")
3499
- .removeClass ("off")
3500
- .addClass ("on")
3501
- .text ("visibility");
3502
3479
  }
3503
3480
  }
3504
3481
 
@@ -487,6 +487,8 @@ module .exports = class ScriptEditor extends Interface
487
487
  string += `X3D .${field .getNodeTypeName ()}Proxy;`;
488
488
  else
489
489
  string += `X3D .SFNode | null;`;
490
+
491
+ break;
490
492
  }
491
493
  case X3D .X3DConstants .MFNode:
492
494
  {
@@ -496,15 +498,19 @@ module .exports = class ScriptEditor extends Interface
496
498
  string += `X3D .MFNode <${types .join ("|")}|null>;`;
497
499
  else
498
500
  string += `X3D .MFNode;`;
501
+
502
+ break;
499
503
  }
500
504
  default:
501
505
  {
502
506
  string += this .#internalTypes .get (field .getType ()) ?? `X3D .${field .getTypeName ()}`;
503
- string += "";"";
504
- }
507
+ string += ";";
505
508
 
506
- return string;
509
+ break;
510
+ }
507
511
  }
512
+
513
+ return string;
508
514
  });
509
515
 
510
516
  monaco .languages .typescript .javascriptDefaults .setExtraLibs ([
@@ -754,8 +754,6 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
754
754
  if ((profile && oldProfile && profile .name === oldProfile .name) || (profile === oldProfile))
755
755
  return;
756
756
 
757
- const browser = scene .getBrowser ();
758
-
759
757
  undoManager .beginUndo (_("Set Profile to »%s«"), profile ? profile .title : "Full");
760
758
 
761
759
  scene .setProfile (profile);
@@ -2844,9 +2842,12 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
2844
2842
  for (const node of nodes)
2845
2843
  {
2846
2844
  const
2847
- innerNode = node .getInnerNode (),
2845
+ innerNode = $.try (() => node .getInnerNode ()),
2848
2846
  modelMatrices = this .getModelMatrices (executionContext, layerNode, node, false);
2849
2847
 
2848
+ if (!innerNode)
2849
+ continue;
2850
+
2850
2851
  if (!modelMatrices .length)
2851
2852
  continue;
2852
2853