sunrize 1.0.66 → 1.0.67

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/docs/_config.yml CHANGED
@@ -33,13 +33,13 @@ github:
33
33
  username: create3000/sunrize # change to your github username
34
34
 
35
35
  twitter:
36
- username: web3dconsortium # change to your twitter username
36
+ username: web3dconsortium # change to your twitter username
37
37
 
38
38
  social:
39
39
  # Change to your full name.
40
40
  # It will be displayed as the default author of the posts and the copyright owner in the Footer
41
41
  name: CREATE3000
42
- email: holger.seelig@google.com # change to your email address
42
+ email: holger.seelig@gmail.com # change to your email address
43
43
  links:
44
44
  # The first element serves as the copyright owner"s link
45
45
  - https://twitter.com/web3dconsortium # change to your twitter homepage
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.0.66",
4
+ "version": "1.0.67",
5
5
  "description": "A Multi Platform X3D Editor",
6
6
  "homepage": "https://create3000.github.io/sunrize/",
7
7
  "author": "Holger Seelig",
@@ -67,7 +67,7 @@
67
67
  "qtip2": "^3.0.3",
68
68
  "spectrum-colorpicker2": "^2.0.10",
69
69
  "string-similarity": "^4.0.4",
70
- "x_ite": "^8.9.3"
70
+ "x_ite": "^8.10.0"
71
71
  },
72
72
  "main": "src/main.js",
73
73
  "bin": {
@@ -23,7 +23,7 @@ module .exports = class Interface
23
23
  this .config = { global: this .createGlobalConfig () }
24
24
  this .config .file = this .createFileConfig ()
25
25
 
26
- this .browser .addBrowserCallback (this, this .setBrowserEvent .bind (this))
26
+ this .browser .addBrowserCallback (this, X3D .X3DConstants .INITIALIZED_EVENT, this .browserInitialized .bind (this))
27
27
  CSS .colorScheme .addEventListener ("change", event => this .colorScheme (!! event .matches))
28
28
  }
29
29
 
@@ -33,7 +33,7 @@ module .exports = class Interface
33
33
 
34
34
  // Configure
35
35
 
36
- this .setBrowserEvent (X3D .X3DConstants .INITIALIZED_EVENT)
36
+ this .browserInitialized (X3D .X3DConstants .INITIALIZED_EVENT)
37
37
  }
38
38
 
39
39
  initialize () { }
@@ -89,11 +89,8 @@ module .exports = class Interface
89
89
  *
90
90
  * @param {string} event
91
91
  */
