sunrize 1.7.45 → 1.7.46
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.
|
|
4
|
+
"version": "1.7.46",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -78,19 +78,19 @@
|
|
|
78
78
|
"url": "https://patreon.com/X_ITE"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@electron-forge/cli": "^7.6.
|
|
82
|
-
"@electron-forge/maker-deb": "^7.6.
|
|
83
|
-
"@electron-forge/maker-dmg": "^7.6.
|
|
84
|
-
"@electron-forge/maker-rpm": "^7.6.
|
|
85
|
-
"@electron-forge/maker-squirrel": "^7.6.
|
|
86
|
-
"@electron-forge/maker-zip": "^7.6.
|
|
87
|
-
"@electron-forge/publisher-github": "^7.6.
|
|
81
|
+
"@electron-forge/cli": "^7.6.1",
|
|
82
|
+
"@electron-forge/maker-deb": "^7.6.1",
|
|
83
|
+
"@electron-forge/maker-dmg": "^7.6.1",
|
|
84
|
+
"@electron-forge/maker-rpm": "^7.6.1",
|
|
85
|
+
"@electron-forge/maker-squirrel": "^7.6.1",
|
|
86
|
+
"@electron-forge/maker-zip": "^7.6.1",
|
|
87
|
+
"@electron-forge/publisher-github": "^7.6.1",
|
|
88
88
|
"shell-tools": "^1.1.9"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"capitalize": "^2.0.4",
|
|
92
92
|
"console": "^0.7.2",
|
|
93
|
-
"electron": "^34.0.
|
|
93
|
+
"electron": "^34.0.1",
|
|
94
94
|
"electron-prompt": "^1.7.0",
|
|
95
95
|
"electron-squirrel-startup": "^1.0.1",
|
|
96
96
|
"electron-tabs": "^1.0.4",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"jquery": "^3.7.1",
|
|
99
99
|
"jquery-ui-dist": "^1.13.3",
|
|
100
100
|
"jstree": "^3.3.17",
|
|
101
|
-
"material-icons": "^1.13.
|
|
102
|
-
"material-symbols": "^0.
|
|
101
|
+
"material-icons": "^1.13.13",
|
|
102
|
+
"material-symbols": "^0.28.0",
|
|
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.1.0",
|
|
112
|
-
"x_ite": "^11.0.
|
|
112
|
+
"x_ite": "^11.0.6",
|
|
113
113
|
"x3d-traverse": "^1.0.9"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -2,6 +2,49 @@ const X3D = require ("../../X3D");
|
|
|
2
2
|
|
|
3
3
|
Object .assign (X3D .IndexedFaceSet .prototype,
|
|
4
4
|
{
|
|
5
|
+
toIndexedTriangleSet (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = executionContext .createNode ("IndexedTriangleSet", false);
|
|
8
|
+
|
|
9
|
+
geometry ._metadata = this ._metadata;
|
|
10
|
+
geometry ._solid = this ._solid;
|
|
11
|
+
geometry ._ccw = this ._ccw;
|
|
12
|
+
geometry ._colorPerVertex = this ._colorPerVertex;
|
|
13
|
+
geometry ._normalPerVertex = this ._normalPerVertex;
|
|
14
|
+
geometry ._attrib = this ._attrib;
|
|
15
|
+
geometry ._fogCoord = this ._fogCoord;
|
|
16
|
+
geometry ._coord = this ._coord;
|
|
17
|
+
|
|
18
|
+
if (!this ._colorIndex .length || this ._colorIndex .equals (this ._coordIndex))
|
|
19
|
+
{
|
|
20
|
+
geometry ._color = this ._color;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!this ._texCoordIndex .length || this ._texCoordIndex .equals (this ._coordIndex))
|
|
24
|
+
{
|
|
25
|
+
geometry ._texCoord = this ._texCoord;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!this ._normalIndex .length || this ._normalIndex .equals (this ._coordIndex))
|
|
29
|
+
{
|
|
30
|
+
geometry ._tangent = this ._tangent;
|
|
31
|
+
geometry ._normal = this ._normal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const polygons = this .triangulate ();
|
|
35
|
+
|
|
36
|
+
for (const { triangles } of polygons)
|
|
37
|
+
{
|
|
38
|
+
for (const i of triangles)
|
|
39
|
+
{
|
|
40
|
+
geometry ._index .push (this ._coordIndex [i]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
geometry .setup ();
|
|
45
|
+
|
|
46
|
+
return geometry;
|
|
47
|
+
},
|
|
5
48
|
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
49
|
{
|
|
7
50
|
const geometry = executionContext .createNode ("IndexedLineSet", false);
|
|
@@ -16,7 +59,10 @@ Object .assign (X3D .IndexedFaceSet .prototype,
|
|
|
16
59
|
if (this ._normalPerVertex .getValue ())
|
|
17
60
|
{
|
|
18
61
|
if (!this ._normalIndex .length || this ._normalIndex .equals (this ._coordIndex))
|
|
19
|
-
|
|
62
|
+
{
|
|
63
|
+
geometry ._tangent = this ._tangent;
|
|
64
|
+
geometry ._normal = this ._normal;
|
|
65
|
+
}
|
|
20
66
|
}
|
|
21
67
|
|
|
22
68
|
// The coord index must end with -1!
|
|
@@ -2,6 +2,12 @@ const X3D = require ("../../X3D");
|
|
|
2
2
|
|
|
3
3
|
Object .assign (X3D .X3DGeometryNode .prototype,
|
|
4
4
|
{
|
|
5
|
+
/**
|
|
6
|
+
* Converts any line geometry to IndexedLineSet.
|
|
7
|
+
* @param {X3D .X3DExecutionContext} executionContext
|
|
8
|
+
* @param {object} options
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
5
11
|
toIndexedLineSet (executionContext = this .getExecutionContext (), options = { })
|
|
6
12
|
{
|
|
7
13
|
const geometry = executionContext .createNode ("IndexedLineSet", false);
|
|
@@ -53,6 +59,12 @@ Object .assign (X3D .X3DGeometryNode .prototype,
|
|
|
53
59
|
|
|
54
60
|
return geometry;
|
|
55
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* Converts any polygon geometry to IndexedFaceSet.
|
|
64
|
+
* @param {X3D .X3DExecutionContext} executionContext
|
|
65
|
+
* @param {object} options
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
56
68
|
toIndexedFaceSet (executionContext = this .getExecutionContext (), options = { })
|
|
57
69
|
{
|
|
58
70
|
const geometry = executionContext .createNode ("IndexedFaceSet", false);
|
|
@@ -392,14 +392,23 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
392
392
|
}
|
|
393
393
|
case X3D .X3DConstants .X3DGeometryNode:
|
|
394
394
|
{
|
|
395
|
-
if (
|
|
396
|
-
|
|
395
|
+
if (node .toIndexedTriangleSet)
|
|
396
|
+
{
|
|
397
|
+
menu .push (
|
|
398
|
+
{
|
|
399
|
+
label: _("Convert Node to IndexedTriangleSet"),
|
|
400
|
+
args: ["toIndexedTriangleSet", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
401
|
+
});
|
|
402
|
+
}
|
|
397
403
|
|
|
398
|
-
|
|
404
|
+
if (node .toPrimitive)
|
|
399
405
|
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
406
|
+
menu .push (
|
|
407
|
+
{
|
|
408
|
+
label: _("Convert Node to Next Lower Geometry Type"),
|
|
409
|
+
args: ["toPrimitive", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
410
|
+
});
|
|
411
|
+
}
|
|
403
412
|
|
|
404
413
|
continue;
|
|
405
414
|
}
|
|
@@ -1716,12 +1725,36 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1716
1725
|
|
|
1717
1726
|
if (normalPerVertex)
|
|
1718
1727
|
{
|
|
1719
|
-
|
|
1728
|
+
const creaseAngle = X3D .Algorithm .clamp (node ._creaseAngle .getValue (), 0, Math .PI);
|
|
1729
|
+
|
|
1730
|
+
if (Math .abs (creaseAngle - Math .PI) < 0.1)
|
|
1720
1731
|
{
|
|
1721
|
-
|
|
1722
|
-
|
|
1732
|
+
for (const [i, index] of coordIndex .entries ())
|
|
1733
|
+
{
|
|
1734
|
+
if (index < 0)
|
|
1735
|
+
continue;
|
|
1736
|
+
|
|
1737
|
+
vector [index] = normals [i];
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
else
|
|
1741
|
+
{
|
|
1742
|
+
const normalIndex = new X3D .MFInt32 ();
|
|
1743
|
+
|
|
1744
|
+
for (const [i, index] of coordIndex .entries ())
|
|
1745
|
+
{
|
|
1746
|
+
if (index < 0)
|
|
1747
|
+
{
|
|
1748
|
+
normalIndex .push (-1);
|
|
1749
|
+
}
|
|
1750
|
+
else
|
|
1751
|
+
{
|
|
1752
|
+
normalIndex .push (vector .length);
|
|
1753
|
+
vector .push (normals [i]);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1723
1756
|
|
|
1724
|
-
|
|
1757
|
+
Editor .setFieldValue (executionContext, node, node ._normalIndex, normalIndex);
|
|
1725
1758
|
}
|
|
1726
1759
|
}
|
|
1727
1760
|
else
|
|
@@ -1823,6 +1856,45 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1823
1856
|
UndoManager .shared .endUndo ();
|
|
1824
1857
|
}
|
|
1825
1858
|
|
|
1859
|
+
toIndexedTriangleSet (id, executionContextId, nodeId)
|
|
1860
|
+
{
|
|
1861
|
+
const
|
|
1862
|
+
element = $(`#${id}`),
|
|
1863
|
+
executionContext = this .objects .get (executionContextId),
|
|
1864
|
+
parentFieldElement = element .closest (".field, .scene", this .sceneGraph),
|
|
1865
|
+
parentNodeElement = parentFieldElement .closest (".node, .proto, .scene", this .sceneGraph),
|
|
1866
|
+
parentNode = this .getNode (parentNodeElement),
|
|
1867
|
+
parentField = parentFieldElement .hasClass ("scene") ? parentNode .rootNodes : this .getField (parentFieldElement),
|
|
1868
|
+
node = this .objects .get (nodeId),
|
|
1869
|
+
primitive = node .toIndexedTriangleSet (executionContext),
|
|
1870
|
+
index = parseInt (element .attr ("index"));
|
|
1871
|
+
|
|
1872
|
+
UndoManager .shared .beginUndo (_("Convert Node to IndexedTriangleSet"));
|
|
1873
|
+
|
|
1874
|
+
if (node .getName ())
|
|
1875
|
+
Editor .updateNamedNode (executionContext, executionContext .getUniqueName (node .getName ()), primitive);
|
|
1876
|
+
|
|
1877
|
+
switch (parentField .getType ())
|
|
1878
|
+
{
|
|
1879
|
+
case X3D .X3DConstants .SFNode:
|
|
1880
|
+
{
|
|
1881
|
+
Editor .setFieldValue (executionContext, parentNode, parentField, primitive);
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
case X3D .X3DConstants .MFNode:
|
|
1885
|
+
{
|
|
1886
|
+
Editor .removeValueFromArray (executionContext, parentNode, parentField, index);
|
|
1887
|
+
Editor .insertValueIntoArray (executionContext, parentNode, parentField, index, primitive);
|
|
1888
|
+
break;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
UndoManager .shared .endUndo ();
|
|
1893
|
+
|
|
1894
|
+
if (element .hasClass ("selected"))
|
|
1895
|
+
require ("../Application/Selection") .add (primitive);
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1826
1898
|
toPrimitive (id, executionContextId, nodeId)
|
|
1827
1899
|
{
|
|
1828
1900
|
const
|
|
@@ -174,8 +174,8 @@ module .exports = class ScriptEditor extends Interface
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
if (this .
|
|
178
|
-
this .
|
|
177
|
+
if (this .editor)
|
|
178
|
+
this .editor .viewState = this .editor .saveViewState ();
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
this .node = node;
|
|
@@ -186,12 +186,12 @@ module .exports = class ScriptEditor extends Interface
|
|
|
186
186
|
|
|
187
187
|
this .nodeName .renameNodeInput (this .node);
|
|
188
188
|
this .applyButton .show ();
|
|
189
|
-
this .
|
|
189
|
+
this .monaco ?.detach ();
|
|
190
190
|
|
|
191
|
-
this .
|
|
192
|
-
this .
|
|
191
|
+
this .monaco = editor .element .appendTo (this .verticalSplitterRight);
|
|
192
|
+
this .editor = editor .editor;
|
|
193
193
|
|
|
194
|
-
this .
|
|
194
|
+
this .editor .restoreViewState (this .editor .viewState);
|
|
195
195
|
|
|
196
196
|
this .node ._url .addFieldCallback (this, this .set_url .bind (this));
|
|
197
197
|
this .node ._loadState .addFieldCallback (this, this .set_loadState .bind (this, editor .monaco));
|
|
@@ -228,10 +228,10 @@ module .exports = class ScriptEditor extends Interface
|
|
|
228
228
|
{
|
|
229
229
|
this .nodeName .renameNodeInput (null, null);
|
|
230
230
|
this .applyButton .hide ();
|
|
231
|
-
this .
|
|
231
|
+
this .monaco ?.detach ();
|
|
232
232
|
|
|
233
|
-
this .editor = null;
|
|
234
233
|
this .monaco = null;
|
|
234
|
+
this .editor = null;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -406,6 +406,17 @@ module .exports = class ScriptEditor extends Interface
|
|
|
406
406
|
editor .onDidFocusEditorWidget (() => this .setDeclarations (monaco));
|
|
407
407
|
editor .onDidBlurEditorWidget (() => this .apply ());
|
|
408
408
|
|
|
409
|
+
editor .onKeyDown ((event) =>
|
|
410
|
+
{
|
|
411
|
+
const { keyCode, ctrlKey, metaKey } = event;
|
|
412
|
+
|
|
413
|
+
if (keyCode === 52 && (metaKey || ctrlKey))
|
|
414
|
+
{
|
|
415
|
+
event .preventDefault ();
|
|
416
|
+
this .paste ();
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
409
420
|
editor .viewState = editor .saveViewState ();
|
|
410
421
|
|
|
411
422
|
element .on ("mouseenter", () => this .setDeclarations (monaco))
|
|
@@ -467,15 +478,15 @@ module .exports = class ScriptEditor extends Interface
|
|
|
467
478
|
{ type: "separator" },
|
|
468
479
|
{
|
|
469
480
|
label: _("Cut"),
|
|
470
|
-
args: ["
|
|
481
|
+
args: ["cutOrCopy", true],
|
|
471
482
|
},
|
|
472
483
|
{
|
|
473
484
|
label: _("Copy"),
|
|
474
|
-
args: ["
|
|
485
|
+
args: ["cutOrCopy", false],
|
|
475
486
|
},
|
|
476
487
|
{
|
|
477
488
|
label: _("Paste"),
|
|
478
|
-
args: ["
|
|
489
|
+
args: ["paste"],
|
|
479
490
|
},
|
|
480
491
|
{ type: "separator" },
|
|
481
492
|
{
|
|
@@ -489,7 +500,7 @@ module .exports = class ScriptEditor extends Interface
|
|
|
489
500
|
|
|
490
501
|
runAction (id)
|
|
491
502
|
{
|
|
492
|
-
this .
|
|
503
|
+
this .editor .getAction (id) .run ();
|
|
493
504
|
}
|
|
494
505
|
|
|
495
506
|
debugFindActions (editor = this .editor)
|
|
@@ -541,9 +552,60 @@ module .exports = class ScriptEditor extends Interface
|
|
|
541
552
|
}
|
|
542
553
|
}
|
|
543
554
|
|
|
544
|
-
execCommand (command)
|
|
555
|
+
// execCommand (command)
|
|
556
|
+
// {
|
|
557
|
+
// document .execCommand (command);
|
|
558
|
+
// }
|
|
559
|
+
|
|
560
|
+
cutOrCopy (cut)
|
|
561
|
+
{
|
|
562
|
+
this .editor .focus ();
|
|
563
|
+
|
|
564
|
+
// Get the current selection in the editor.
|
|
565
|
+
const selection = this .editor .getSelection ();
|
|
566
|
+
|
|
567
|
+
if (!selection || selection .isEmpty ())
|
|
568
|
+
{
|
|
569
|
+
navigator .clipboard .writeText ("");
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// Get the text from that selection.
|
|
574
|
+
const data = this .editor .getModel () ?.getValueInRange (selection);
|
|
575
|
+
|
|
576
|
+
// Set the clipboard contents.
|
|
577
|
+
navigator .clipboard .writeText (data || "");
|
|
578
|
+
|
|
579
|
+
if (!cut)
|
|
580
|
+
return;
|
|
581
|
+
|
|
582
|
+
// This is a cut operation, so replace the selection with an empty string.
|
|
583
|
+
this .editor .executeEdits ("clipboard", [{
|
|
584
|
+
range: selection,
|
|
585
|
+
text: "",
|
|
586
|
+
forceMoveMarkers: true,
|
|
587
|
+
}]);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async paste ()
|
|
545
591
|
{
|
|
546
|
-
|
|
592
|
+
this .editor .focus ();
|
|
593
|
+
|
|
594
|
+
// Get the current clipboard contents
|
|
595
|
+
const text = await navigator .clipboard .readText ();
|
|
596
|
+
|
|
597
|
+
// Get the current selection in the editor.
|
|
598
|
+
const selection = this .editor .getSelection ();
|
|
599
|
+
|
|
600
|
+
if (!selection)
|
|
601
|
+
return;
|
|
602
|
+
|
|
603
|
+
// Replace the current contents with the text from the clipboard.
|
|
604
|
+
this .editor .executeEdits ("clipboard", [{
|
|
605
|
+
range: selection,
|
|
606
|
+
text: text,
|
|
607
|
+
forceMoveMarkers: true,
|
|
608
|
+
}]);
|
|
547
609
|
}
|
|
548
610
|
|
|
549
611
|
create ()
|
|
@@ -649,11 +711,11 @@ main ()
|
|
|
649
711
|
if (!this .node)
|
|
650
712
|
return;
|
|
651
713
|
|
|
652
|
-
if (!this .
|
|
714
|
+
if (!this .editor)
|
|
653
715
|
return;
|
|
654
716
|
|
|
655
717
|
const
|
|
656
|
-
string = this .
|
|
718
|
+
string = this .editor .getModel () .getValue (),
|
|
657
719
|
value = this .node ._url .toSpliced (0, 1, Editor .encodeURI (string));
|
|
658
720
|
|
|
659
721
|
if (this .node ._url .equals (value))
|
|
@@ -666,7 +728,7 @@ main ()
|
|
|
666
728
|
|
|
667
729
|
set_url ()
|
|
668
730
|
{
|
|
669
|
-
this .
|
|
731
|
+
this .editor .getModel () .setValue (Editor .decodeURI (this .node ._url [0]));
|
|
670
732
|
}
|
|
671
733
|
|
|
672
734
|
set_loadState (monaco)
|