sunrize 2.0.2 → 2.0.4
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.0.
|
|
4
|
+
"version": "2.0.4",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@vscode/codicons": "^0.0.44",
|
|
92
92
|
"capitalize": "^2.0.4",
|
|
93
93
|
"console": "^0.7.2",
|
|
94
|
-
"electron": "^40.
|
|
94
|
+
"electron": "^40.6.0",
|
|
95
95
|
"electron-prompt": "^1.7.0",
|
|
96
96
|
"electron-squirrel-startup": "^1.0.1",
|
|
97
97
|
"electron-tabs": "^1.0.4",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"string-similarity": "^4.0.4",
|
|
111
111
|
"tweakpane": "^3.1.10",
|
|
112
112
|
"update-electron-app": "^3.1.2",
|
|
113
|
-
"x_ite": "^14.0.
|
|
113
|
+
"x_ite": "^14.0.4",
|
|
114
114
|
"x3d-traverse": "^1.0.22"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -351,6 +351,15 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
351
351
|
|
|
352
352
|
continue;
|
|
353
353
|
}
|
|
354
|
+
case X3D .X3DConstants .Normal:
|
|
355
|
+
{
|
|
356
|
+
menu .push ({
|
|
357
|
+
label: _("Negate Normal Vectors"),
|
|
358
|
+
args: ["negateNormalVectors", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
354
363
|
case X3D .X3DConstants .X3DPrototypeInstance:
|
|
355
364
|
{
|
|
356
365
|
if (!$.try (() => node .getInnerNode ()))
|
|
@@ -1413,6 +1422,22 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1413
1422
|
UndoManager .shared .endUndo ();
|
|
1414
1423
|
}
|
|
1415
1424
|
|
|
1425
|
+
async negateNormalVectors (id, executionContextId, nodeId)
|
|
1426
|
+
{
|
|
1427
|
+
const
|
|
1428
|
+
executionContext = this .objects .get (executionContextId),
|
|
1429
|
+
normalNode = this .objects .get (nodeId),
|
|
1430
|
+
normals = normalNode ._vector .map (v => v .negate ());
|
|
1431
|
+
|
|
1432
|
+
// Add undo step.
|
|
1433
|
+
|
|
1434
|
+
UndoManager .shared .beginUndo (_("Negate Normal Vectors"));
|
|
1435
|
+
|
|
1436
|
+
Editor .setFieldValue (executionContext, normalNode, normalNode ._vector, normals);
|
|
1437
|
+
|
|
1438
|
+
UndoManager .shared .endUndo ();
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1416
1441
|
async convertPixelTextureToImageTexture (id, executionContextId, nodeId)
|
|
1417
1442
|
{
|
|
1418
1443
|
const
|
|
@@ -1917,6 +1917,37 @@ module .exports = class OutlineView extends Interface
|
|
|
1917
1917
|
if (description)
|
|
1918
1918
|
title += `Description:\n\n${description}`;
|
|
1919
1919
|
|
|
1920
|
+
for (const type of node .getType () .toReversed ())
|
|
1921
|
+
{
|
|
1922
|
+
switch (type)
|
|
1923
|
+
{
|
|
1924
|
+
case X3D .X3DConstants .X3DGeometryNode:
|
|
1925
|
+
{
|
|
1926
|
+
const numVertices = node .getVertices () .length / 4;
|
|
1927
|
+
|
|
1928
|
+
title += "\n\n";
|
|
1929
|
+
|
|
1930
|
+
switch (node .getGeometryType ())
|
|
1931
|
+
{
|
|
1932
|
+
case 0:
|
|
1933
|
+
title += `Number of Points: ${(numVertices) .toLocaleString (_.locale)}`;
|
|
1934
|
+
break
|
|
1935
|
+
case 1:
|
|
1936
|
+
title += `Number of Lines: ${(numVertices / 2) .toLocaleString (_.locale)}`;
|
|
1937
|
+
break
|
|
1938
|
+
case 2:
|
|
1939
|
+
case 3:
|
|
1940
|
+
title += `Number of Triangles: ${(numVertices / 3) .toLocaleString (_.locale)}`;
|
|
1941
|
+
break
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
continue;
|
|
1945
|
+
}
|
|
1946
|
+
default:
|
|
1947
|
+
continue;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1920
1951
|
return title;
|
|
1921
1952
|
}
|
|
1922
1953
|
|
|
@@ -37,7 +37,7 @@ module .exports = new class SceneProperties extends Dialog
|
|
|
37
37
|
|
|
38
38
|
this .tabs .addTextTab ("profile-and-components", _("Profile & Components"));
|
|
39
39
|
this .tabs .addTextTab ("units", _("Units"));
|
|
40
|
-
this .tabs .addTextTab ("meta-data", _("
|
|
40
|
+
this .tabs .addTextTab ("meta-data", _("Metadata"));
|
|
41
41
|
this .tabs .addTextTab ("world-info", _("World Info"));
|
|
42
42
|
|
|
43
43
|
this .tabs .setup ();
|
package/src/Undo/Editor.js
CHANGED
|
@@ -616,6 +616,9 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
|
|
619
|
+
if (node ._url .equals (newURL))
|
|
620
|
+
return;
|
|
621
|
+
|
|
619
622
|
const uniqueURL = new X3D .MFString (... new Set (newURL));
|
|
620
623
|
|
|
621
624
|
this .setFieldValue (executionContext, node, node ._url, uniqueURL, undoManager);
|
|
@@ -675,16 +678,19 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
675
678
|
*/
|
|
676
679
|
static getUsedComponents (scene)
|
|
677
680
|
{
|
|
678
|
-
const components = new
|
|
681
|
+
const components = new Map ();
|
|
679
682
|
|
|
680
683
|
for (const object of scene .traverse (Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES | Traverse .PROTOTYPE_INSTANCES))
|
|
681
684
|
{
|
|
682
685
|
if (!(object instanceof X3D .SFNode))
|
|
683
686
|
continue;
|
|
684
687
|
|
|
685
|
-
const
|
|
688
|
+
const
|
|
689
|
+
node = object .getValue (),
|
|
690
|
+
componentInfo = node .getComponentInfo ();
|
|
686
691
|
|
|
687
|
-
components .
|
|
692
|
+
if (components .get (componentInfo .name) ?? 0 < componentInfo .level)
|
|
693
|
+
components .set (componentInfo .name, componentInfo .level);
|
|
688
694
|
}
|
|
689
695
|
|
|
690
696
|
return components;
|
|
@@ -692,31 +698,46 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
692
698
|
|
|
693
699
|
static getProfileAndComponentsFromUsedComponents (browser, usedComponents)
|
|
694
700
|
{
|
|
695
|
-
const profiles = ["
|
|
701
|
+
const profiles = ["Interchange", "Interactive", "Immersive", "Full"] .map (name =>
|
|
696
702
|
{
|
|
697
|
-
return { profile: browser .getProfile (name), components: new
|
|
703
|
+
return { profile: browser .getProfile (name), components: new Map (usedComponents) };
|
|
698
704
|
});
|
|
699
705
|
|
|
700
|
-
profiles .forEach (
|
|
706
|
+
profiles .forEach (({ profile, components }) =>
|
|
701
707
|
{
|
|
702
|
-
for (const component of
|
|
703
|
-
|
|
708
|
+
for (const component of profile .components)
|
|
709
|
+
{
|
|
710
|
+
const level = components .get (component .name);
|
|
711
|
+
|
|
712
|
+
if (level === undefined)
|
|
713
|
+
continue;
|
|
714
|
+
|
|
715
|
+
if (level > component .level)
|
|
716
|
+
continue;
|
|
717
|
+
|
|
718
|
+
components .delete (component .name);
|
|
719
|
+
}
|
|
704
720
|
});
|
|
705
721
|
|
|
706
722
|
const min = profiles .reduce ((min, object) =>
|
|
707
723
|
{
|
|
708
|
-
const count =
|
|
724
|
+
const count = new Set ([
|
|
725
|
+
... [... object .profile .components] .map (component => component .name),
|
|
726
|
+
... object .components .keys ()
|
|
727
|
+
]) .size;
|
|
709
728
|
|
|
710
729
|
return min .count < count ? min : {
|
|
711
|
-
count
|
|
712
|
-
object
|
|
730
|
+
count,
|
|
731
|
+
object,
|
|
713
732
|
};
|
|
714
733
|
},
|
|
715
734
|
{ count: Number .POSITIVE_INFINITY });
|
|
716
735
|
|
|
717
736
|
return {
|
|
718
737
|
profile: min .object .profile,
|
|
719
|
-
components: Array .from (min .object .components
|
|
738
|
+
components: Array .from (min .object .components .keys ())
|
|
739
|
+
.sort ()
|
|
740
|
+
.map (name => browser .getComponent (name)),
|
|
720
741
|
};
|
|
721
742
|
}
|
|
722
743
|
|