92
- setBrowserEvent (event)
92
+ browserInitialized (event)
93
93
  {
94
- if (event !== X3D .X3DConstants .INITIALIZED_EVENT)
95
- return
96
-
97
94
  this .config .file = this .createFileConfig (this .browser .getWorldURL ())
98
95
 
99
96
  this .configure ()
@@ -27,11 +27,14 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
27
27
  {
28
28
  super .configure ()
29
29
 
30
- this .X3DTransformMatrix3DNode = new Set ([
30
+ // Now are all nodes available.
31
+
32
+ this .matrixNodes = new Set ([
31
33
  X3D .X3DConstants .Billboard,
32
34
  X3D .X3DConstants .CADPart,
33
35
  X3D .X3DConstants .GeoLocation,
34
36
  X3D .X3DConstants .GeoTransform,
37
+ X3D .X3DConstants .HAnimHumanoid,
35
38
  X3D .X3DConstants .HAnimJoint,
36
39
  X3D .X3DConstants .HAnimSite,
37
40
  X3D .X3DConstants .LayoutGroup,
@@ -801,6 +804,31 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
801
804
  await Editor .turnIntoPrototype (executionContext, externproto)
802
805
  }
803
806
 
807
+ toggleImportedNode (event, parent)
808
+ {
809
+ const
810
+ img = $(event .target),
811
+ exportedNode = this .getExportedNode (img .closest (".exported-node", this .sceneGraph)),
812
+ inlineNode = this .getNode (parent .closest (".node", this .sceneGraph)),
813
+ importedNode = this .executionContext .importedNodes .get (exportedNode .getExportedName ());
814
+
815
+ if (importedNode)
816
+ {
817
+ if (importedNode .getInlineNode () !== inlineNode)
818
+ return;
819
+
820
+ Editor .removeImportedNode (this .executionContext, exportedNode .getExportedName ());
821
+
822
+ img .attr ("src", `../images/OutlineEditor/Values/FALSE.svg`)
823
+ }
824
+ else
825
+ {
826
+ Editor .updateImportedNode (this .executionContext, inlineNode, exportedNode .getExportedName ());
827
+
828
+ img .attr ("src", `../images/OutlineEditor/Values/TRUE.svg`)
829
+ }
830
+ }
831
+
804
832
  addInstance (id, executionContextId, protoNodeId)
805
833
  {
806
834
  const
@@ -1968,8 +1996,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1968
1996
  node = this .getNode (nodeElement),
1969
1997
  modelMatrix = this .getModelMatrix (nodeElement .parent () .closest (".node", this .sceneGraph))
1970
1998
 
1971
- if (self && node .getType () .some (Set .prototype .has, this .X3DTransformMatrix3DNode))
1972
- modelMatrix .multLeft (node .getMatrix ())
1999
+ if (self)
2000
+ {
2001
+ if (node .getType () .some (Set .prototype .has, this .matrixNodes))
2002
+ modelMatrix .multLeft (node .getMatrix ())
2003
+ }
1973
2004
 
1974
2005
  return modelMatrix
1975
2006
  }
@@ -245,6 +245,9 @@ module .exports = class OutlineView extends Interface
245
245
  .on ("dragstart", this .onDragStartNode .bind (this))
246
246
  }
247
247
 
248
+ child .find (".exported-node > .item .boolean-button")
249
+ .on ("click", event => this .toggleImportedNode (event, parent))
250
+
248
251
  // Expand children.
249
252
 
250
253
  const
@@ -255,6 +258,8 @@ module .exports = class OutlineView extends Interface
255
258
  this .expandSceneSubtreeComplete (specialElements, elements)
256
259
  }
257
260
 
261
+ toggleImportedNode (event, parent) { }
262
+
258
263
  expandSceneSubtreeComplete (specialElements, elements)
259
264
  {
260
265
  this .updateRouteGraph ()
@@ -480,6 +485,10 @@ module .exports = class OutlineView extends Interface
480
485
  {
481
486
  return this .naturalCompare (a .getExportedName (), b .getExportedName ())
482
487
  })
488
+ .sort ((a, b) =>
489
+ {
490
+ return this .naturalCompare (a .getLocalNode () .getTypeName (), b .getLocalNode () .getTypeName ())
491
+ })
483
492
 
484
493
  const ul = $("<ul></ul>")
485
494
  .appendTo (child)
@@ -1114,6 +1123,20 @@ module .exports = class OutlineView extends Interface
1114
1123
  .append ($("<span></span>") .addClass ("as-name") .text (exportedNode .getExportedName ()))
1115
1124
  }
1116
1125
 
1126
+ const exportedExecutionContext = exportedNode .getLocalNode () .getExecutionContext ();
1127
+
1128
+ if (exportedExecutionContext !== this .executionContext && exportedExecutionContext .getExecutionContext () === this .executionContext)
1129
+ {
1130
+ const imported = this .executionContext .importedNodes
1131
+ .some (importedNode => importedNode .getExportedNode () === exportedNode .getLocalNode () && importedNode .getImportedName () === exportedNode .getExportedName ());
1132
+
1133
+ $("<img></img>")
1134
+ .addClass ("boolean-button")
1135
+ .attr ("src", `../images/OutlineEditor/Values/${imported ? "TRUE" : "FALSE"}.svg`)
1136
+ .attr ("title", _ ("Toggle value."))
1137
+ .appendTo (child)
1138
+ }
1139
+
1117
1140
  // Append empty tree to enable expander.
1118
1141
 
1119
1142
  $("<ul><li></li></ul>") .appendTo (child)
@@ -2740,6 +2763,11 @@ module .exports = class OutlineView extends Interface
2740
2763
  return this .objects .get (parseInt (element .attr ("node-id")))
2741
2764
  }
2742
2765
 
2766
+ getExportedNode (element)
2767
+ {
2768
+ return this .objects .get (parseInt (element .attr ("exported-node-id")))
2769
+ }
2770
+
2743
2771
  getField (element)
2744
2772
  {
2745
2773
  return this .objects .get (parseInt (element .attr ("field-id")))
@@ -44,7 +44,12 @@ class X3DBoundedObjectTool extends X3DNodeTool
44
44
  traverse (type, renderObject)
45
45
  {
46
46
  this .toolNode .traverse (type, renderObject)
47
+
48
+ renderObject .getHumanoids () .push (null)
49
+
47
50
  this .toolInnerNode ?.traverse (type, renderObject)
51
+
52
+ renderObject .getHumanoids () .pop ()
48
53
  }
49
54
  }
50
55
 
@@ -24,7 +24,7 @@ class X3DTransformNodeTool extends X3DNodeTool
24
24
 
25
25
  return super .removeTool ()
26
26
  }
27
-
27
+
28
28
  static box = new Box3 ()
