sunrize 1.5.13 → 1.6.0
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 +5 -5
- package/src/Application/Application.js +2 -7
- package/src/Application/Dashboard.js +10 -10
- package/src/Application/DataStorage.js +177 -177
- package/src/Application/Document.js +72 -127
- package/src/Application/Interface.js +4 -0
- package/src/Application/Tabs.js +3 -3
- package/src/Controls/Dialog.js +3 -1
- package/src/Editors/BrowserFrame.js +171 -0
- package/src/Editors/OutlineEditor.js +149 -123
- package/src/Editors/OutlineRouteGraph.js +493 -493
- package/src/Editors/OutlineView.js +102 -64
- package/src/Editors/SceneProperties.js +137 -136
- package/src/Editors/ScriptEditor.js +1 -1
- package/src/Tools/Core/X3DNodeTool.js +66 -12
- package/src/Tools/Grids/AngleGridTool.js +0 -5
- package/src/Tools/Grids/AngleGridTool.x3d +1 -0
- package/src/Tools/Grids/AxonometricGrid.x3d +5 -5
- package/src/Tools/Grids/AxonometricGridTool.js +0 -5
- package/src/Tools/Grids/AxonometricGridTool.x3d +1 -0
- package/src/Tools/Grids/GridTool.js +0 -5
- package/src/Tools/Grids/GridTool.x3d +1 -0
- package/src/Tools/Grids/X3DGridNodeTool.js +131 -84
- package/src/Tools/Grouping/X3DTransformNodeTool.js +19 -21
- package/src/Tools/Grouping/X3DTransformNodeTool.x3d +20 -15
- package/src/Tools/Layering/X3DActiveLayerNodeTool.js +16 -21
- package/src/Tools/Lighting/DirectionalLightTool.js +32 -1
- package/src/Tools/Lighting/X3DLightNodeTool.x3d +4 -21
- package/src/Tools/Shaders/TextureShader.x3d +16 -3
- package/src/Tools/SnapTool/{SnapSourceTool.js → SnapSource.js} +2 -7
- package/src/Tools/SnapTool/SnapTarget.js +650 -0
- package/src/Tools/SnapTool/SnapTool.x3d +28 -27
- package/src/Tools/SnapTool/X3DSnapNodeTool.js +16 -15
- package/src/Tools/Sound/SoundTool.x3d +4 -21
- package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.x3d +19 -26
- package/src/Undo/Editor.js +185 -46
- package/src/assets/Info.plist +56 -56
- package/src/assets/themes/default-template.css +1 -0
- package/src/assets/themes/default.css +1 -0
- package/src/Editors/BrowserSize.js +0 -101
- package/src/Tools/SnapTool/SnapTargetTool.js +0 -20
package/src/Undo/Editor.js
CHANGED
|
@@ -195,10 +195,8 @@ module .exports = class Editor
|
|
|
195
195
|
externprotos = new Map (Array .from (executionContext .externprotos, p => [p .getName (), p])),
|
|
196
196
|
protos = new Map (Array .from (executionContext .protos, p => [p .getName (), p])),
|
|
197
197
|
rootNodes = executionContext .rootNodes .copy (),
|
|
198
|
-
tempScene = browser .createScene (browser .getProfile ("Core"))
|
|
199
|
-
loadUrlObjects = browser .getBrowserOption ("LoadUrlObjects");
|
|
198
|
+
tempScene = browser .createScene (browser .getProfile ("Core"));
|
|
200
199
|
|
|
201
|
-
browser .setBrowserOption ("LoadUrlObjects", false);
|
|
202
200
|
scene .setProfile (browser .getProfile ("Full"));
|
|
203
201
|
scene .updateComponent (browser .getComponent ("X_ITE"));
|
|
204
202
|
|
|
@@ -314,8 +312,6 @@ module .exports = class Editor
|
|
|
314
312
|
this .rewriteURLs (executionContext, objects, oldWorldURL [0], executionContext .worldURL, new UndoManager ());
|
|
315
313
|
}
|
|
316
314
|
|
|
317
|
-
browser .setBrowserOption ("LoadUrlObjects", loadUrlObjects);
|
|
318
|
-
|
|
319
315
|
// Add exported nodes.
|
|
320
316
|
|
|
321
317
|
if (executionContext instanceof X3D .X3DScene)
|
|
@@ -645,6 +641,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
645
641
|
*/
|
|
646
642
|
static #setLive (node, value, undoManager = UndoManager .shared)
|
|
647
643
|
{
|
|
644
|
+
node = node .valueOf ();
|
|
645
|
+
|
|
648
646
|
const oldValue = node .isLive ();
|
|
649
647
|
|
|
650
648
|
undoManager .beginUndo (_("Set live state to »%s«"), value);
|
|
@@ -880,25 +878,25 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
880
878
|
*/
|
|
881
879
|
static setMetaData (scene, entries, undoManager = UndoManager .shared)
|
|
882
880
|
{
|
|
883
|
-
const oldEntries = [ ]
|
|
881
|
+
const oldEntries = [ ];
|
|
884
882
|
|
|
885
883
|
for (const [key, values] of scene .getMetaDatas ())
|
|
886
884
|
{
|
|
887
885
|
for (const value of values)
|
|
888
|
-
oldEntries .push (key, value)
|
|
886
|
+
oldEntries .push ([key, value]);
|
|
889
887
|
}
|
|
890
888
|
|
|
891
|
-
undoManager .beginUndo (_("Change Meta Data"))
|
|
889
|
+
undoManager .beginUndo (_("Change Meta Data"));
|
|
892
890
|
|
|
893
|
-
for (const key of
|
|
894
|
-
scene .removeMetaData (key)
|
|
891
|
+
for (const key of Array .from (scene .getMetaDatas () .keys ()))
|
|
892
|
+
scene .removeMetaData (key);
|
|
895
893
|
|
|
896
894
|
for (const [key, value] of entries)
|
|
897
|
-
scene .addMetaData (key, value)
|
|
895
|
+
scene .addMetaData (key, value);
|
|
898
896
|
|
|
899
897
|
undoManager .registerUndo (() =>
|
|
900
898
|
{
|
|
901
|
-
this .setMetaData (scene, oldEntries, undoManager)
|
|
899
|
+
this .setMetaData (scene, oldEntries, undoManager);
|
|
902
900
|
});
|
|
903
901
|
|
|
904
902
|
undoManager .endUndo ();
|
|
@@ -913,13 +911,15 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
913
911
|
*/
|
|
914
912
|
static updateNamedNode (executionContext, name, node, undoManager = UndoManager .shared)
|
|
915
913
|
{
|
|
914
|
+
node = node .valueOf ();
|
|
915
|
+
|
|
916
916
|
const
|
|
917
917
|
oldNode = $.try (() => executionContext .getNamedNode (name)),
|
|
918
918
|
oldName = node .getName ();
|
|
919
919
|
|
|
920
920
|
undoManager .beginUndo (_("Rename Node to »%s«"), name);
|
|
921
921
|
|
|
922
|
-
executionContext .updateNamedNode (name, node
|
|
922
|
+
executionContext .updateNamedNode (name, node);
|
|
923
923
|
|
|
924
924
|
undoManager .registerUndo (() =>
|
|
925
925
|
{
|
|
@@ -945,6 +945,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
945
945
|
*/
|
|
946
946
|
static removeNamedNode (executionContext, node, undoManager = UndoManager .shared)
|
|
947
947
|
{
|
|
948
|
+
node = node .valueOf ();
|
|
949
|
+
|
|
948
950
|
const oldName = node .getName ();
|
|
949
951
|
|
|
950
952
|
undoManager .beginUndo (_("Remove Node Name »%s«"), oldName);
|
|
@@ -972,6 +974,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
972
974
|
*/
|
|
973
975
|
static updateImportedNode (executionContext, inlineNode, exportedName, importedName, oldImportedName, undoManager = UndoManager .shared)
|
|
974
976
|
{
|
|
977
|
+
inlineNode = inlineNode .valueOf ();
|
|
978
|
+
|
|
975
979
|
undoManager .beginUndo (_("Update Imported Node »%s«"), importedName);
|
|
976
980
|
|
|
977
981
|
executionContext .updateImportedNode (inlineNode .valueOf (), exportedName, importedName);
|
|
@@ -1080,12 +1084,14 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1080
1084
|
*/
|
|
1081
1085
|
static updateExportedNode (scene, exportedName, oldExportedName, node, undoManager = UndoManager .shared)
|
|
1082
1086
|
{
|
|
1087
|
+
node = node .valueOf ();
|
|
1088
|
+
|
|
1083
1089
|
undoManager .beginUndo (_("Update Exported Node »%s«"), exportedName);
|
|
1084
1090
|
|
|
1085
1091
|
if (oldExportedName)
|
|
1086
1092
|
scene .removeExportedNode (oldExportedName);
|
|
1087
1093
|
|
|
1088
|
-
scene .updateExportedNode (exportedName, node
|
|
1094
|
+
scene .updateExportedNode (exportedName, node);
|
|
1089
1095
|
|
|
1090
1096
|
undoManager .registerUndo (() =>
|
|
1091
1097
|
{
|
|
@@ -1516,6 +1522,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1516
1522
|
*/
|
|
1517
1523
|
static setProtoNode (executionContext, instance, protoNode, undoManager = UndoManager .shared)
|
|
1518
1524
|
{
|
|
1525
|
+
instance = instance .valueOf ();
|
|
1526
|
+
|
|
1519
1527
|
const oldProtoNode = instance .getProtoNode ();
|
|
1520
1528
|
|
|
1521
1529
|
undoManager .beginUndo (_("Set Proto Node of Instance to %s"), protoNode .getName ());
|
|
@@ -1712,6 +1720,9 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1712
1720
|
*/
|
|
1713
1721
|
static addRoute (executionContext, sourceNode, sourceField, destinationNode, destinationField, undoManager = UndoManager .shared)
|
|
1714
1722
|
{
|
|
1723
|
+
sourceNode = sourceNode .valueOf ();
|
|
1724
|
+
destinationNode = destinationNode .valueOf ();
|
|
1725
|
+
|
|
1715
1726
|
undoManager .beginUndo (_("Add Route From %s »%s« TO %s »%s«"), sourceNode .getTypeName (), sourceField, destinationNode .getTypeName (), destinationField);
|
|
1716
1727
|
|
|
1717
1728
|
try
|
|
@@ -1771,6 +1782,9 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1771
1782
|
*/
|
|
1772
1783
|
static deleteRoute (executionContext, sourceNode, sourceField, destinationNode, destinationField, undoManager = UndoManager .shared)
|
|
1773
1784
|
{
|
|
1785
|
+
sourceNode = sourceNode .valueOf ();
|
|
1786
|
+
destinationNode = destinationNode .valueOf ();
|
|
1787
|
+
|
|
1774
1788
|
undoManager .beginUndo (_("Delete Route From %s »%s« TO %s »%s«"), sourceNode .getTypeName (), sourceField, destinationNode .getTypeName (), destinationField);
|
|
1775
1789
|
|
|
1776
1790
|
executionContext .deleteRoute (sourceNode .valueOf (), sourceField, destinationNode .valueOf (), destinationField);
|
|
@@ -1796,42 +1810,54 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1796
1810
|
|
|
1797
1811
|
/**
|
|
1798
1812
|
*
|
|
1799
|
-
* @param {
|
|
1800
|
-
* @param {
|
|
1801
|
-
* @param {UndoManger} undoManager
|
|
1813
|
+
* @param {X3DBrowser} browser
|
|
1814
|
+
* @param {UndoManager} undoManager
|
|
1802
1815
|
*/
|
|
1803
|
-
static
|
|
1816
|
+
static getConfigNode (browser, create = false, undoManager = UndoManager .shared)
|
|
1804
1817
|
{
|
|
1805
|
-
|
|
1818
|
+
return browser .getActiveLayer () === browser .getWorld () .getLayerSet () .getLayer0 ()
|
|
1819
|
+
? Editor .getWorldInfo (browser .currentScene, create, undoManager)
|
|
1820
|
+
: browser .getActiveLayer ();
|
|
1821
|
+
}
|
|
1806
1822
|
|
|
1807
|
-
|
|
1823
|
+
/**
|
|
1824
|
+
*
|
|
1825
|
+
* @param {X3DExecutionContext} executionContext
|
|
1826
|
+
* @param {UndoManager} undoManager
|
|
1827
|
+
*/
|
|
1828
|
+
static getWorldInfo (executionContext, create = false, undoManager = UndoManager .shared)
|
|
1829
|
+
{
|
|
1830
|
+
if (executionContext .getWorldInfos () .length)
|
|
1831
|
+
return executionContext .getWorldInfos () .at (-1) .getValue ();
|
|
1808
1832
|
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
this .#removeWorldInfo (executionContext, worldInfo, undoManager);
|
|
1812
|
-
});
|
|
1833
|
+
if (create)
|
|
1834
|
+
return this .addWorldInfo (executionContext, undoManager);
|
|
1813
1835
|
|
|
1814
|
-
|
|
1836
|
+
return null;
|
|
1815
1837
|
}
|
|
1816
1838
|
|
|
1817
1839
|
/**
|
|
1818
1840
|
*
|
|
1819
1841
|
* @param {X3DExecutionContext} executionContext
|
|
1820
|
-
* @param {
|
|
1821
|
-
* @
|
|
1842
|
+
* @param {UndoManager} undoManager
|
|
1843
|
+
* @returns {WorldInfo}
|
|
1822
1844
|
*/
|
|
1823
|
-
|
|
1845
|
+
static addWorldInfo (executionContext, undoManager = UndoManager .shared)
|
|
1824
1846
|
{
|
|
1825
|
-
|
|
1847
|
+
const
|
|
1848
|
+
worldInfoNode = executionContext .createNode ("WorldInfo"),
|
|
1849
|
+
fileURL = new URL (executionContext .getWorldURL ());
|
|
1826
1850
|
|
|
1827
|
-
|
|
1851
|
+
if (fileURL .protocol === "file:")
|
|
1852
|
+
worldInfoNode .title = path .parse (url .fileURLToPath (fileURL)) .name;
|
|
1828
1853
|
|
|
1829
|
-
undoManager .
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
});
|
|
1854
|
+
undoManager .beginUndo (_("Add WorldInfo Node"));
|
|
1855
|
+
|
|
1856
|
+
this .insertValueIntoArray (executionContext, executionContext, executionContext .rootNodes, 0, worldInfoNode, undoManager);
|
|
1833
1857
|
|
|
1834
1858
|
undoManager .endUndo ();
|
|
1859
|
+
|
|
1860
|
+
return worldInfoNode .getValue ();
|
|
1835
1861
|
}
|
|
1836
1862
|
|
|
1837
1863
|
/**
|
|
@@ -1840,12 +1866,11 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1840
1866
|
* @param {WorldInfo} worldInfo
|
|
1841
1867
|
* @param {UndoManager} undoManager
|
|
1842
1868
|
*/
|
|
1843
|
-
static removeWorldInfo (executionContext,
|
|
1869
|
+
static removeWorldInfo (executionContext, worldInfoNode, undoManager = UndoManager .shared)
|
|
1844
1870
|
{
|
|
1845
|
-
undoManager .beginUndo (_("Remove
|
|
1871
|
+
undoManager .beginUndo (_("Remove WorldInfo Node"));
|
|
1846
1872
|
|
|
1847
|
-
this .removeNode (executionContext,
|
|
1848
|
-
this .#removeWorldInfo (executionContext, worldInfo, undoManager);
|
|
1873
|
+
this .removeNode (executionContext, worldInfoNode, undoManager);
|
|
1849
1874
|
|
|
1850
1875
|
undoManager .endUndo ();
|
|
1851
1876
|
}
|
|
@@ -1858,6 +1883,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1858
1883
|
*/
|
|
1859
1884
|
static removeNode (executionContext, remove, undoManager = UndoManager .shared)
|
|
1860
1885
|
{
|
|
1886
|
+
remove = remove .valueOf ();
|
|
1887
|
+
|
|
1861
1888
|
undoManager .beginUndo (_("Remove Node"));
|
|
1862
1889
|
|
|
1863
1890
|
Traverse .traverse (executionContext, Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES, (node) =>
|
|
@@ -1866,7 +1893,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1866
1893
|
{
|
|
1867
1894
|
for (let i = node .rootNodes .length - 1; i >= 0; -- i)
|
|
1868
1895
|
{
|
|
1869
|
-
if (node .rootNodes [i] ?.getValue () .valueOf () === remove
|
|
1896
|
+
if (node .rootNodes [i] ?.getValue () .valueOf () === remove)
|
|
1870
1897
|
this .removeValueFromArray (node, node, node .rootNodes, i, undoManager);
|
|
1871
1898
|
}
|
|
1872
1899
|
}
|
|
@@ -1878,7 +1905,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1878
1905
|
{
|
|
1879
1906
|
case X3D .X3DConstants .SFNode:
|
|
1880
1907
|
{
|
|
1881
|
-
if (field .getValue ()
|
|
1908
|
+
if (field .getValue () ?.valueOf () === remove)
|
|
1882
1909
|
this .setFieldValue (node .getExecutionContext (), node, field, null, undoManager);
|
|
1883
1910
|
|
|
1884
1911
|
break;
|
|
@@ -1887,7 +1914,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1887
1914
|
{
|
|
1888
1915
|
for (let i = field .length - 1; i >= 0; -- i)
|
|
1889
1916
|
{
|
|
1890
|
-
if (field [i] ?.getValue () .valueOf () === remove
|
|
1917
|
+
if (field [i] ?.getValue () .valueOf () === remove)
|
|
1891
1918
|
this .removeValueFromArray (node .getExecutionContext (), node, field, i, undoManager);
|
|
1892
1919
|
}
|
|
1893
1920
|
|
|
@@ -1909,6 +1936,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1909
1936
|
*/
|
|
1910
1937
|
static addUserDefinedField (executionContext, node, field, index, undoManager = UndoManager .shared)
|
|
1911
1938
|
{
|
|
1939
|
+
node = node .valueOf ();
|
|
1940
|
+
|
|
1912
1941
|
const fields = Array .from (node .getUserDefinedFields ());
|
|
1913
1942
|
|
|
1914
1943
|
index = Math .min (index < 0 ? fields .length : index, fields .length);
|
|
@@ -1930,6 +1959,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1930
1959
|
*/
|
|
1931
1960
|
static updateUserDefinedField (executionContext, node, field, accessType, name, undoManager = UndoManager .shared)
|
|
1932
1961
|
{
|
|
1962
|
+
node = node .valueOf ();
|
|
1963
|
+
|
|
1933
1964
|
const
|
|
1934
1965
|
oldAccessType = field .getAccessType (),
|
|
1935
1966
|
oldName = field .getName (),
|
|
@@ -2044,6 +2075,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2044
2075
|
*/
|
|
2045
2076
|
static removeUserDefinedField (executionContext, node, field, undoManager = UndoManager .shared)
|
|
2046
2077
|
{
|
|
2078
|
+
node = node .valueOf ();
|
|
2079
|
+
|
|
2047
2080
|
const fields = [... node .getUserDefinedFields ()] .filter (f => f !== field);
|
|
2048
2081
|
|
|
2049
2082
|
undoManager .beginUndo (_("Remove Field »%s«"), field .getName ());
|
|
@@ -2061,6 +2094,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2061
2094
|
*/
|
|
2062
2095
|
static setUserDefinedFields (executionContext, node, fields, undoManager = UndoManager .shared)
|
|
2063
2096
|
{
|
|
2097
|
+
node = node .valueOf ();
|
|
2098
|
+
|
|
2064
2099
|
const
|
|
2065
2100
|
oldFields = Array .from (node .getUserDefinedFields ()),
|
|
2066
2101
|
removedFields = oldFields .filter (f => !fields .includes (f));
|
|
@@ -2193,6 +2228,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2193
2228
|
*/
|
|
2194
2229
|
static addReference (proto, protoField, node, field, undoManager = UndoManager .shared)
|
|
2195
2230
|
{
|
|
2231
|
+
node = node .valueOf ();
|
|
2196
2232
|
field = typeof field === "string" ? node .getField (field) : field
|
|
2197
2233
|
|
|
2198
2234
|
const
|
|
@@ -2222,6 +2258,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2222
2258
|
*/
|
|
2223
2259
|
static removeReference (proto, protoField, node, field, undoManager = UndoManager .shared)
|
|
2224
2260
|
{
|
|
2261
|
+
node = node .valueOf ();
|
|
2225
2262
|
field = typeof field === "string" ? node .getField (field) : field
|
|
2226
2263
|
|
|
2227
2264
|
const
|
|
@@ -2251,6 +2288,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2251
2288
|
*/
|
|
2252
2289
|
static setMatrixWithCenter (node, matrix, center = node ._center .getValue (), undoManager = UndoManager .shared)
|
|
2253
2290
|
{
|
|
2291
|
+
node = node .valueOf ();
|
|
2292
|
+
|
|
2254
2293
|
undoManager .beginUndo (_("Set Transformation Matrix of %s"), node .getTypeName ());
|
|
2255
2294
|
|
|
2256
2295
|
const
|
|
@@ -2319,6 +2358,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2319
2358
|
|
|
2320
2359
|
static moveViewpoint (viewpointNode, position, orientation, centerOfRotation, fieldOfView, undoManager = UndoManager .shared)
|
|
2321
2360
|
{
|
|
2361
|
+
viewpointNode = viewpointNode .valueOf ();
|
|
2362
|
+
|
|
2322
2363
|
UndoManager .shared .beginUndo (_("Move Viewpoint to Camera"));
|
|
2323
2364
|
|
|
2324
2365
|
const
|
|
@@ -2629,6 +2670,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2629
2670
|
*/
|
|
2630
2671
|
static getModelMatrices (executionContext, layerNode, node, addSelf = false)
|
|
2631
2672
|
{
|
|
2673
|
+
node = node .valueOf ();
|
|
2674
|
+
|
|
2632
2675
|
const
|
|
2633
2676
|
hierarchies = Traverse .find (executionContext, node, Traverse .ROOT_NODES),
|
|
2634
2677
|
modelMatrices = [ ];
|
|
@@ -2651,7 +2694,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2651
2694
|
if (!object .getType () .includes (X3D .X3DConstants .X3DTransformMatrix3DNode))
|
|
2652
2695
|
continue;
|
|
2653
2696
|
|
|
2654
|
-
if (object .valueOf () === node
|
|
2697
|
+
if (object .valueOf () === node && !addSelf)
|
|
2655
2698
|
continue;
|
|
2656
2699
|
|
|
2657
2700
|
modelMatrix .multRight (object .getMatrix ());
|
|
@@ -2663,6 +2706,72 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2663
2706
|
return modelMatrices;
|
|
2664
2707
|
}
|
|
2665
2708
|
|
|
2709
|
+
/**
|
|
2710
|
+
*
|
|
2711
|
+
* @param {X3DExecutionContext} executionContext
|
|
2712
|
+
* @param {X3DNode} node
|
|
2713
|
+
* @param {string} path
|
|
2714
|
+
* @param {X3DField} value
|
|
2715
|
+
* @param {UndoManager} undoManager
|
|
2716
|
+
*/
|
|
2717
|
+
static setNodeMetaData (node, path, value, undoManager = UndoManager .shared)
|
|
2718
|
+
{
|
|
2719
|
+
node = node .valueOf ();
|
|
2720
|
+
|
|
2721
|
+
const
|
|
2722
|
+
hasValue = node .hasMetaData (path),
|
|
2723
|
+
oldValue = node .getMetaData (path, value .create ());
|
|
2724
|
+
|
|
2725
|
+
undoManager .beginUndo (_("Change Metadata of Node %s"), node .getTypeName ());
|
|
2726
|
+
|
|
2727
|
+
node .setMetaData (path, value);
|
|
2728
|
+
|
|
2729
|
+
undoManager .registerUndo (() =>
|
|
2730
|
+
{
|
|
2731
|
+
if (hasValue)
|
|
2732
|
+
this .setNodeMetaData (node, path, oldValue, undoManager);
|
|
2733
|
+
else
|
|
2734
|
+
this .removeNodeMetaData (node, path, oldValue, undoManager);
|
|
2735
|
+
});
|
|
2736
|
+
|
|
2737
|
+
this .requestUpdateInstances (node, undoManager);
|
|
2738
|
+
|
|
2739
|
+
undoManager .endUndo ();
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
*
|
|
2744
|
+
* @param {X3DExecutionContext} executionContext
|
|
2745
|
+
* @param {X3DNode} node
|
|
2746
|
+
* @param {string} path
|
|
2747
|
+
* @param {X3DField} type
|
|
2748
|
+
* @param {UndoManager} undoManager
|
|
2749
|
+
*/
|
|
2750
|
+
static removeNodeMetaData (node, path, type, undoManager = UndoManager .shared)
|
|
2751
|
+
{
|
|
2752
|
+
node = node .valueOf ();
|
|
2753
|
+
|
|
2754
|
+
const hasValue = node .hasMetaData (path);
|
|
2755
|
+
|
|
2756
|
+
if (!hasValue)
|
|
2757
|
+
return;
|
|
2758
|
+
|
|
2759
|
+
const oldValue = node .getMetaData (path, type .create ());
|
|
2760
|
+
|
|
2761
|
+
undoManager .beginUndo (_("Change Metadata of Node %s"), node .getTypeName ());
|
|
2762
|
+
|
|
2763
|
+
node .removeMetaData (path);
|
|
2764
|
+
|
|
2765
|
+
undoManager .registerUndo (() =>
|
|
2766
|
+
{
|
|
2767
|
+
this .setNodeMetaData (node, path, oldValue, undoManager);
|
|
2768
|
+
});
|
|
2769
|
+
|
|
2770
|
+
this .requestUpdateInstances (node, undoManager);
|
|
2771
|
+
|
|
2772
|
+
undoManager .endUndo ();
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2666
2775
|
/**
|
|
2667
2776
|
*
|
|
2668
2777
|
* @param {X3DExecutionContext} executionContext
|
|
@@ -2673,7 +2782,9 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2673
2782
|
*/
|
|
2674
2783
|
static setFieldFromString (executionContext, node, field, string, undoManager = UndoManager .shared)
|
|
2675
2784
|
{
|
|
2676
|
-
|
|
2785
|
+
node = node .valueOf ();
|
|
2786
|
+
|
|
2787
|
+
const
|
|
2677
2788
|
instance = node .getType () .includes (X3D .X3DConstants .X3DPrototypeInstance),
|
|
2678
2789
|
name = field .getName (),
|
|
2679
2790
|
auxillary = field .create ();
|
|
@@ -2681,7 +2792,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2681
2792
|
auxillary .setUnit (field .getUnit ());
|
|
2682
2793
|
auxillary .fromString (string, executionContext);
|
|
2683
2794
|
|
|
2684
|
-
|
|
2795
|
+
if (auxillary .equals (field))
|
|
2685
2796
|
{
|
|
2686
2797
|
field .addEvent ();
|
|
2687
2798
|
return;
|
|
@@ -2719,6 +2830,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2719
2830
|
*/
|
|
2720
2831
|
static setFieldValue (executionContext, node, field, value, undoManager = UndoManager .shared)
|
|
2721
2832
|
{
|
|
2833
|
+
node = node .valueOf ();
|
|
2722
2834
|
field = typeof field === "string" ? node .getField (field) : field;
|
|
2723
2835
|
|
|
2724
2836
|
const
|
|
@@ -2728,7 +2840,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2728
2840
|
|
|
2729
2841
|
auxillary .setValue (value);
|
|
2730
2842
|
|
|
2731
|
-
|
|
2843
|
+
if (auxillary .equals (field))
|
|
2732
2844
|
{
|
|
2733
2845
|
field .addEvent ();
|
|
2734
2846
|
return;
|
|
@@ -2777,6 +2889,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2777
2889
|
*/
|
|
2778
2890
|
static insertValueIntoArray (executionContext, node, field, index, value, undoManager = UndoManager .shared)
|
|
2779
2891
|
{
|
|
2892
|
+
node = node .valueOf ();
|
|
2780
2893
|
field = typeof field === "string" ? node .getField (field) : field;
|
|
2781
2894
|
|
|
2782
2895
|
const
|
|
@@ -2811,6 +2924,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2811
2924
|
*/
|
|
2812
2925
|
static appendValueToArray (executionContext, node, field, value, undoManager = UndoManager .shared)
|
|
2813
2926
|
{
|
|
2927
|
+
node = node .valueOf ();
|
|
2928
|
+
|
|
2814
2929
|
undoManager .beginUndo (_("Append Value to %s »%s«"), node .getTypeName (), field .getName ());
|
|
2815
2930
|
|
|
2816
2931
|
this .insertValueIntoArray (executionContext, node, field, field .length, value, undoManager);
|
|
@@ -2828,6 +2943,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2828
2943
|
*/
|
|
2829
2944
|
static removeValueFromArray (executionContext, node, field, index, undoManager = UndoManager .shared)
|
|
2830
2945
|
{
|
|
2946
|
+
node = node .valueOf ();
|
|
2831
2947
|
field = typeof field === "string" ? node .getField (field) : field;
|
|
2832
2948
|
|
|
2833
2949
|
const
|
|
@@ -2877,6 +2993,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2877
2993
|
|
|
2878
2994
|
static #removeEmptyGroupsFromArray (node, field, undoManager = UndoManager .shared)
|
|
2879
2995
|
{
|
|
2996
|
+
node = node .valueOf ();
|
|
2997
|
+
|
|
2880
2998
|
for (let index = field .length - 1; index >= 0; -- index)
|
|
2881
2999
|
{
|
|
2882
3000
|
const value = field [index];
|
|
@@ -2895,6 +3013,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2895
3013
|
if (!node)
|
|
2896
3014
|
return true;
|
|
2897
3015
|
|
|
3016
|
+
node = node .valueOf ();
|
|
3017
|
+
|
|
2898
3018
|
return node .getFields () .every (field =>
|
|
2899
3019
|
{
|
|
2900
3020
|
switch (field .getType ())
|
|
@@ -2912,4 +3032,23 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2912
3032
|
}
|
|
2913
3033
|
});
|
|
2914
3034
|
}
|
|
2915
|
-
|
|
3035
|
+
|
|
3036
|
+
/**
|
|
3037
|
+
*
|
|
3038
|
+
* @param {function} callback
|
|
3039
|
+
* @param {UndoManager} undoManager
|
|
3040
|
+
*/
|
|
3041
|
+
static deferFunction (callback, undoManager = UndoManager .shared)
|
|
3042
|
+
{
|
|
3043
|
+
undoManager .beginUndo (_("Defer Function"));
|
|
3044
|
+
|
|
3045
|
+
undoManager .defer (callback, callback);
|
|
3046
|
+
|
|
3047
|
+
undoManager .registerUndo (() =>
|
|
3048
|
+
{
|
|
3049
|
+
this .deferFunction (callback, undoManager);
|
|
3050
|
+
});
|
|
3051
|
+
|
|
3052
|
+
undoManager .endUndo ();
|
|
3053
|
+
}
|
|
3054
|
+
};
|