sunrize 2.7.0 → 2.7.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": "2.7.0",
4
+ "version": "2.7.2",
5
5
  "description": "Sunrize — A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -106,7 +106,7 @@
106
106
  "@vscode/codicons": "^0.0.45",
107
107
  "capitalize": "^2.0.4",
108
108
  "console": "^0.7.2",
109
- "electron": "^45.3.2",
109
+ "electron": "^45.4.1",
110
110
  "electron-prompt": "^1.7.0",
111
111
  "electron-squirrel-startup": "^1.0.1",
112
112
  "electron-tabs": "^1.0.4",
@@ -124,7 +124,7 @@
124
124
  "string-similarity": "^4.0.4",
125
125
  "tweakpane": "^4.0.5",
126
126
  "update-electron-app": "^3.3.0",
127
- "x_ite": "^16.8.0",
127
+ "x_ite": "^16.8.1",
128
128
  "x_ite-off-parser": "^1.4.0",
129
129
  "x_ite-sog-parser": "^2.2.0",
130
130
  "x_ite-spz-parser": "^2.2.0",
@@ -571,7 +571,7 @@ module .exports = class Document extends Interface
571
571
  return;
572
572
  }
573
573
 
574
- fs .writeFile (this .filePath, Editor .getContents (scene, path .extname (this .filePath)), Function .prototype);
574
+ fs .writeFileSync (this .filePath, Editor .getContents (scene, path .extname (this .filePath)));
575
575
  }
576
576
  else
577
577
  {
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  const
4
- $ = require ("jquery"),
5
- path = require ("path"),
6
- X3D = require ("../X3D"),
7
- Editor = require ("../Undo/Editor"),
8
- UndoManager = require("../Undo/UndoManager"),
9
- _ = require ("../Application/GetText");
4
+ $ = require ("jquery"),
5
+ path = require ("path"),
6
+ X3D = require ("../X3D"),
7
+ Editor = require ("../Undo/Editor");
10
8
 
11
9
  require ("./Popover");
12
10
 
@@ -22,6 +20,7 @@ $.fn.materialPreviewPopover = async function (node)
22
20
  .attr ("splashScreen", "false")
23
21
  .attr ("contextMenu", "false")
24
22
  .attr ("notifications", "false")
23
+ .attr ("contentScale", "auto")
25
24
  .attr ("colorSpace", node .getBrowser () .getBrowserOption ("ColorSpace"))
26
25
  .attr ("xrSessionMode", "NONE")
27
26
  .appendTo (preview);
@@ -46,6 +46,7 @@ $.fn.texturePreviewPopover = async function (node)
46
46
  .attr ("splashScreen", "false")
47
47
  .attr ("contextMenu", "false")
48
48
  .attr ("notifications", "false")
49
+ .attr ("contentScale", "auto")
49
50
  .attr ("colorSpace", node .getBrowser () .getBrowserOption ("ColorSpace"))
50
51
  .attr ("xrSessionMode", "NONE")
51
52
  .appendTo (preview);
@@ -219,6 +219,10 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
219
219
  accelerator: "CmdOrCtrl+Backspace",
220
220
  args: ["deleteNodes"],
221
221
  },
222
+ {
223
+ label: _("Add Clone"),
224
+ args: ["addClone", element .attr ("id"), executionContext .getId (), node .getId ()],
225
+ },
222
226
  {
223
227
  label: _("Unlink Clone"),
224
228
  enabled: node .getCloneCount () > 1,
@@ -1169,6 +1173,19 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1169
1173
  UndoManager .shared .endUndo ();
1170
1174
  }
1171
1175
 
1176
+ addClone (id, executionContextId, nodeId)
1177
+ {
1178
+ const
1179
+ executionContext = this .objects .get (executionContextId),
1180
+ node = this .objects .get (nodeId);
1181
+
1182
+ UndoManager .shared .beginUndo (_("Add Clone"));
1183
+
1184
+ Editor .appendValueToArray (executionContext, executionContext, executionContext .rootNodes, node);
1185
+
1186
+ UndoManager .shared .endUndo ();
1187
+ }
1188
+
1172
1189
  unlinkClone (id, executionContextId, nodeId)