29
29
 
30
30
  reshape ()
@@ -44,7 +44,12 @@ class X3DTransformNodeTool extends X3DNodeTool
44
44
  traverse (type, renderObject)
45
45
  {
46
46
  this .toolNode .traverse (type, renderObject)
47
+
48
+ renderObject .getHumanoids () .push (null)
49
+
47
50
  this .toolInnerNode ?.traverse (type, renderObject)
51
+
52
+ renderObject .getHumanoids () .pop ()
48
53
  }
49
54
  }
50
55
 
@@ -457,18 +457,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
457
457
 
458
458
  // Remove routes.
459
459
 
460
- for (const field of node .getFields ())
461
- {
462
- for (const route of field .getInputRoutes ())
463
- {
464
- this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
465
- }
466
-
467
- for (const route of field .getOutputRoutes ())
468
- {
469
- this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
470
- }
471
- }
460
+ this .deleteRoutes (executionContext, node, undoManager)
472
461
 
473
462
  if (node .getType () .includes (X3D .X3DConstants .X3DBindableNode))
474
463
  {
@@ -821,7 +810,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
821
810
  * @param {string} importedName
822
811
  * @param {UndoManager} undoManager
823
812
  */
824
- static updateImportedNode (executionContext, inlineNode, exportedName, importedName, undoManager = UndoManager .shared)
813
+ static updateImportedNode (executionContext, inlineNode, exportedName, importedName = exportedName, undoManager = UndoManager .shared)
825
814
  {
826
815
  undoManager .beginUndo (_ ("Update Imported Node »%s«"), importedName)
827
816
 
@@ -852,6 +841,13 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
852
841
 
853
842
  undoManager .beginUndo (_ ("Remove Imported Node »%s«"), importedName)
854
843
 
844
+ try
845
+ {
846
+ this .deleteRoutes (executionContext, importedNode .getExportedNode (), undoManager);
847
+ }
848
+ catch
849
+ { }
850
+
855
851
  executionContext .removeImportedNode (importedName)
856
852
 
857
853
  undoManager .registerUndo (() =>
@@ -1337,18 +1333,10 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
1337
1333
  {
1338
1334
  inputRoutes .set (field .getName (), new Set (field .getInputRoutes ()))
1339
1335
  outputRoutes .set (field .getName (), new Set (field .getOutputRoutes ()))
1340
-
1341
- for (const route of field .getInputRoutes ())
1342
- {
1343
- this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
1344
- }
1345
-
1346
- for (const route of field .getOutputRoutes ())
1347
- {
1348
- this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
1349
- }
1350
1336
  }
1351
1337
 
1338
+ this .deleteRoutes (executionContext, instance, undoManager)
1339
+
1352
1340
  // Set proto node.
1353
1341
 
1354
1342
  instance .setProtoNode (protoNode)
@@ -1529,6 +1517,33 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
1529
1517
  undoManager .endUndo ()
1530
1518
  }
1531
1519
 
1520
+ /**
1521
+ *
1522
+ * @param {X3DBaseNode} node
1523
+ * @param {UndoManager} undoManager
1524
+ */
1525
+ static deleteRoutes (executionContext, node, undoManager = UndoManager .shared)
1526
+ {
1527
+ for (const field of node .getFields ())
1528
+ {
1529
+ for (const route of field .getInputRoutes ())
1530
+ {
1531
+ if (route .getExecutionContext () !== executionContext)
1532
+ continue;
1533
+
1534
+ this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
1535
+ }
1536
+
1537
+ for (const route of field .getOutputRoutes ())
1538
+ {
1539
+ if (route .getExecutionContext () !== executionContext)
1540
+ continue;
1541
+
1542
+ this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager)
1543
+ }
1544
+ }
1545
+ }
1546
+
1532
1547
  /**
1533
1548
  *
1534
1549
  * @param {X3DExecutionContext} executionContext
@@ -1213,6 +1213,10 @@ body.dark .ui-widget .library-list .component {
1213
1213
  color: var(--system-brown);
1214
1214
  }
1215
1215
 
1216
+ .scene-graph .exported-node > .item .boolean-button {
1217
+ top: 2px
1218
+ }
1219
+
1216
1220
  .scene-graph .field > .item .name {
1217
1221
  color: var(--system-orange);
1218
1222
  }
@@ -1233,6 +1237,7 @@ body.dark .ui-widget .library-list .component {
1233
1237
  }
1234
1238
 
1235
1239
  .scene-graph .boolean-button {
1240
+ cursor: pointer;
1236
1241
  position: relative;
1237
1242
  margin-left: 10px;
1238
1243
  width: 28px;