sunrize 1.5.0 → 1.5.2

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.5.0",
4
+ "version": "1.5.2",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "capitalize": "^2.0.4",
83
83
  "console": "^0.7.2",
84
- "electron": "^28.2.0",
84
+ "electron": "^28.2.1",
85
85
  "electron-prompt": "^1.7.0",
86
86
  "electron-squirrel-startup": "^1.0.0",
87
87
  "electron-tabs": "^1.0.4",
@@ -98,8 +98,9 @@
98
98
  "qtip2": "^3.0.3",
99
99
  "spectrum-colorpicker2": "^2.0.10",
100
100
  "string-similarity": "^4.0.4",
101
+ "tweakpane": "^3.1.10",
101
102
  "update-electron-app": "^3.0.0",
102
- "x_ite": "^9.2.2"
103
+ "x_ite": "^9.2.4"
103
104
  },
104
105
  "config": {
105
106
  "forge": {
@@ -56,6 +56,15 @@ module .exports = class Dashboard extends Interface
56
56
  .text ("wb_twilight")
57
57
  .appendTo (this .toolbar)
58
58
  .on ("click", () => this .straighten (!this .browser .getBrowserOption ("StraightenHorizon")));
59
+
60
+ $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
61
+
62
+ this .showPanelsButton = $("<span></span>")
63
+ .addClass (["material-symbols-outlined"])
64
+ .attr ("title", _("Toggle visibility of node panel."))
65
+ .text ("edit_note")
66
+ .appendTo (this .toolbar)
67
+ .on ("click", () => this .togglePanel ());
59
68
  }
60
69
 
61
70
  configure ()
@@ -63,11 +72,15 @@ module .exports = class Dashboard extends Interface
63
72
  this .fileConfig .setDefaultValues ({
64
73
  pointer: "hand",
65
74
  play: false,
75
+ panel: false,
66
76
  });
67
77
 
68
78
  this [this .fileConfig .pointer] ();
69
79
  this .play (this .fileConfig .play);
70
80
  this .straighten (this .browser .getBrowserOption ("StraightenHorizon"));
81
+
82
+ if (this .panel || this .fileConfig .panel)
83
+ this .togglePanel (!this .fileConfig .panel);
71
84
  }
72
85
 
73
86
  hand ()
@@ -156,5 +169,25 @@ module .exports = class Dashboard extends Interface
156
169
  else
157
170
  this .straightenButton .removeClass ("active");
158
171
  }
172
+
173
+ togglePanel (visible)
174
+ {
175
+ this .panel = require ("../Editors/Panel");
176
+
177
+ visible ??= this .panel .visible;
178
+
179
+ if (visible)
180
+ {
181
+ this .panel .hide ();
182
+ this .showPanelsButton .removeClass ("active");
183
+ }
184
+ else
185
+ {
186
+ this .panel .show ();
187
+ this .showPanelsButton .addClass ("active");
188
+ }
189
+
190
+ this .fileConfig .panel = !visible;
191
+ }
159
192
  };
160
193
 
@@ -1,4 +1,4 @@
1
- "use strict"
1
+ "use strict";
2
2
 
3
3
  const
4
4
  $ = require ("jquery"),
@@ -6,11 +6,11 @@ const
6
6
  md5 = require ("md5"),
7
7
  X3D = require ("../X3D"),
8
8
  CSS = require ("../Application/CSS"),
9
- DataStorage = require ("./DataStorage")
9
+ DataStorage = require ("./DataStorage");
10
10
 
11
- require ("../Tools")
12
- require ("../Bits/Highlight")
13
- require ("../Bits/Beep")
11
+ require ("../Tools");
12
+ require ("../Bits/Highlight");
13
+ require ("../Bits/Beep");
14
14
 