1173
1190
  {
1174
1191
  const
@@ -1735,7 +1752,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1735
1752
  data = dataURL .substring (dataURL .indexOf (isData ? "," : ":") + 1),
1736
1753
  buffer = Buffer .from (data, isData && match [3] === "base64" ? "base64" : "utf8");
1737
1754
 
1738
- fs .writeFile (response .filePath, buffer, Function .prototype);
1755
+ fs .writeFileSync (response .filePath, buffer);
1739
1756
 
1740
1757
  // Add undo step.
1741
1758
 
@@ -3265,7 +3282,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
3265
3282
 
3266
3283
  if (sourceExecutionContext !== destinationExecutionContext)
3267
3284
  {
3268
- event .originalEvent .dataTransfer .dropEffect = "none";
3285
+ event .originalEvent .dataTransfer .dropEffect = "copy";
3269
3286
  }
3270
3287
  else
3271
3288
  {
@@ -3275,42 +3292,42 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
3275
3292
  event .originalEvent .dataTransfer .dropEffect = "link";
3276
3293
  else
3277
3294
  event .originalEvent .dataTransfer .dropEffect = "move";
3295
+ }
3278
3296
 
3279
- if (destinationElement .is (".scene-graph"))
3280
- {
3281
- destinationElement .addClass ("drag-after");
3282
- }
3283
- else if (destinationElement .is (".scene, .root-nodes, .field[type-name*=Node]"))
3297
+ if (destinationElement .is (".scene-graph"))
3298
+ {
3299
+ destinationElement .addClass ("drag-after");
3300
+ }
3301
+ else if (destinationElement .is (".scene, .root-nodes, .field[type-name*=Node]"))
3302
+ {
3303
+ destinationElement .addClass ("drag-into");
3304
+ }
3305
+ else if (destinationElement .is (".node, .imported-node.instance"))
3306
+ {
3307
+ const
3308
+ item = destinationElement .find ("> .item"),
3309
+ y = event .pageY - destinationElement .offset () .top;
3310
+
3311
+ if (y < item .height () * 0.25)
3284
3312
  {
3285
- destinationElement .addClass ("drag-into");
3313
+ destinationElement .data ("drag-type", "drag-before");
3314
+ destinationElement .addClass ("drag-before");
3286
3315
  }
3287
- else if (destinationElement .is (".node, .imported-node.instance"))
3316
+ else if (y > destinationElement .height () - item .height () * 0.25)
3288
3317
  {
3289
- const
3290
- item = destinationElement .find ("> .item"),
3291
- y = event .pageY - destinationElement .offset () .top;
3292
-
3293
- if (y < item .height () * 0.25)
3294
- {
3295
- destinationElement .data ("drag-type", "drag-before");
3296
- destinationElement .addClass ("drag-before");
3297
- }
3298
- else if (y > destinationElement .height () - item .height () * 0.25)
3299
- {
3300
- destinationElement .data ("drag-type", "drag-after");
3301
- destinationElement .addClass ("drag-after");
3302
- }
3303
- else
3304
- {
3305
- destinationElement .data ("drag-type", "drag-into");
3306
- destinationElement .addClass ("drag-into");
3307
- }
3318
+ destinationElement .data ("drag-type", "drag-after");
3319
+ destinationElement .addClass ("drag-after");
3308
3320
  }
3309
3321
  else
3310
3322
  {
3311
- event .originalEvent .dataTransfer .dropEffect = "none";
3323
+ destinationElement .data ("drag-type", "drag-into");
3324
+ destinationElement .addClass ("drag-into");
3312
3325
  }
3313
3326
  }
3327
+ else
3328
+ {
3329
+ event .originalEvent .dataTransfer .dropEffect = "none";
3330
+ }
3314
3331
  }
