sunrize 1.11.18 → 2.0.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 +2 -2
- package/src/Controls/ExportNodePopover.js +27 -10
- package/src/Controls/ImportNodePopover.js +26 -9
- package/src/Controls/MaterialPreviewPopover.js +4 -4
- package/src/Controls/TexturePreviewPopover.js +4 -4
- package/src/Editors/OutlineEditor.js +3 -3
- package/src/Editors/OutlineView.js +5 -3
- package/src/Parser/AudioParser.js +1 -1
- package/src/Parser/ImageParser.js +1 -1
- package/src/Parser/VideoParser.js +2 -2
- package/src/Undo/Editor.js +40 -29
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunrize",
|
|
3
3
|
"productName": "Sunrize X3D Editor",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -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": "^
|
|
113
|
+
"x_ite": "^14.0.0",
|
|
114
114
|
"x3d-traverse": "^1.0.22"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -9,7 +9,7 @@ const
|
|
|
9
9
|
require ("./Popover");
|
|
10
10
|
require ("../Bits/Validate");
|
|
11
11
|
|
|
12
|
-
$.fn.exportNodePopover = function (node, oldExportedName)
|
|
12
|
+
$.fn.exportNodePopover = function (node, oldExportedName, oldDescription = "")
|
|
13
13
|
{
|
|
14
14
|
// Create content.
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ $.fn.exportNodePopover = function (node, oldExportedName)
|
|
|
18
18
|
const content = $("<div></div>");
|
|
19
19
|
|
|
20
20
|
$("<span></span>")
|
|
21
|
-
.text (
|
|
21
|
+
.text ("Exported Name")
|
|
22
22
|
.appendTo (content);
|
|
23
23
|
|
|
24
24
|
const nameInput = $("<input></input>")
|
|
@@ -26,19 +26,35 @@ $.fn.exportNodePopover = function (node, oldExportedName)
|
|
|
26
26
|
.val (oldExportedName || scene .getUniqueExportName (node .getName ()))
|
|
27
27
|
.appendTo (content);
|
|
28
28
|
|
|
29
|
+
$("<span></span>")
|
|
30
|
+
.text ("Description")
|
|
31
|
+
.appendTo (content);
|
|
32
|
+
|
|
33
|
+
const descriptionInput = $("<input></input>")
|
|
34
|
+
.attr ("placeholder", _("Enter description"))
|
|
35
|
+
.val (oldDescription)
|
|
36
|
+
.appendTo (content);
|
|
37
|
+
|
|
29
38
|
// Create tooltip.
|
|
30
39
|
|
|
31
40
|
const tooltip = this .popover ({
|
|
32
41
|
content: content,
|
|
42
|
+
extension:
|
|
43
|
+
{
|
|
44
|
+
wide: true,
|
|
45
|
+
},
|
|
33
46
|
events: {
|
|
34
47
|
show: (event, api) =>
|
|
35
48
|
{
|
|
36
|
-
nameInput .
|
|
49
|
+
$(nameInput) .add (descriptionInput) .off ();
|
|
50
|
+
|
|
51
|
+
nameInput .validate (Editor .Id, () =>
|
|
37
52
|
{
|
|
38
53
|
electron .shell .beep ();
|
|
39
54
|
nameInput .highlight ();
|
|
40
|
-
})
|
|
41
|
-
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
$(nameInput) .add (descriptionInput) .on ("keydown.exportNodePopover", event =>
|
|
42
58
|
{
|
|
43
59
|
if (event .key !== "Enter")
|
|
44
60
|
return;
|
|
@@ -50,12 +66,13 @@ $.fn.exportNodePopover = function (node, oldExportedName)
|
|
|
50
66
|
if (!nameInput .val ())
|
|
51
67
|
return;
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
const
|
|
70
|
+
exportedName = nameInput .val () !== oldExportedName
|
|
71
|
+
? scene .getUniqueExportName (nameInput .val ())
|
|
72
|
+
: oldExportedName,
|
|
73
|
+
description = descriptionInput .val ();
|
|
57
74
|
|
|
58
|
-
Editor .updateExportedNode (scene, exportedName, oldExportedName, node);
|
|
75
|
+
Editor .updateExportedNode (scene, exportedName, oldExportedName, node, description);
|
|
59
76
|
});
|
|
60
77
|
|
|
61
78
|
setTimeout (() => nameInput .trigger ("select"), 1);
|
|
@@ -9,7 +9,7 @@ const
|
|
|
9
9
|
require ("./Popover");
|
|
10
10
|
require ("../Bits/Validate");
|
|
11
11
|
|
|
12
|
-
$.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName)
|
|
12
|
+
$.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName, oldDescription = "")
|
|
13
13
|
{
|
|
14
14
|
// Create content.
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName)
|
|
|
18
18
|
const content = $("<div></div>");
|
|
19
19
|
|
|
20
20
|
$("<span></span>")
|
|
21
|
-
.text (
|
|
21
|
+
.text ("Imported Name")
|
|
22
22
|
.appendTo (content);
|
|
23
23
|
|
|
24
24
|
const nameInput = $("<input></input>")
|
|
@@ -26,19 +26,35 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName)
|
|
|
26
26
|
.val (oldImportedName || executionContext .getUniqueImportName (exportedName))
|
|
27
27
|
.appendTo (content);
|
|
28
28
|
|
|
29
|
+
$("<span></span>")
|
|
30
|
+
.text ("Description")
|
|
31
|
+
.appendTo (content);
|
|
32
|
+
|
|
33
|
+
const descriptionInput = $("<input></input>")
|
|
34
|
+
.attr ("placeholder", _("Enter description"))
|
|
35
|
+
.val (oldDescription)
|
|
36
|
+
.appendTo (content);
|
|
37
|
+
|
|
29
38
|
// Create tooltip.
|
|
30
39
|
|
|
31
40
|
const tooltip = this .popover ({
|
|
32
41
|
content: content,
|
|
42
|
+
extension:
|
|
43
|
+
{
|
|
44
|
+
wide: true,
|
|
45
|
+
},
|
|
33
46
|
events: {
|
|
34
47
|
show: (event, api) =>
|
|
35
48
|
{
|
|
49
|
+
$(nameInput) .add (descriptionInput) .off ();
|
|
50
|
+
|
|
36
51
|
nameInput .off () .validate (Editor .Id, () =>
|
|
37
52
|
{
|
|
38
53
|
electron .shell .beep ();
|
|
39
54
|
nameInput .highlight ();
|
|
40
|
-
})
|
|
41
|
-
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
$(nameInput) .add (descriptionInput) .on ("keydown.importNodePopover", event =>
|
|
42
58
|
{
|
|
43
59
|
if (event .key !== "Enter")
|
|
44
60
|
return;
|
|
@@ -50,12 +66,13 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName)
|
|
|
50
66
|
if (!nameInput .val ())
|
|
51
67
|
return;
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
const
|
|
70
|
+
importedName = nameInput .val () !== oldImportedName
|
|
71
|
+
? executionContext .getUniqueImportName (nameInput .val ())
|
|
72
|
+
: oldImportedName,
|
|
73
|
+
description = descriptionInput .val ();
|
|
57
74
|
|
|
58
|
-
Editor .updateImportedNode (executionContext, inlineNode, exportedName, importedName, oldImportedName);
|
|
75
|
+
Editor .updateImportedNode (executionContext, inlineNode, exportedName, importedName, oldImportedName, description);
|
|
59
76
|
});
|
|
60
77
|
|
|
61
78
|
setTimeout (() => nameInput .trigger ("select"), 1);
|
|
@@ -18,10 +18,10 @@ $.fn.materialPreviewPopover = async function (node)
|
|
|
18
18
|
|
|
19
19
|
const canvas = $("<x3d-canvas></x3d-canvas>")
|
|
20
20
|
.css ({ width: "30vh", height: "30vh" })
|
|
21
|
-
.attr ("cache", false)
|
|
22
|
-
.attr ("splashScreen", false)
|
|
23
|
-
.attr ("contextMenu", false)
|
|
24
|
-
.attr ("notifications", false)
|
|
21
|
+
.attr ("cache", "false")
|
|
22
|
+
.attr ("splashScreen", "false")
|
|
23
|
+
.attr ("contextMenu", "false")
|
|
24
|
+
.attr ("notifications", "false")
|
|
25
25
|
.attr ("colorSpace", node .getBrowser () .getBrowserOption ("ColorSpace"))
|
|
26
26
|
.attr ("xrSessionMode", "NONE")
|
|
27
27
|
.appendTo (preview);
|
|
@@ -42,10 +42,10 @@ $.fn.texturePreviewPopover = async function (node)
|
|
|
42
42
|
const canvas = $("<x3d-canvas></x3d-canvas>")
|
|
43
43
|
.css ("width","30vh")
|
|
44
44
|
.css ("height", "30vh")
|
|
45
|
-
.attr ("cache", false)
|
|
46
|
-
.attr ("splashScreen", false)
|
|
47
|
-
.attr ("contextMenu", false)
|
|
48
|
-
.attr ("notifications", false)
|
|
45
|
+
.attr ("cache", "false")
|
|
46
|
+
.attr ("splashScreen", "false")
|
|
47
|
+
.attr ("contextMenu", "false")
|
|
48
|
+
.attr ("notifications", "false")
|
|
49
49
|
.attr ("colorSpace", node .getBrowser () .getBrowserOption ("ColorSpace"))
|
|
50
50
|
.attr ("xrSessionMode", "NONE")
|
|
51
51
|
.appendTo (preview);
|
|
@@ -849,7 +849,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
849
849
|
element = $(`#${id}`),
|
|
850
850
|
exportedNode = this .objects .get (parseInt (element .attr ("exported-node-id")));
|
|
851
851
|
|
|
852
|
-
element .find ("> .item") .exportNodePopover (exportedNode .getLocalNode (), exportedNode .getExportedName ());
|
|
852
|
+
element .find ("> .item") .exportNodePopover (exportedNode .getLocalNode (), exportedNode .getExportedName (), exportedNode .getDescription ());
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
removeExportedNode (id)
|
|
@@ -870,7 +870,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
870
870
|
exportedNode = this .objects .get (parseInt (element .attr ("exported-node-id"))),
|
|
871
871
|
inlineNode = this .getNode (element .closest (".node", this .sceneGraph));
|
|
872
872
|
|
|
873
|
-
element .find ("> .item") .importNodePopover (inlineNode, exportedNode .getExportedName ());
|
|
873
|
+
element .find ("> .item") .importNodePopover (inlineNode, exportedNode .getExportedName (), "", exportedNode .getDescription ());
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
editImportedNode (id)
|
|
@@ -881,7 +881,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
881
881
|
element = $(`#${id}`),
|
|
882
882
|
importedNode = this .objects .get (parseInt (element .attr ("imported-node-id")));
|
|
883
883
|
|
|
884
|
-
element .find ("> .item") .importNodePopover (importedNode .getInlineNode (), importedNode .getExportedName (), importedNode .getImportedName ());
|
|
884
|
+
element .find ("> .item") .importNodePopover (importedNode .getInlineNode (), importedNode .getExportedName (), importedNode .getImportedName (), importedNode .getDescription ());
|
|
885
885
|
}
|
|
886
886
|
|
|
887
887
|
removeImportedNode (id)
|
|
@@ -1438,7 +1438,8 @@ module .exports = class OutlineView extends Interface
|
|
|
1438
1438
|
.addClass (classes)
|
|
1439
1439
|
.attr ("node-id", node .getId ())
|
|
1440
1440
|
.attr ("imported-node-id", importedNode .getId ())
|
|
1441
|
-
.attr ("index", index)
|
|
1441
|
+
.attr ("index", index)
|
|
1442
|
+
.attr ("title", importedNode .getDescription ());
|
|
1442
1443
|
|
|
1443
1444
|
// Icon
|
|
1444
1445
|
|
|
@@ -1529,7 +1530,8 @@ module .exports = class OutlineView extends Interface
|
|
|
1529
1530
|
const child = $("<li></li>")
|
|
1530
1531
|
.addClass (type)
|
|
1531
1532
|
.attr ("exported-node-id", exportedNode .getId ())
|
|
1532
|
-
.attr ("node-id", node .getId ())
|
|
1533
|
+
.attr ("node-id", node .getId ())
|
|
1534
|
+
.attr ("title", exportedNode .getDescription ());
|
|
1533
1535
|
|
|
1534
1536
|
// Icon
|
|
1535
1537
|
|
|
@@ -1577,7 +1579,7 @@ module .exports = class OutlineView extends Interface
|
|
|
1577
1579
|
}
|
|
1578
1580
|
|
|
1579
1581
|
static connectorId = 0;
|
|
1580
|
-
static urlFields = new Set (["url", "frontUrl", "backUrl", "leftUrl", "rightUrl", "topUrl", "bottomUrl"
|
|
1582
|
+
static urlFields = new Set (["url", "frontUrl", "backUrl", "leftUrl", "rightUrl", "topUrl", "bottomUrl"]);
|
|
1581
1583
|
|
|
1582
1584
|
#fieldSymbol = Symbol ();
|
|
1583
1585
|
#fieldButtonSymbol = Symbol ();
|
|
@@ -45,7 +45,7 @@ class AudioParser extends X3D .X3DParser
|
|
|
45
45
|
|
|
46
46
|
scene .setEncoding ("AUDIO");
|
|
47
47
|
scene .setProfile (browser .getProfile ("Interchange"));
|
|
48
|
-
scene .
|
|
48
|
+
scene .updateComponent (browser .getComponent ("Sound", 1));
|
|
49
49
|
|
|
50
50
|
await this .loadComponents ();
|
|
51
51
|
|
|
@@ -45,7 +45,7 @@ class ImageParser extends X3D .X3DParser
|
|
|
45
45
|
|
|
46
46
|
scene .setEncoding ("IMAGE");
|
|
47
47
|
scene .setProfile (browser .getProfile ("Interchange"));
|
|
48
|
-
scene .
|
|
48
|
+
scene .updateComponent (browser .getComponent ("Geometry2D", 1));
|
|
49
49
|
|
|
50
50
|
await this .loadComponents ();
|
|
51
51
|
|
|
@@ -45,8 +45,8 @@ class VideoParser extends X3D .X3DParser
|
|
|
45
45
|
|
|
46
46
|
scene .setEncoding ("VIDEO");
|
|
47
47
|
scene .setProfile (browser .getProfile ("Interchange"));
|
|
48
|
-
scene .
|
|
49
|
-
scene .
|
|
48
|
+
scene .updateComponent (browser .getComponent ("Geometry2D", 1));
|
|
49
|
+
scene .updateComponent (browser .getComponent ("Sound", 1));
|
|
50
50
|
|
|
51
51
|
await this .loadComponents ();
|
|
52
52
|
|
package/src/Undo/Editor.js
CHANGED
|
@@ -196,7 +196,7 @@ module .exports = class Editor
|
|
|
196
196
|
scene .setProfile (browser .getProfile ("Core"));
|
|
197
197
|
|
|
198
198
|
for (const name of componentNames)
|
|
199
|
-
scene .
|
|
199
|
+
scene .updateComponent (browser .getComponent (name));
|
|
200
200
|
|
|
201
201
|
// Add nodes.
|
|
202
202
|
|
|
@@ -378,7 +378,7 @@ module .exports = class Editor
|
|
|
378
378
|
{
|
|
379
379
|
for (const exportedNode of tempScene .exportedNodes)
|
|
380
380
|
{
|
|
381
|
-
this .updateExportedNode (executionContext, executionContext .getUniqueExportName (exportedNode .getExportedName ()), "", exportedNode .getLocalNode (), undoManager);
|
|
381
|
+
this .updateExportedNode (executionContext, executionContext .getUniqueExportName (exportedNode .getExportedName ()), "", exportedNode .getLocalNode (), exportedNode .getDescription (), undoManager);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
@@ -538,7 +538,6 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
static absoluteURL = new RegExp ("^(?:[a-z]+:|//)", "i");
|
|
541
|
-
static fontFamilies = new Set (["SERIF", "SANS", "TYPEWRITER"]);
|
|
542
541
|
|
|
543
542
|
/**
|
|
544
543
|
*
|
|
@@ -555,23 +554,17 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
555
554
|
for (const object of Traverse .traverse (objects, Traverse .EXTERNPROTO_DECLARATIONS | Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES))
|
|
556
555
|
{
|
|
557
556
|
const
|
|
558
|
-
node
|
|
559
|
-
urlObject
|
|
560
|
-
fontStyleNode = node .getType () .includes (X3D .X3DConstants .X3DFontStyleNode);
|
|
557
|
+
node = object instanceof X3D .SFNode ? object .getValue () : object,
|
|
558
|
+
urlObject = node .getType () .includes (X3D .X3DConstants .X3DUrlObject);
|
|
561
559
|
|
|
562
|
-
if (!
|
|
560
|
+
if (!urlObject)
|
|
563
561
|
continue;
|
|
564
562
|
|
|
565
563
|
const newURL = new X3D .MFString ();
|
|
566
564
|
|
|
567
565
|
for (const fileURL of node ._url)
|
|
568
566
|
{
|
|
569
|
-
if (
|
|
570
|
-
{
|
|
571
|
-
newURL .push (fileURL);
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
else if (this .absoluteURL .test (fileURL))
|
|
567
|
+
if (this .absoluteURL .test (fileURL))
|
|
575
568
|
{
|
|
576
569
|
try
|
|
577
570
|
{
|
|
@@ -762,9 +755,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
762
755
|
*/
|
|
763
756
|
static setComponents (scene, components, undoManager = UndoManager .shared)
|
|
764
757
|
{
|
|
765
|
-
const
|
|
766
|
-
browser = scene .getBrowser (),
|
|
767
|
-
oldComponents = Array .from (scene .getComponents ());
|
|
758
|
+
const oldComponents = Array .from (scene .getComponents ());
|
|
768
759
|
|
|
769
760
|
undoManager .beginUndo (_("Set Components of Scene"));
|
|
770
761
|
|
|
@@ -800,7 +791,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
800
791
|
|
|
801
792
|
undoManager .beginUndo (_("Add Component %s"), name);
|
|
802
793
|
|
|
803
|
-
scene .
|
|
794
|
+
scene .updateComponent (browser .getComponent (name));
|
|
804
795
|
|
|
805
796
|
undoManager .registerUndo (() =>
|
|
806
797
|
{
|
|
@@ -959,21 +950,30 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
959
950
|
* @param {string} importedName
|
|
960
951
|
* @param {UndoManager} undoManager
|
|
961
952
|
*/
|
|
962
|
-
static updateImportedNode (executionContext, inlineNode, exportedName, importedName, oldImportedName, undoManager = UndoManager .shared)
|
|
953
|
+
static updateImportedNode (executionContext, inlineNode, exportedName, importedName, oldImportedName, description, undoManager = UndoManager .shared)
|
|
963
954
|
{
|
|
964
955
|
inlineNode = inlineNode .valueOf ();
|
|
965
956
|
|
|
957
|
+
const oldDescription = executionContext .getImportedNodes () .get (oldImportedName) ?.getDescription ();
|
|
958
|
+
|
|
966
959
|
undoManager .beginUndo (_("Update Imported Node »%s«"), importedName);
|
|
967
960
|
|
|
968
961
|
if (oldImportedName)
|
|
969
|
-
|
|
962
|
+
{
|
|
963
|
+
if (importedName !== oldImportedName)
|
|
964
|
+
executionContext .renameImportedNode (oldImportedName, importedName);
|
|
965
|
+
|
|
966
|
+
executionContext .getImportedNodes () .get (importedName) .setDescription (description);
|
|
967
|
+
}
|
|
970
968
|
else
|
|
971
|
-
|
|
969
|
+
{
|
|
970
|
+
executionContext .updateImportedNode (inlineNode .valueOf (), exportedName, importedName, description);
|
|
971
|
+
}
|
|
972
972
|
|
|
973
973
|
undoManager .registerUndo (() =>
|
|
974
974
|
{
|
|
975
975
|
if (oldImportedName)
|
|
976
|
-
this .updateImportedNode (executionContext, inlineNode, exportedName, oldImportedName, importedName, undoManager);
|
|
976
|
+
this .updateImportedNode (executionContext, inlineNode, exportedName, oldImportedName, importedName, oldDescription, undoManager);
|
|
977
977
|
else
|
|
978
978
|
this .removeImportedNode (executionContext, importedName, undoManager);
|
|
979
979
|
});
|
|
@@ -995,6 +995,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
995
995
|
importedNode = executionContext .getImportedNodes () .get (importedName),
|
|
996
996
|
inlineNode = importedNode .getInlineNode (),
|
|
997
997
|
exportedName = importedNode .getExportedName (),
|
|
998
|
+
description = importedNode .getDescription (),
|
|
998
999
|
exportedNode = importedNode .getExportedNode ();
|
|
999
1000
|
|
|
1000
1001
|
const routes = executionContext .getRoutes () .filter (route =>
|
|
@@ -1059,7 +1060,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1059
1060
|
|
|
1060
1061
|
undoManager .registerUndo (() =>
|
|
1061
1062
|
{
|
|
1062
|
-
this .updateImportedNode (executionContext, inlineNode, exportedName, importedName, "", undoManager);
|
|
1063
|
+
this .updateImportedNode (executionContext, inlineNode, exportedName, importedName, "", description, undoManager);
|
|
1063
1064
|
|
|
1064
1065
|
const newImportedNode = executionContext .getImportedNodes () .get (importedName);
|
|
1065
1066
|
|
|
@@ -1087,21 +1088,30 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1087
1088
|
* @param {X3DNode} node
|
|
1088
1089
|
* @param {UndoManager} undoManager
|
|
1089
1090
|
*/
|
|
1090
|
-
static updateExportedNode (scene, exportedName, oldExportedName, node, undoManager = UndoManager .shared)
|
|
1091
|
+
static updateExportedNode (scene, exportedName, oldExportedName, node, description, undoManager = UndoManager .shared)
|
|
1091
1092
|
{
|
|
1092
1093
|
node = node .valueOf ();
|
|
1093
1094
|
|
|
1094
1095
|
undoManager .beginUndo (_("Update Exported Node »%s«"), exportedName);
|
|
1095
1096
|
|
|
1096
|
-
|
|
1097
|
-
scene .removeExportedNode (oldExportedName);
|
|
1097
|
+
const oldDescription = scene .getExportedNodes () .get (oldExportedName) ?.getDescription () ?? "";
|
|
1098
1098
|
|
|
1099
|
-
|
|
1099
|
+
if (exportedName === oldExportedName)
|
|
1100
|
+
{
|
|
1101
|
+
scene .getExportedNodes () .get (exportedName) ?.setDescription (description);
|
|
1102
|
+
}
|
|
1103
|
+
else
|
|
1104
|
+
{
|
|
1105
|
+
if (oldExportedName)
|
|
1106
|
+
scene .removeExportedNode (oldExportedName);
|
|
1107
|
+
|
|
1108
|
+
scene .updateExportedNode (exportedName, node, description);
|
|
1109
|
+
}
|
|
1100
1110
|
|
|
1101
1111
|
undoManager .registerUndo (() =>
|
|
1102
1112
|
{
|
|
1103
1113
|
if (oldExportedName)
|
|
1104
|
-
this .updateExportedNode (scene, oldExportedName, exportedName, node, undoManager);
|
|
1114
|
+
this .updateExportedNode (scene, oldExportedName, exportedName, node, oldDescription, undoManager);
|
|
1105
1115
|
else
|
|
1106
1116
|
this .removeExportedNode (scene, exportedName, undoManager);
|
|
1107
1117
|
});
|
|
@@ -1121,7 +1131,8 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1121
1131
|
{
|
|
1122
1132
|
const
|
|
1123
1133
|
exportedNode = scene .getExportedNodes () .get (exportedName),
|
|
1124
|
-
node = exportedNode .getLocalNode ()
|
|
1134
|
+
node = exportedNode .getLocalNode (),
|
|
1135
|
+
description = exportedNode .getDescription ();
|
|
1125
1136
|
|
|
1126
1137
|
undoManager .beginUndo (_("Remove Exported Node »%s«"), exportedName);
|
|
1127
1138
|
|
|
@@ -1129,7 +1140,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
1129
1140
|
|
|
1130
1141
|
undoManager .registerUndo (() =>
|
|
1131
1142
|
{
|
|
1132
|
-
this .updateExportedNode (scene, exportedName, "", node, undoManager);
|
|
1143
|
+
this .updateExportedNode (scene, exportedName, "", node, description, undoManager);
|
|
1133
1144
|
});
|
|
1134
1145
|
|
|
1135
1146
|
this .requestUpdateInstances (scene, undoManager);
|