15
15
  Object .assign ($,
16
16
  {
@@ -1,45 +1,104 @@
1
- module .exports = new class Selection
1
+ const Interface = require ("./Interface");
2
+
3
+ module .exports = new class Selection extends Interface
2
4
  {
3
5
  constructor ()
4
6
  {
5
- this .nodes = new Map ();
7
+ super ("Sunrize.Selection.");
8
+
9
+ this .nodes = [ ];
10
+
11
+ this .setup ();
12
+ }
13
+
14
+ configure ()
15
+ {
16
+ this .clear ();
6
17
  }
7
18
 
8
19
  has (node)
9
20
  {
10
- return this .nodes .has (node .valueOf ());
21
+ return this .nodes .includes (node .valueOf ());
22
+ }
23
+
24
+ clear ()
25
+ {
26
+ this .#clear ();
27
+ this .processInterests ();
28
+ }
29
+
30
+ set (node)
31
+ {
32
+ this .#clear (node);
33
+ this .#add (node);
34
+ this .processInterests ();
35
+ }
36
+
37
+ add (node)
38
+ {
39
+ this .#add (node);
40
+ this .processInterests ();
41
+ }
42
+
43
+ remove (node)
44
+ {
45
+ this .#remove (node);
46
+ this .processInterests ();
11
47
  }
12
48
 
13
- clear (exclude /* private option */)
49
+ #clear (exclude)
14
50
  {
15
- for (const node of this .nodes .keys ())
51
+ exclude = exclude ?.valueOf ();
52
+
53
+ for (const node of this .nodes)
16
54
  {
17
- if (node === exclude ?.valueOf ())
55
+ if (node === exclude)
18
56
  continue;
19
57
 
20
58
  node .getTool () ?.setSelected (false);
21
59
  node .removeTool ("createOnSelection");
22
60
  }
23
61
 
24
- this .nodes .clear ();
62
+ this .nodes = this .nodes .filter (n => n === exclude);
25
63
  }
26
64
 
27
- set (node)
65
+ #add (node)
28
66
  {
29
- this .clear (node);
30
- this .add (node);
31
- }
67
+ node = node .valueOf ();
32
68
 
33
- add (node)
34
- {
35
- this .nodes .set (node .valueOf (), node .addTool ("createOnSelection"));
69
+ node .addTool ("createOnSelection");
36
70
  node .getTool () ?.setSelected (true);
71
+
72
+ this .nodes = this .nodes .filter (n => n !== node);
73
+
74
+ this .nodes .push (node);
37
75
  }
38
76
 
39
- remove (node)
77
+ #remove (node)
40
78
  {
79
+ node = node .valueOf ();
80
+
41
81
  node .getTool () ?.setSelected (false);
42
82
  node .removeTool ("createOnSelection");
43
- this .nodes .delete (node .valueOf ());
83
+
84
+ this .nodes = this .nodes .filter (n => n !== node);
85
+ }
86
+
87
+ interests = new Map ();
88
+
89
+ addInterest (key, callback)
90
+ {
91
+ this .interests .set (key, callback);
92
+ }
93
+
94
+ removeInterest (key)
95
+ {
96
+ this .interests .delete (key);
97
+ }
98
+
99
+ processInterests ()
100
+ {
101
+ for (const callback of this .interests .values ())
102
+ callback ();
44
103
  }
45
104
  }
@@ -0,0 +1,12 @@
1
+ const
2
+ $ = require ("jquery"),
3
+ fs = require ("fs"),
4
+ path = require ("path");
5
+
6
+ const X3DUOM = $($.parseXML (fs .readFileSync (path .join (__dirname, "..", "assets", "x3duom.xml"), "utf-8")));
7
+
8
+ // emissiveColor fix
9
+ X3DUOM .find (`AbstractNodeType[name=X3DOneSidedMaterialNode]`)
10
+ .append (X3DUOM .find ("field[name=emissiveColor]") .first () .clone ());
11
+
12
+ module .exports = X3DUOM;
@@ -1,18 +1,18 @@
1
- "use strict"
1
+ "use strict";
2
2
 
3
3
  const
4
- Interface = require ("../Application/Interface")
4
+ Interface = require ("../Application/Interface");
5
5
 
6
6
  module .exports = class NodeInspector extends Interface
7
7
  {
8
8
  constructor (element)
9
9
  {
10
- super (`Sunrize.NodeInspector.${element .attr ("id")}.`)
10
+ super (`Sunrize.NodeInspector.${element .attr ("id")}.`);
11
11
 
12
- this .nodeInspector = element
12
+ this .nodeInspector = element;
13
13
 
14
- this .nodeInspector .text ("Node Inspector")
14
+ this .nodeInspector .text ("Node Inspector");
15
15
 
16
- this .setup ()
16
+ this .setup ();
17
17
  }
18
- }
18
+ };
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  const
4
- $ = require ("jquery"),
5
- electron = require ("electron"),
6
- fs = require ("fs"),
7
- path = require ("path"),
8
- util = require ("util"),
9
- jstree = require ("jstree"),
10
- X3D = require ("../X3D"),
11
- Interface = require ("../Application/Interface"),
12
- ActionKeys = require ("../Application/ActionKeys"),
13
- Traverse = require ("../Application/Traverse"),
14
- _ = require ("../Application/GetText");
4
+ $ = require ("jquery"),
5
+ electron = require ("electron"),
6
+ util = require ("util"),
7
+ jstree = require ("jstree"),
8
+ X3D = require ("../X3D"),
9
+ Interface = require ("../Application/Interface"),
10
+ ActionKeys = require ("../Application/ActionKeys"),
11
+ Traverse = require ("../Application/Traverse"),
12
+ X3DUOM = require ("../Bits/X3DUOM"),
13
+ _ = require ("../Application/GetText");
15
14
 
16
15
  const
17
16
  _expanded = Symbol (),
@@ -31,7 +30,6 @@ module .exports = class OutlineView extends Interface
31
30
  this .objects = new Map (); // <id, node>
32
31
  this .actionKeys = new ActionKeys ("OutlineView");
33
32
  this .onDemandToolNodes = new Set ();
34
- this .x3duom = $($.parseXML (fs .readFileSync (path .join (__dirname, "..", "assets", "x3duom.xml"), "utf-8")));
35
33
 
36
34
  this .globalConfig .setDefaultValues ({
37
35
  expandExternProtoDeclarations: true,
@@ -1577,7 +1575,7 @@ module .exports = class OutlineView extends Interface
1577
1575
  if (!node)
1578
1576
  return;
1579
1577
 
1580
- const description = this .x3duom .find (`ConcreteNode[name="${node .getTypeName ()}"] InterfaceDefinition`) .attr ("appinfo");
1578
+ const description = X3DUOM .find (`ConcreteNode[name=${node .getTypeName ()}] InterfaceDefinition`) .attr ("appinfo");
1581
1579
 
1582
1580
  let title = "";
1583
1581
 
@@ -1594,7 +1592,7 @@ module .exports = class OutlineView extends Interface
1594
1592
  element = $(event .currentTarget) .closest (".field, .special", this .sceneGraph),
1595
1593
  node = this .objects .get (parseInt (element .attr ("node-id"))),
1596
1594
  field = this .objects .get (parseInt (element .attr ("field-id"))),
1597
- description = this .x3duom .find (`ConcreteNode[name="${node .getTypeName ()}"] field[name="${field .getName ()}"]`) .attr ("description");
1595
+ description = X3DUOM .find (`ConcreteNode[name=${node .getTypeName ()}] field[name=${field .getName ()}]`) .attr ("description");
1598
1596
 
1599
1597
  let title = "";
1600
1598
 
@@ -2829,14 +2827,14 @@ module .exports = class OutlineView extends Interface
2829
2827
  {
2830
2828
  const
2831
2829
  selection = require ("../Application/Selection"),
2832
- nodes = this .sceneGraph .find (".primary, .selected")
2830
+ nodes = this .sceneGraph .find (".primary, .selected");
2833
2831
 
2834
- nodes .removeClass (["primary", "manually", "selected"])
2832
+ nodes .removeClass (["primary", "manually", "selected"]);
2835
2833
 
2836
2834
  for (const element of nodes)
2837
- this .getNode ($(element)) .setUserData (_selected, false)
2835
+ this .getNode ($(element)) .setUserData (_selected, false);
2838
2836
 
2839
- selection .clear ()
2837
+ selection .clear ();
2840
2838
  }
2841
2839
 
2842
2840
  toggleVisibility (event)
@@ -2940,7 +2938,7 @@ module .exports = class OutlineView extends Interface
2940
2938
 
2941
2939
  const selection = require ("../Application/Selection");
2942
2940
 
2943
- Traverse .traverse ([... selection .nodes .values ()], Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES | Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES, node =>
2941
+ Traverse .traverse (selection .nodes, Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES | Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES, node =>
2944
2942
  {
2945
2943
  if (!node .setHidden)
2946
2944
  return
@@ -2961,7 +2959,7 @@ module .exports = class OutlineView extends Interface
2961
2959
  {
2962
2960
  const selection = require ("../Application/Selection")
2963
2961
 
2964
- Traverse .traverse (selection .nodes .size ? [... selection .nodes .values ()] : this .executionContext, Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES | Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES, node =>
2962
+ Traverse .traverse (selection .nodes .length ? selection .nodes : this .executionContext, Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES | Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES, node =>
2965
2963
  {
2966
2964
  if (!node .setHidden)
2967
2965
  return