3315
3332
  else if (event .originalEvent .dataTransfer .types .includes ("sunrize/field"))
3316
3333
  {
@@ -113,8 +113,6 @@ module .exports = class OutlineRouteGraph extends OutlineView
113
113
 
114
114
  updateRouteGraph ()
115
115
  {
116
- const canvases = this .sceneGraph .find (".route-curves");
117
-
118
116
  // Determine visible routes, those routes have a value of 2.
119
117
 
120
118
  const fields = new Map ();
@@ -130,6 +128,9 @@ module .exports = class OutlineRouteGraph extends OutlineView
130
128
  fields .set (route, (fields .get (route) ?? 0) + 1);
131
129
  }
132
130
 
131
+ this .sceneGraph .find (".field-routes, .single-route, .route-curves")
132
+ .css ("height", "");
133
+
133
134
  this .sceneGraph
134
135
  .find (".field-routes")
135
136
  .each ((i, canvas2d) => this .updateFieldRoutes ($(canvas2d), fields));
@@ -138,6 +139,8 @@ module .exports = class OutlineRouteGraph extends OutlineView
138
139
  .find (".single-route")
139
140
  .each ((i, canvas2d) => this .updateSingleRoute ($(canvas2d), fields));
140
141
 
142
+ const canvases = this .sceneGraph .find (".route-curves");
143
+
141
144
  this .updateRouteCurves (canvases, fields);
142
145
  }
143
146
 
