sunrize 1.7.35 → 1.7.36

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": "1.7.35",
4
+ "version": "1.7.36",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -99,7 +99,7 @@
99
99
  "jquery-ui-dist": "^1.13.3",
100
100
  "jstree": "^3.3.17",
101
101
  "material-icons": "^1.13.12",
102
- "material-symbols": "^0.27.1",
102
+ "material-symbols": "^0.27.2",
103
103
  "md5": "^2.3.0",
104
104
  "mime-types": "^2.1.35",
105
105
  "monaco-editor": "^0.50.0",
@@ -109,7 +109,7 @@
109
109
  "string-similarity": "^4.0.4",
110
110
  "tweakpane": "^3.1.10",
111
111
  "update-electron-app": "^3.0.0",
112
- "x_ite": "^10.5.15",
112
+ "x_ite": "^11.0.0",
113
113
  "x3d-traverse": "^1.0.6"
114
114
  }
115
115
  }
@@ -28,7 +28,7 @@ $.fn.materialPreviewPopover = async function (node)
28
28
 
29
29
  const
30
30
  browser = canvas .prop ("browser"),
31
- scene = browser .createScene (browser .getProfile ("Core"));
31
+ scene = await browser .createScene (browser .getProfile ("Core"));
32
32
 
33
33
  scene .setWorldURL (node .getExecutionContext () .worldURL);
34
34
 
@@ -52,7 +52,7 @@ $.fn.texturePreviewPopover = async function (node)
52
52
 
53
53
  const
54
54
  browser = canvas .prop ("browser"),
55
- scene = browser .createScene (browser .getProfile ("Core"));
55
+ scene = await browser .createScene (browser .getProfile ("Core"));
56
56
 
57
57
  scene .setWorldURL (node .getExecutionContext () .worldURL);
58
58
 
@@ -61,7 +61,7 @@ $.fn.texturePreviewPopover = async function (node)
61
61
  // Create texture node.
62
62
 
63
63
  const
64
- x3dSyntax = Editor .exportX3D (node .getExecutionContext (), [node]),
64
+ x3dSyntax = await Editor .exportX3D (node .getExecutionContext (), [node]),
65
65
  nodes = await Editor .importX3D (scene, x3dSyntax, new UndoManager ()),
66
66
  previewNode = nodes [0],
67
67
  appearanceNode = browser .currentScene .getExportedNode ("Appearance");
@@ -794,17 +794,17 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
794
794
  Editor .removeImportedNode (importedNode .getExecutionContext (), importedNode .getImportedName ());
795
795
  }
796
796
 
797
- cutNodes ()
797
+ async cutNodes ()
798
798
  {
799
799
  UndoManager .shared .beginUndo (_("Cut Nodes"));
800
800
 
801
- this .copyNodes ();
802
- this .deleteNodes ();
801
+ await this .copyNodes ();
802
+ await this .deleteNodes ();
803
803
 
804
804
  UndoManager .shared .endUndo ();
805
805
  }
806
806
 
807
- copyNodes (deselect)
807
+ async copyNodes (deselect)
808
808
  {
809
809
  const
810
810
  primary = $(".node.primary, .proto.primary, .externproto.primary"),
@@ -829,7 +829,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
829
829
 
830
830
  undoManager .endUndo ();
831
831
 
832
- const x3dSyntax = Editor .exportX3D (this .executionContext, nodes, { importedNodes: true });
832
+ const x3dSyntax = await Editor .exportX3D (this .executionContext, nodes, { importedNodes: true });
833
833
 
834
834
  //console .log (x3dSyntax)
835
835
 
@@ -841,7 +841,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
841
841
  this .deselectAll ();
842
842
  }
843
843
 
