sunrize 1.11.5 → 1.11.7
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.11.
|
|
4
|
+
"version": "1.11.7",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"shell-tools": "^1.1.9"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@vscode/codicons": "^0.0.
|
|
91
|
+
"@vscode/codicons": "^0.0.42",
|
|
92
92
|
"capitalize": "^2.0.4",
|
|
93
93
|
"console": "^0.7.2",
|
|
94
|
-
"electron": "^39.
|
|
94
|
+
"electron": "^39.1.2",
|
|
95
95
|
"electron-prompt": "^1.7.0",
|
|
96
96
|
"electron-squirrel-startup": "^1.0.1",
|
|
97
97
|
"electron-tabs": "^1.0.4",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"jquery-ui-dist": "^1.13.3",
|
|
101
101
|
"jstree": "^3.3.17",
|
|
102
102
|
"material-icons": "^1.13.14",
|
|
103
|
-
"material-symbols": "^0.39.
|
|
103
|
+
"material-symbols": "^0.39.2",
|
|
104
104
|
"md5": "^2.3.0",
|
|
105
105
|
"mime-types": "^3.0.1",
|
|
106
106
|
"monaco-editor": "^0.54.0",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"string-similarity": "^4.0.4",
|
|
111
111
|
"tweakpane": "^3.1.10",
|
|
112
112
|
"update-electron-app": "^3.1.1",
|
|
113
|
-
"x_ite": "^12.1.
|
|
113
|
+
"x_ite": "^12.1.7",
|
|
114
114
|
"x3d-traverse": "^1.0.22"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -23,7 +23,7 @@ $.fn.exportNodePopover = function (node, oldExportedName)
|
|
|
23
23
|
|
|
24
24
|
const nameInput = $("<input></input>")
|
|
25
25
|
.attr ("placeholder", _("Enter exported name"))
|
|
26
|
-
.val (oldExportedName
|
|
26
|
+
.val (oldExportedName || scene .getUniqueExportName (node .getName ()))
|
|
27
27
|
.appendTo (content);
|
|
28
28
|
|
|
29
29
|
// Create tooltip.
|
|
@@ -23,7 +23,7 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName)
|
|
|
23
23
|
|
|
24
24
|
const nameInput = $("<input></input>")
|
|
25
25
|
.attr ("placeholder", _("Enter imported name"))
|
|
26
|
-
.val (oldImportedName
|
|
26
|
+
.val (oldImportedName || executionContext .getUniqueImportName (exportedName))
|
|
27
27
|
.appendTo (content);
|
|
28
28
|
|
|
29
29
|
// Create tooltip.
|
|
@@ -1054,7 +1054,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1054
1054
|
|
|
1055
1055
|
this .deselectAll ();
|
|
1056
1056
|
|
|
1057
|
-
for (const node of nodes)
|
|
1057
|
+
for (const node of nodes .filter (node => node))
|
|
1058
1058
|
{
|
|
1059
1059
|
this .expandTo (node);
|
|
1060
1060
|
this .selectNodeElement ($(`.node[node-id="${node .getId ()}"]`), { add: true });
|
|
@@ -2154,7 +2154,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2154
2154
|
let index = 0;
|
|
2155
2155
|
|
|
2156
2156
|
for (const node of field)
|
|
2157
|
-
ul .append (this .createNodeElement ("node", parent, node
|
|
2157
|
+
ul .append (this .createNodeElement ("node", parent, node ?.getValue (), index ++));
|
|
2158
2158
|
|
|
2159
2159
|
// Make jsTree.
|
|
2160
2160
|
|
|
@@ -2787,15 +2787,37 @@ module .exports = class OutlineView extends Interface
|
|
|
2787
2787
|
|
|
2788
2788
|
nodeCloseClones (element)
|
|
2789
2789
|
{
|
|
2790
|
-
const
|
|
2791
|
-
.imported-node[node-id=${element .attr ("node-id")}],
|
|
2792
|
-
.exported-node[node-id=${element .attr ("node-id")}]`);
|
|
2790
|
+
const ids = [parseInt (element .attr ("node-id"))];
|
|
2793
2791
|
|
|
2794
|
-
|
|
2792
|
+
if (this .getNode (element) instanceof X3D .X3DImportedNodeProxy)
|
|
2795
2793
|
{
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2794
|
+
// Close nodes.
|
|
2795
|
+
|
|
2796
|
+
ids .push ($.try (() => this .getNode (element) .getInnerNode () .getId ()));
|
|
2797
|
+
}
|
|
2798
|
+
else
|
|
2799
|
+
{
|
|
2800
|
+
// Close imported nodes.
|
|
2801
|
+
|
|
2802
|
+
const executionContext = this .getNode (element) .getScene () ?.getScene ()
|
|
2803
|
+
?? this .executionContext;
|
|
2804
|
+
|
|
2805
|
+
const importedNode = executionContext .importedNodes
|
|
2806
|
+
.find (importedNode => $.try (() => importedNode .getExportedNode () .getInnerNode () .getId ()) === ids [0]);
|
|
2807
|
+
|
|
2808
|
+
ids .push (importedNode ?.getExportedNode () .getId ());
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
for (const id of ids)
|
|
2812
|
+
{
|
|
2813
|
+
const opened = this .sceneGraph .find (`:is(.node, .imported-node, .exported-node)[node-id="${id}"]`);
|
|
2814
|
+
|
|
2815
|
+
opened .each (function (key, value)
|
|
2816
|
+
{
|
|
2817
|
+
if (value !== element .get (0))
|
|
2818
|
+
$(value) .jstree ("close_node", value);
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2799
2821
|
}
|
|
2800
2822
|
|
|
2801
2823
|
fieldBeforeOpen (event, leaf)
|
|
@@ -220,6 +220,9 @@ class X3DNodeTool extends X3DBaseTool
|
|
|
220
220
|
|
|
221
221
|
for (const tool of this .#tools)
|
|
222
222
|
{
|
|
223
|
+
if (!this [tool])
|
|
224
|
+
continue;
|
|
225
|
+
|
|
223
226
|
for (const node of Traverse .traverse (this [tool], Traverse .ROOT_NODES | Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES))
|
|
224
227
|
{
|
|
225
228
|
nodesToDispose .push (node instanceof X3D .SFNode ? node .getValue () : node);
|
package/src/Undo/Editor.js
CHANGED
|
@@ -1986,98 +1986,126 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1986
1986
|
{
|
|
1987
1987
|
node = node .valueOf ();
|
|
1988
1988
|
|
|
1989
|
+
undoManager .beginUndo (_("Update Field %s of Node %s"), field .getName (), node .getTypeName ());
|
|
1990
|
+
|
|
1991
|
+
if (name !== field .getName ())
|
|
1992
|
+
this .#renameField (executionContext, node, field, name, undoManager);
|
|
1993
|
+
|
|
1994
|
+
if (accessType !== field .getAccessType ())
|
|
1995
|
+
this .#changeAccessType (executionContext, node, field, accessType, undoManager);
|
|
1996
|
+
|
|
1997
|
+
undoManager .endUndo ();
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
static #renameField (executionContext, node, field, name, undoManager = UndoManager .shared)
|
|
2001
|
+
{
|
|
2002
|
+
node = node .valueOf ();
|
|
2003
|
+
|
|
1989
2004
|
const
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2005
|
+
oldName = field .getName (),
|
|
2006
|
+
fields = Array .from (node .getUserDefinedFields ()),
|
|
2007
|
+
inputRoutes = Array .from (field .getInputRoutes ()),
|
|
2008
|
+
outputRoutes = Array .from (field .getOutputRoutes ());
|
|
1993
2009
|
|
|
1994
|
-
undoManager .beginUndo (_("
|
|
2010
|
+
undoManager .beginUndo (_("Rename Field"));
|
|
2011
|
+
|
|
2012
|
+
for (const route of inputRoutes)
|
|
2013
|
+
route .getExecutionContext () .deleteRoute (route);
|
|
2014
|
+
|
|
2015
|
+
for (const route of outputRoutes)
|
|
2016
|
+
route .getExecutionContext () .deleteRoute (route);
|
|
1995
2017
|
|
|
1996
2018
|
for (const field of fields)
|
|
1997
2019
|
node .removeUserDefinedField (field .getName ());
|
|
1998
2020
|
|
|
1999
|
-
field .setAccessType (accessType);
|
|
2000
2021
|
field .setName (name);
|
|
2001
2022
|
|
|
2002
2023
|
for (const field of fields)
|
|
2003
2024
|
node .addUserDefinedField (field .getAccessType (), field .getName (), field);
|
|
2004
2025
|
|
|
2005
|
-
if (
|
|
2026
|
+
if (field .isInput ())
|
|
2006
2027
|
{
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
proto = node,
|
|
2011
|
-
updatedField = field;
|
|
2028
|
+
for (const route of inputRoutes)
|
|
2029
|
+
route .getExecutionContext () .addRoute (route .sourceNode, route .sourceField, route .destinationNode, name);
|
|
2030
|
+
}
|
|
2012
2031
|
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2032
|
+
if (field .isOutput ())
|
|
2033
|
+
{
|
|
2034
|
+
for (const route of outputRoutes)
|
|
2035
|
+
route .getExecutionContext () .addRoute (route .sourceNode, name, route .destinationNode, route .destinationField);
|
|
2036
|
+
}
|
|
2017
2037
|
|
|
2018
|
-
|
|
2038
|
+
undoManager .registerUndo (() =>
|
|
2039
|
+
{
|
|
2040
|
+
this .#renameField (executionContext, node, field, oldName, undoManager);
|
|
2041
|
+
});
|
|
2019
2042
|
|
|
2020
|
-
|
|
2021
|
-
{
|
|
2022
|
-
// Remove references.
|
|
2043
|
+
this .requestUpdateInstances (node, undoManager);
|
|
2023
2044
|
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
if (!updatedField .isReference (field .getAccessType ()))
|
|
2027
|
-
this .removeReference (proto, updatedField, node, field, undoManager);
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2045
|
+
undoManager .endUndo ();
|
|
2046
|
+
}
|
|
2031
2047
|
|
|
2032
|
-
|
|
2048
|
+
static #changeAccessType (executionContext, node, field, accessType, undoManager = UndoManager .shared)
|
|
2049
|
+
{
|
|
2050
|
+
node = node .valueOf ();
|
|
2033
2051
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
continue;
|
|
2052
|
+
const
|
|
2053
|
+
oldAccessType = field .getAccessType (),
|
|
2054
|
+
fields = Array .from (node .getUserDefinedFields ());
|
|
2038
2055
|
|
|
2039
|
-
|
|
2056
|
+
undoManager .beginUndo (_("Change AccessType"));
|
|
2040
2057
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2058
|
+
for (const field of fields)
|
|
2059
|
+
node .removeUserDefinedField (field .getName ());
|
|
2043
2060
|
|
|
2044
|
-
|
|
2045
|
-
continue;
|
|
2061
|
+
field .setAccessType (accessType);
|
|
2046
2062
|
|
|
2047
|
-
|
|
2063
|
+
for (const field of fields)
|
|
2064
|
+
node .addUserDefinedField (field .getAccessType (), field .getName (), field);
|
|
2048
2065
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2066
|
+
if (node instanceof X3D .X3DProtoDeclaration)
|
|
2067
|
+
{
|
|
2068
|
+
const
|
|
2069
|
+
proto = node,
|
|
2070
|
+
updatedField = field;
|
|
2056
2071
|
|
|
2057
|
-
|
|
2072
|
+
for (const object of proto .traverse (Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES))
|
|
2073
|
+
{
|
|
2074
|
+
if (!(object instanceof X3D .SFNode))
|
|
2075
|
+
continue;
|
|
2076
|
+
|
|
2077
|
+
const node = object .getValue ();
|
|
2078
|
+
|
|
2079
|
+
for (const field of node .getFields ())
|
|
2080
|
+
{
|
|
2081
|
+
// Remove references.
|
|
2082
|
+
|
|
2083
|
+
if (field .getReferences () .has (updatedField))
|
|
2058
2084
|
{
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager);
|
|
2062
|
-
}
|
|
2085
|
+
if (!updatedField .isReference (field .getAccessType ()))
|
|
2086
|
+
this .removeReference (proto, updatedField, node, field, undoManager);
|
|
2063
2087
|
}
|
|
2064
2088
|
}
|
|
2065
|
-
|
|
2066
|
-
this .updateInstances (proto, undoManager);
|
|
2067
2089
|
}
|
|
2068
|
-
|
|
2090
|
+
|
|
2091
|
+
// Remove routes.
|
|
2092
|
+
|
|
2093
|
+
for (const object of executionContext .traverse (Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES))
|
|
2069
2094
|
{
|
|
2070
|
-
|
|
2095
|
+
if (!(object instanceof X3D .SFNode))
|
|
2096
|
+
continue;
|
|
2071
2097
|
|
|
2072
|
-
|
|
2073
|
-
{
|
|
2074
|
-
if (!reference .isReference (field .getAccessType ()))
|
|
2075
|
-
this .removeReference (proto, reference, node, field, undoManager);
|
|
2076
|
-
}
|
|
2098
|
+
const node = object .getValue ();
|
|
2077
2099
|
|
|
2078
|
-
|
|
2100
|
+
if (!node .getType () .includes (X3D .X3DConstants .X3DPrototypeInstance))
|
|
2101
|
+
continue;
|
|
2102
|
+
|
|
2103
|
+
if (node .getProtoNode () !== proto)
|
|
2104
|
+
continue;
|
|
2105
|
+
|
|
2106
|
+
const field = node .getField (oldName);
|
|
2079
2107
|
|
|
2080
|
-
if (!
|
|
2108
|
+
if (!updatedField .isInput ())
|
|
2081
2109
|
{
|
|
2082
2110
|
for (const route of field .getInputRoutes ())
|
|
2083
2111
|
{
|
|
@@ -2085,7 +2113,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2085
2113
|
}
|
|
2086
2114
|
}
|
|
2087
2115
|
|
|
2088
|
-
if (!
|
|
2116
|
+
if (!updatedField .isOutput ())
|
|
2089
2117
|
{
|
|
2090
2118
|
for (const route of field .getOutputRoutes ())
|
|
2091
2119
|
{
|
|
@@ -2093,11 +2121,46 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2093
2121
|
}
|
|
2094
2122
|
}
|
|
2095
2123
|
}
|
|
2124
|
+
|
|
2125
|
+
this .updateInstances (proto, undoManager);
|
|
2126
|
+
}
|
|
2127
|
+
else
|
|
2128
|
+
{
|
|
2129
|
+
const
|
|
2130
|
+
references = Array .from (field .getReferences ()),
|
|
2131
|
+
inputRoutes = Array .from (field .getInputRoutes ()),
|
|
2132
|
+
outputRoutes = Array .from (field .getOutputRoutes ());
|
|
2133
|
+
|
|
2134
|
+
// Remove References.
|
|
2135
|
+
|
|
2136
|
+
for (const reference of references)
|
|
2137
|
+
{
|
|
2138
|
+
if (!reference .isReference (field .getAccessType ()))
|
|
2139
|
+
this .removeReference (proto, reference, node, field, undoManager);
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
// Remove routes.
|
|
2143
|
+
|
|
2144
|
+
if (!field .isInput ())
|
|
2145
|
+
{
|
|
2146
|
+
for (const route of inputRoutes)
|
|
2147
|
+
{
|
|
2148
|
+
this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
if (!field .isOutput ())
|
|
2153
|
+
{
|
|
2154
|
+
for (const route of outputRoutes)
|
|
2155
|
+
{
|
|
2156
|
+
this .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField, undoManager);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2096
2159
|
}
|
|
2097
2160
|
|
|
2098
2161
|
undoManager .registerUndo (() =>
|
|
2099
2162
|
{
|
|
2100
|
-
this
|
|
2163
|
+
this .#changeAccessType (executionContext, node, field, oldAccessType, undoManager);
|
|
2101
2164
|
});
|
|
2102
2165
|
|
|
2103
2166
|
this .requestUpdateInstances (node, undoManager);
|