@@ -1192,7 +1192,8 @@ module .exports = class OutlineView extends Interface
1192
1192
  node ._isActive .addFieldCallback (this .#updateNodePlaySymbol, this .updateNodePlay .bind (this, node));
1193
1193
  node ._isPaused .addFieldCallback (this .#updateNodePlaySymbol, this .updateNodePlay .bind (this, node));
1194
1194
  node ._loop .addFieldCallback (this .#updateNodePlaySymbol, this .updateNodePlay .bind (this, node));
1195
- node ._reverse .addFieldCallback (this .#updateNodePlaySymbol, this .updateNodePlay .bind (this, node));
1195
+
1196
+ node ._reverse ?.addFieldCallback (this .#updateNodePlaySymbol, this .updateNodePlay .bind (this, node));
1196
1197
 
1197
1198
  buttons .push ($("<span></span>")
1198
1199
  .attr ("order", "5")
@@ -1399,7 +1400,7 @@ module .exports = class OutlineView extends Interface
1399
1400
  .imported-node[node-id=${node .getId ()}],
1400
1401
  .exported-node[node-id=${node .getId ()}],
1401
1402
  .externproto[node-id=${node .getId ()}]`)
1402
- .find ("> .item .reload-node")
1403
+ .find ("> .item [action=reload-node]")
1403
1404
  .removeClass (["not-started-state", "in-progress-state", "complete-state", "failed-state"])
1404
1405
  .addClass (className);
1405
1406
  }
@@ -1434,13 +1435,16 @@ module .exports = class OutlineView extends Interface
1434
1435
  .removeClass (["on", "off"])
1435
1436
  .addClass (node ._loop .getValue () ? "on" : "off"));
1436
1437
 
1437
- buttons .push (this .sceneGraph
1438
- .find (`.node[node-id=${node .getId ()}],
1439
- .imported-node[node-id=${node .getId ()}],
1440
- .exported-node[node-id=${node .getId ()}]`)
1441
- .find ("> .item [action=reverse-node]")
1442
- .removeClass (["on", "off"])
1443
- .addClass (node ._reverse .getValue () ? "on" : "off"));
1438
+ if (node .getFieldDefinitions () .get ("reverse"))
1439
+ {
1440
+ buttons .push (this .sceneGraph
1441
+ .find (`.node[node-id=${node .getId ()}],
1442
+ .imported-node[node-id=${node .getId ()}],
1443
+ .exported-node[node-id=${node .getId ()}]`)
1444
+ .find ("> .item [action=reverse-node]")
1445
+ .removeClass (["on", "off"])
1446
+ .addClass (node ._reverse .getValue () ? "on" : "off"));
1447
+ }
1444
1448
 
1445
1449
  if (node ._enabled .getValue ())
1446
1450
  buttons .slice (-3) .forEach (button => button .show ());
@@ -2643,7 +2647,7 @@ module .exports = class OutlineView extends Interface
2643
2647
  }
2644
2648
  else
2645
2649
  {
2646
- textarea .attr ("disabled", "");
2650
+ textarea .attr ("readonly", "");
2647
2651
  }
2648
2652
 
2649
2653
  this .connectArrayField (textarea, node, field, false);
@@ -3180,7 +3184,8 @@ module .exports = class OutlineView extends Interface
3180
3184
  node ._isActive .removeFieldCallback (this .#updateNodePlaySymbol);
3181
3185
  node ._isPaused .removeFieldCallback (this .#updateNodePlaySymbol);
3182
3186
  node ._loop .removeFieldCallback (this .#updateNodePlaySymbol);
3183
- node ._reverse .removeFieldCallback (this .#updateNodePlaySymbol);
3187
+
3188
+ node ._reverse ?.removeFieldCallback (this .#updateNodePlaySymbol);
3184
3189
  continue;
3185
3190
  }
3186
3191
  case X3D .X3DConstants .X3DBindableNode:
@@ -81,12 +81,6 @@ class X3DTransformNodeTool extends X3DChildNodeTool
81
81
 
82
82
  beginUndo ()
83
83
  {
84
- if (this .isHidden ())
85
- return false;
86
-
87
- if (!this ._visible .getValue ())
88
- return false;
89
-
90
84
  if (!this .tool .undo)
91
85
  return false;
92
86
 
@@ -135,12 +129,6 @@ class X3DTransformNodeTool extends X3DChildNodeTool
135
129
 
136
130
  transformGroups ()
137
131
  {
138
- if (this .isHidden ())
139
- return;
140
-
141
- if (!this ._visible .getValue ())
142
- return;
143
-
144
132
  if (this .tool .group === "NONE")
145
133
  return;
146
134
 
@@ -161,12 +149,6 @@ class X3DTransformNodeTool extends X3DChildNodeTool
161
149
  if (other === this)
162
150
  continue;
163
151
 
164
- if (other .isHidden ())
165
- continue;
166
-
167
- if (!other ._visible .getValue ())
168
- continue;
169
-
170
152
  if (other .tool .group !== this .tool .group)
171
153
  continue;
172
154
 
@@ -2011,22 +2011,6 @@ body.light .console-output .selected {
2011
2011
  font-size: smaller;
2012
2012
  }
2013
2013
 
2014
- .scene-graph .not-started-state {
2015
- color: var(--text-color);
2016
- }
2017
-
2018
- .scene-graph .in-progress-state {
2019
- color: var(--system-yellow);
2020
- }
2021
-
2022
- .scene-graph .complete-state {
2023
- color: var(--system-green);
2024
- }
2025
-
2026
- .scene-graph .failed-state {
2027
- color: var(--system-red);
2028
- }
2029
-
2030
2014
  /* make drag & drop work */
2031
2015
  .scene-graph .last {
2032
2016
  overflow: hidden;
@@ -2313,6 +2297,22 @@ body.light .console-output .selected {
2313
2297
  top: 4px;
2314
2298
  }
2315
2299
 
2300
+ .scene-graph .not-started-state {
2301
+ color: var(--text-color);
2302
+ }
2303
+
2304
+ .scene-graph .in-progress-state {
2305
+ color: var(--system-yellow);
2306
+ }
2307
+
2308
+ .scene-graph .complete-state {
2309
+ color: var(--system-green);
2310
+ }
2311
+
2312
+ .scene-graph .failed-state {
2313
+ color: var(--system-red);
2314
+ }
2315
+
2316
2316
  /* Spectrum Color Picker */
2317
2317
 
2318
2318
  .sp-container {