844
- copyExternPrototype ()
844
+ async copyExternPrototype ()
845
845
  {
846
846
  const
847
847
  elements = $(".proto.primary, .proto.manually"),
@@ -849,7 +849,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
849
849
 
850
850
  const
851
851
  browser = this .executionContext .getBrowser (),
852
- scene = browser .createScene (),
852
+ scene = await browser .createScene (browser .getProfile ("Full")),
853
853
  worldURL = new URL (this .executionContext .worldURL),
854
854
  basename = path .basename (worldURL .pathname);
855
855
 
@@ -1366,7 +1366,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1366
1366
  const
1367
1367
  rootNodes = executionContext .rootNodes .copy (),
1368
1368
  nodesToImport = [... inlineNode .getInternalScene () .rootNodes] .map (node => node .getValue ()),
1369
- x3dSyntax = Editor .exportX3D (inlineNode .getInternalScene (), nodesToImport, { importedNodes: true }),
1369
+ x3dSyntax = await Editor .exportX3D (inlineNode .getInternalScene (), nodesToImport, { importedNodes: true }),
1370
1370
  nodes = await Editor .importX3D (executionContext, x3dSyntax);
1371
1371
 
1372
1372
  // Remove imported nodes from root nodes.
@@ -2865,7 +2865,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
2865
2865
  {
2866
2866
  UndoManager .shared .beginUndo (_("Copy Extern Proto »%s«"), sourceExternProto .getName ());
2867
2867
 
2868
- await Editor .importX3D (destinationExecutionContext, Editor .exportX3D (sourceExecutionContext, [sourceExternProto]));
2868
+ await Editor .importX3D (destinationExecutionContext, await Editor .exportX3D (sourceExecutionContext, [sourceExternProto]));
2869
2869
 
2870
2870
  const
2871
2871
  externprotos = Array .from (destinationExecutionContext .externprotos),
@@ -2939,7 +2939,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
2939
2939
  {
2940
2940
  UndoManager .shared .beginUndo (_("Copy Prototype »%s«"), sourceProto .getName ());
2941
2941
 
2942
- await Editor .importX3D (destinationExecutionContext, Editor .exportX3D (sourceExecutionContext, [sourceProto]));
2942
+ await Editor .importX3D (destinationExecutionContext, await Editor .exportX3D (sourceExecutionContext, [sourceProto]));
2943
2943
 
2944
2944
  const
2945
2945
  protos = Array .from (destinationExecutionContext .protos),
@@ -3044,7 +3044,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
3044
3044
  }
3045
3045
 
3046
3046
  const copiedNodes = sourceNodes .length
3047
- ? await Editor .importX3D (destinationExecutionContext, Editor .exportX3D (this .executionContext, sourceNodes, { importedNodes: true }))
3047
+ ? await Editor .importX3D (destinationExecutionContext, await Editor .exportX3D (this .executionContext, sourceNodes, { importedNodes: true }))
3048
3048
  : [ ];
3049
3049
 
3050
3050
  if (copiedNodes .length)
@@ -256,40 +256,63 @@ module .exports = class ScriptEditor extends Interface
256
256
 
257
257
  const fields = Array .from (this .node .getUserDefinedFields (), field =>
258
258
  {
259
- switch (field .getAccessType ())
259
+ if (field .getAccessType () === X3D .X3DConstants .inputOnly)
260
+ return "";
261
+
262
+ const accessType = [ ];
263
+
264
+ if (field .isInput ())
265
+ accessType .push ("in");
266
+
267
+ if (field .isOutput ())
268
+ accessType .push ("out");
269
+
270
+ let value = "";
271
+
272
+ if (field instanceof X3D .X3DArrayField)
273
+ {
274
+ value += `(${field .length} elements)`;
275
+ }
276
+ else
260
277
  {
261
- case X3D .X3DConstants .initializeOnly:
262
- case X3D .X3DConstants .outputOnly:
263
- case X3D .X3DConstants .inputOutput:
278
+ const STRING_MAX = 16;
279
+
280
+ if (field instanceof X3D .SFString)
281
+ value += `"${X3D .SFString .escape (field .valueOf ()) .substring (0, STRING_MAX)}${field .length <= STRING_MAX ? "" : "..."}"`;
282
+ else
283
+ value += String (field);
284
+ }
285
+
286
+ let string = "";
287
+
288
+ string += `/** This is the user-defined field ${field .getTypeName ()} [${accessType .join (", ")}] *${field .getName ()}* ${value}. */\n`;
289
+ string += `declare let ${field .getName ()}: `;
290
+
291
+ switch (field .getType ())
292
+ {
293
+ case X3D .X3DConstants .SFNode:
264
294
  {
265
- switch (field .getType ())
266
- {
267
- case X3D .X3DConstants .SFNode:
268
- {
269
- if (field .getValue ())
270
- return `declare let ${field .getName ()}: X3D .${field .getNodeTypeName ()}Proxy;`;
271
- else
272
- return `declare let ${field .getName ()}: X3D .SFNode | null;`;
273
- }
274
- case X3D .X3DConstants .MFNode:
275
- {
276
- const types = Array .from (new Set (Array .from (field, node => node ? `${node .getNodeTypeName ()}Proxy` : "null")));
277
-
278
- if (types .length)
279
- return `declare let ${field .getName ()}: X3D .MFNode <${types .join ("|")}|null>;`;
280
- else
281
- return `declare let ${field .getName ()}: X3D .MFNode;`;
282
- }
283
- default:
284
- {
285
- return `declare let ${field .getName ()}: ${
286
- this .#internalTypes .get (field .getType ()) ?? "X3D ." + field .getTypeName ()
287
- };`;
288
- }
289
- }
295
+ if (field .getValue ())
296
+ string += `X3D .${field .getNodeTypeName ()}Proxy;`;
297
+ else
298
+ string += `X3D .SFNode | null;`;
299
+ }
300
+ case X3D .X3DConstants .MFNode:
301
+ {
302
+ const types = Array .from (new Set (Array .from (field, node => node ? `${node .getNodeTypeName ()}Proxy` : "null")));
303
+
304
+ if (types .length)
305
+ string += `X3D .MFNode <${types .join ("|")}|null>;`;
306
+ else
307
+ string += `X3D .MFNode;`;
290
308
  }
291
309
  default:
292
- return "";
310
+ {
311
+ string += this .#internalTypes .get (field .getType ()) ?? `X3D .${field .getTypeName ()}`;
312
+ string += "";"";
313
+ }
314
+
315
+ return string;
293
316
  }
294
317
  });
295
318
 
@@ -380,11 +403,13 @@ module .exports = class ScriptEditor extends Interface
380
403
  bracketPairColorization: { enabled: true },
381
404
  });
382
405
 
406
+ editor .onDidFocusEditorWidget (() => this .setDeclarations (monaco));
383
407
  editor .onDidBlurEditorWidget (() => this .apply ());
384
408
 
385
409
  editor .viewState = editor .saveViewState ();
386
410
 
387
- element .on ("contextmenu", (event) => this .showContextMenu ());
411
+ element .on ("mouseenter", () => this .setDeclarations (monaco))
412
+ element .on ("contextmenu", () => this .showContextMenu ());
388
413
  element .detach ();
389
414
 
390
415
  // this .debugFindActions (editor)
@@ -156,7 +156,7 @@ class X3DNodeTool extends X3DBaseTool
156
156
  {
157
157
  const scene = await this .getBrowser () .createX3DFromURL (new X3D .MFString (protoURL));
158
158
 
159
- scene .setExecutionContext (null);
159
+ scene .setExecutionContext (this .getBrowser () .getPrivateScene ());
160
160
  scene .setCountPrimitives (false);
161
161
 
162
162
  for (const externproto of scene .externprotos)
@@ -75,7 +75,7 @@ module .exports = class Editor
75
75
  * @param {Object} options
76
76
  * @returns {string} x3dSyntax
77
77
  */
78
- static exportX3D (executionContext, objects = [ ], { type = "x3d", importedNodes = false, exportedNodes = false } = { })
78
+ static async exportX3D (executionContext, objects = [ ], { type = "x3d", importedNodes = false, exportedNodes = false } = { })
79
79
  {
80
80
  const
81
81
  externprotos = new Set (),
@@ -84,7 +84,7 @@ module .exports = class Editor
84
84
 
85
85
  const
86
86
  browser = executionContext .getBrowser (),
87
- scene = browser .createScene ();
87
+ scene = await browser .createScene (browser .getProfile ("Core"));
88
88
 
89
89
  // Determine protos.
90
90
 
@@ -220,6 +220,7 @@ module .exports = class Editor
220
220
 
221
221
  // Dispose scene.
222
222
 
223
+ scene .routes .clear ();
223
224
  scene .dispose ();
224
225
  nodes .dispose ();
225
226
 
@@ -245,7 +246,7 @@ module .exports = class Editor
245
246
  externprotos = new Map (Array .from (executionContext .externprotos, p => [p .getName (), p])),
246
247
  protos = new Map (Array .from (executionContext .protos, p => [p .getName (), p])),
247
248
  rootNodes = executionContext .rootNodes .copy (),
248
- tempScene = browser .createScene (browser .getProfile ("Core"));
249
+ tempScene = await browser .createScene (browser .getProfile ("Core"));
249
250
 
250
251
  scene .setProfile (browser .getProfile ("Full"));
251
252
  scene .updateComponent (browser .getComponent ("X_ITE"));
@@ -398,8 +399,8 @@ module .exports = class Editor
398
399
  {
399
400
  const
400
401
  browser = executionContext .getBrowser (),
401
- scene = browser .createScene (),
402
- x3dSyntax = this .exportX3D (executionContext, nodes, { importedNodes: true, exportedNodes: true }),
402
+ scene = await browser .createScene (browser .getProfile ("Core")),
403
+ x3dSyntax = await this .exportX3D (executionContext, nodes, { importedNodes: true, exportedNodes: true }),
403
404
  loadUrlObjects = browser .getBrowserOption ("LoadUrlObjects");
404
405
 
405
406
  browser .setBrowserOption ("LoadUrlObjects", false);
@@ -408,6 +409,7 @@ module .exports = class Editor
408
409
 
409
410
  await this .importX3D (scene, x3dSyntax, new UndoManager ());
410
411
 
412
+ this .rewriteURLs (scene, scene, executionContext .worldURL, scene .worldURL, new UndoManager ());
411
413
  this .inferProfileAndComponents (scene, new UndoManager ());
412
414
 
413
415
  fs .writeFileSync (filePath, this .getContents (scene, path .extname (filePath)));
@@ -525,7 +527,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
525
527
  {
526
528
  try
527
529
  {
528
- const filePath = path .resolve (path .dirname (url .fileURLToPath (oldWorldURL)), url .fileURLToPath (fileURL));
530
+ const filePath = url .fileURLToPath (new URL (fileURL, oldWorldURL));
529
531
 
530
532
  let relativePath = path .relative (path .dirname (url .fileURLToPath (newWorldURL)), filePath);
531
533
 
@@ -537,8 +539,10 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
537
539
  newURL .push (encodeURI (relativePath));
538
540
  continue;
539
541
  }
540
- catch
541
- { }
542
+ catch (error)
543
+ {
544
+ // console .log (error)
545
+ }
542
546
 
543
547
  newURL .push (fileURL);
544
548
  }
@@ -1350,13 +1354,17 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1350
1354
  {
1351
1355
  const
1352
1356
  browser = executionContext .getBrowser (),
1353
- scene = browser .createScene (),
1354
- x3dSyntax = this .exportX3D (executionContext, [proto]);
1357
+ scene = await browser .createScene (browser .getProfile ("Core")),
1358
+ x3dSyntax = await this .exportX3D (executionContext, [proto]);
1355
1359
 
1356
1360
  undoManager .beginUndo (_("Turn Prototype »%s« into Extern Prototype"), proto .getName ());
1357
1361
 
1362
+ scene .setWorldURL (url .pathToFileURL (filePath));
1363
+
1358
1364
  await this .importX3D (scene, x3dSyntax, new UndoManager ());
1359
- this .rewriteURLs (scene, scene, executionContext .worldURL, url .pathToFileURL (filePath) .href, new UndoManager ());
1365
+
1366
+ this .rewriteURLs (scene, scene, executionContext .worldURL, scene .worldURL, new UndoManager ());
1367
+ this .inferProfileAndComponents (scene, new UndoManager ());
1360
1368
 
1361
1369
  fs .writeFileSync (filePath, this .getContents (scene, path .extname (filePath)));
1362
1370
  scene .dispose ();
@@ -1530,7 +1538,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
1530
1538
  {
1531
1539
  const
1532
1540
  numProtos = executionContext .protos .length,
1533
- x3dSyntax = this .exportX3D (externproto .getInternalScene (), [externproto .getProtoDeclaration ()])
1541
+ x3dSyntax = await this .exportX3D (externproto .getInternalScene (), [externproto .getProtoDeclaration ()])
1534
1542
 
1535
1543
  undoManager .beginUndo (_("Turn Extern Prototype »%s« into Prototype"), externproto .getName ())
1536
1544
 
@@ -0,0 +1,77 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8"/>
4
+ <!-- Theme -->
5
+ <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/src/assets/themes/default.css"/>
6
+ </head>
7
+ <body>
8
+ <tab-group sortable="true">
9
+ <style>
10
+ .etabs .nav {
11
+ height: var(--window-tabs-height);
12
+ background: var(--background-color);
13
+ box-shadow: none;
14
+ border: none;
15
+ overflow: auto;
16
+ white-space: nowrap;
17
+ }
18
+
19
+ .etabs .tab {
20
+ background: var(--window-tabs-background-color);
21
+ border-color: var(--border-color) !important;
22
+ padding: 4px 3px !important;
23
+ color: var(--window-tabs-text-color);
24
+ font-family: var(--sans-serif);
25
+ box-shadow: none;
26
+ }
27
+
28
+ .etabs .tab:first-child {
29
+ border-left: 0;
30
+ }
31
+
32
+ .etabs .tab.active {
33
+ z-index: 1100;
34
+ background: var(--background-color);
35
+ color: var(--window-tabs-highlight-color);
36
+ }
37
+
38
+ .etabs::before {
39
+ z-index: 1000;
40
+ content: "";
41
+ position: relative;
42
+ display: block;
43
+ height: 1px;
44
+ width: 100%;
45
+ box-shadow: var(--tabs-shadow);
46
+ }
47
+
48
+ .etabs .buttons {
49
+ border-color: var(--border-color);
50
+ }
51
+
52
+ .etabs .buttons:hover button,
53
+ .etabs .tab-close button:hover {
54
+ background: none;
55
+ }
56
+
57
+ .etabs .buttons button:hover,
58
+ .etabs .tab-close:hover button {
59
+ color: var(--system-gray0);
60
+ }
61
+
62
+ .etabs .tab-close button {
63
+ visibility: hidden;
64
+ }
65
+
66
+ .etabs .tab.active .tab-close button,
67
+ .etabs .tab:hover .tab-close button {
68
+ visibility: visible;
69
+ }
70
+
71
+ .etabs .tab-close {
72
+ margin-left: 4px;
73
+ }
74
+ </style>
75
+ </tab-group>
76
+ </body>
77
+ </html>
@@ -0,0 +1,38 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8"/>
4
+ <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/jquery-ui-dist/jquery-ui.min.css"/>
5
+ <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/qtip2/dist/jquery.qtip.min.css"/>
6
+ <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/src/assets/themes/default.css"/>
7
+ <link rel="stylesheet" data-name="vs/editor/editor.main" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/monaco-editor/min/vs/editor/editor.main.css">
8
+ </head>
9
+ <body>
10
+ <div id="vertical-splitter" class="vertical-splitter">
11
+ <div class="vertical-splitter-left">
12
+ <div id="horizontal-splitter" class="horizontal-splitter">
13
+ <div class="horizontal-splitter-top">
14
+ <div id="browser-pane">
15
+ <div id="browser-frame">
16
+ <x3d-canvas
17
+ id="browser"
18
+ debug="false"
19
+ cache="false"
20
+ preserveDrawingBuffer="true"
21
+ splashScreen="false"
22
+ contextMenu="false"
23
+ xrSessionMode="NONE"></x3d-canvas>
24
+ </div>
25
+ <div id="secondary-toolbar" class="toolbar vertical-toolbar large-toolbar secondary-toolbar"></div>
26
+ </div>
27
+ </div>
28
+ <div class="horizontal-splitter-bottom">
29
+ <div id="footer"></div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <div class="vertical-splitter-right">
34
+ <div id="sidebar" class="sidebar"></div>
35
+ </div>
36
+ </div>
37
+ </body>
38
+ </html>
@@ -171,7 +171,6 @@ tr.disabled ~ tr > td > div {
171
171
  /* Vertical splitter */
172
172
 
173
173
  .vertical-splitter {
174
- overflow: hidden;
175
174
  position: absolute;
176
175
  box-sizing: border-box;
177
176
  inset: 0;
@@ -365,7 +364,6 @@ tr.disabled ~ tr > td > div {
365
364
  }
366
365
 
367
366
  .ui-tabs > .ui-tabs-panel {
368
- overflow: hidden;
369
367
  box-sizing: border-box;
370
368
  position: relative;
371
369
  padding: unset;
@@ -380,7 +378,6 @@ tr.disabled ~ tr > td > div {
380
378
 
381
379
  .tabs-panel {
382
380
  position: absolute;
383
- overflow: hidden;
384
381
  inset: 0;
385
382
  }
386
383
 
@@ -728,7 +725,6 @@ body.dark .ui-widget .library-list .component {
728
725
  /* Footer */
729
726
 
730
727
  #footer {
731
- overflow: hidden;
732
728
  position: absolute;
733
729
  box-sizing: border-box;
734
730
  width: 100%;
@@ -743,7 +739,6 @@ body.dark .ui-widget .library-list .component {
743
739
  }
744
740
 
745
741
  .console {
746
- overflow: hidden;
747
742
  box-sizing: border-box;
748
743
  }
749
744
 
@@ -882,7 +877,6 @@ body.dark .ui-widget .library-list .component {
882
877
  }
883
878
 
884
879
  .script-editor .script-editor-left {
885
- overflow: hidden;
886
880
  position: absolute;
887
881
  box-sizing: border-box;
888
882
  left: 0;
@@ -928,7 +922,6 @@ body.dark .ui-widget .library-list .component {
928
922
  /* Animation Editor */
929
923
 
930
924
  .animation-editor {
931
- overflow: hidden;
932
925
  box-sizing: border-box;
933
926
  }
934
927