sunrize 1.7.43 → 1.7.44
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 +1 -1
- package/src/Application/Application.js +17 -5
- package/src/Application/Dashboard.js +5 -2
- package/src/Application/Tabs.js +2 -1
- package/src/Editors/Library.js +2 -0
- package/src/Editors/LibraryPane.js +6 -1
- package/src/Editors/NodesLibrary.js +41 -1
- package/src/Editors/OutlineEditor.js +4 -4
- package/src/Editors/OutlineView.js +50 -19
- package/src/Editors/PrimitivesLibrary.js +58 -2
- package/src/Undo/Editor.js +11 -11
package/package.json
CHANGED
|
@@ -58,16 +58,17 @@ module .exports = class Application
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
this .config .setDefaultValues ({
|
|
61
|
-
position: [undefined, undefined],
|
|
62
|
-
size: [1100, 680],
|
|
63
|
-
maximized: false,
|
|
64
|
-
fullscreen: false,
|
|
65
61
|
autoSave: true,
|
|
62
|
+
browserUpdate: false,
|
|
66
63
|
expandExternProtoDeclarations: true,
|
|
67
|
-
expandPrototypeInstances: true,
|
|
68
64
|
expandInlineNodes: true,
|
|
65
|
+
expandPrototypeInstances: true,
|
|
66
|
+
fullscreen: false,
|
|
67
|
+
maximized: false,
|
|
68
|
+
position: [undefined, undefined],
|
|
69
69
|
recentDocuments: [ ],
|
|
70
70
|
recentLocations: [ ],
|
|
71
|
+
size: [1100, 680],
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
Template .create (path .join (__dirname, "../assets/html/application-template.html"));
|
|
@@ -286,6 +287,17 @@ module .exports = class Application
|
|
|
286
287
|
click: () => this .mainWindow .webContents .send ("reload"),
|
|
287
288
|
},
|
|
288
289
|
{ type: "separator" },
|
|
290
|
+
{
|
|
291
|
+
label: _("Default Play Button State"),
|
|
292
|
+
type: "checkbox",
|
|
293
|
+
checked: this .config .browserUpdate,
|
|
294
|
+
click: () =>
|
|
295
|
+
{
|
|
296
|
+
this .config .browserUpdate = !this .config .browserUpdate;
|
|
297
|
+
this .mainWindow .webContents .send ("browser-update", this .config .browserUpdate);
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{ type: "separator" },
|
|
289
301
|
{
|
|
290
302
|
label: _("Save"),
|
|
291
303
|
accelerator: "CmdOrCtrl+S",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const
|
|
4
4
|
$ = require ("jquery"),
|
|
5
|
+
electron = require ("electron"),
|
|
5
6
|
Interface = require ("./Interface"),
|
|
6
7
|
Editor = require("../Undo/Editor"),
|
|
7
8
|
_ = require ("./GetText");
|
|
@@ -65,18 +66,20 @@ module .exports = class Dashboard extends Interface
|
|
|
65
66
|
.text ("edit_note")
|
|
66
67
|
.appendTo (this .toolbar)
|
|
67
68
|
.on ("click", () => this .togglePanel (!this .config .file .panel));
|
|
69
|
+
|
|
70
|
+
electron .ipcRenderer .on ("browser-update", (event, value) => this .config .global .play = value);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
configure ()
|
|
71
74
|
{
|
|
72
75
|
this .config .file .setDefaultValues ({
|
|
73
76
|
pointer: "arrow",
|
|
74
|
-
play:
|
|
77
|
+
play: this .config .global .play,
|
|
75
78
|
panel: false,
|
|
76
79
|
});
|
|
77
80
|
|
|
78
81
|
this [this .config .file .pointer] ();
|
|
79
|
-
this .play (this .config .file .play && !this .isInitialScene);
|
|
82
|
+
this .play ((this .config .file .play) && !this .isInitialScene);
|
|
80
83
|
this .straighten (this .browser .getBrowserOption ("StraightenHorizon"));
|
|
81
84
|
|
|
82
85
|
if (this .config .file .panel)
|
package/src/Application/Tabs.js
CHANGED
package/src/Editors/Library.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
module .exports = class
|
|
3
|
+
module .exports = class LibraryPane
|
|
4
4
|
{
|
|
5
5
|
#library;
|
|
6
6
|
|
|
@@ -9,6 +9,11 @@ module .exports = class LibraryPanel
|
|
|
9
9
|
this .#library = library;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
get config ()
|
|
13
|
+
{
|
|
14
|
+
return this .#library .config;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
get browser ()
|
|
13
18
|
{
|
|
14
19
|
return this .#library .browser;
|
|
@@ -17,6 +17,14 @@ module .exports = class NodesLibrary extends LibraryPane
|
|
|
17
17
|
|
|
18
18
|
open ()
|
|
19
19
|
{
|
|
20
|
+
// Set default config values.
|
|
21
|
+
|
|
22
|
+
this .config .global .setDefaultValues ({
|
|
23
|
+
recentNodes: [ ],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Clear output.
|
|
27
|
+
|
|
20
28
|
this .#list ?.remove ();
|
|
21
29
|
this .#list = undefined;
|
|
22
30
|
}
|
|
@@ -48,7 +56,32 @@ module .exports = class NodesLibrary extends LibraryPane
|
|
|
48
56
|
.sort ((a, b) => a .typeName .localeCompare (b .typeName))
|
|
49
57
|
.sort ((a, b) => a .componentInfo .name .localeCompare (b .componentInfo .name));
|
|
50
58
|
|
|
51
|
-
//
|
|
59
|
+
// Get recently used elements.
|
|
60
|
+
|
|
61
|
+
const recentNodes = this .config .global .recentNodes .map (typeName => this .browser .getConcreteNode (typeName));
|
|
62
|
+
|
|
63
|
+
// Create list for recently used elements.
|
|
64
|
+
|
|
65
|
+
if (recentNodes .length)
|
|
66
|
+
{
|
|
67
|
+
$("<li></li>")
|
|
68
|
+
.addClass ("component")
|
|
69
|
+
.attr ("name", "recent")
|
|
70
|
+
.text ("Recently Used Nodes")
|
|
71
|
+
.appendTo (this .#list);
|
|
72
|
+
|
|
73
|
+
for (const node of recentNodes)
|
|
74
|
+
{
|
|
75
|
+
$("<li></li>")
|
|
76
|
+
.addClass ("node")
|
|
77
|
+
.text (node .typeName)
|
|
78
|
+
.attr ("componentName", node .componentInfo .name)
|
|
79
|
+
.appendTo (this .#list)
|
|
80
|
+
.on ("dblclick", () => this .createNode (node .typeName, node .componentInfo .name));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Create list for proto elements.
|
|
52
85
|
|
|
53
86
|
if (protos .length)
|
|
54
87
|
{
|
|
@@ -129,6 +162,13 @@ module .exports = class NodesLibrary extends LibraryPane
|
|
|
129
162
|
|
|
130
163
|
async createNode (typeName, componentName)
|
|
131
164
|
{
|
|
165
|
+
const recentNodes = this .config .global .recentNodes .filter (name => name !== typeName);
|
|
166
|
+
|
|
167
|
+
recentNodes .unshift (typeName);
|
|
168
|
+
recentNodes .splice (10);
|
|
169
|
+
|
|
170
|
+
this .config .global .recentNodes = recentNodes;
|
|
171
|
+
|
|
132
172
|
UndoManager .shared .beginUndo (_("Create Node %s"), typeName);
|
|
133
173
|
|
|
134
174
|
await Editor .addComponent (this .executionContext, componentName);
|
|
@@ -1909,7 +1909,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1909
1909
|
|
|
1910
1910
|
const
|
|
1911
1911
|
target = $(event .target),
|
|
1912
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
1912
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
1913
1913
|
layerNode = this .getNode (element),
|
|
1914
1914
|
layerSet = this .browser .getWorld () .getLayerSet (),
|
|
1915
1915
|
index = layerSet ._layers .findIndex (node => node ?.getValue () .valueOf () === layerNode);
|
|
@@ -1927,7 +1927,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1927
1927
|
{
|
|
1928
1928
|
const
|
|
1929
1929
|
target = $(event .target),
|
|
1930
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
1930
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
1931
1931
|
node = this .getNode (element);
|
|
1932
1932
|
|
|
1933
1933
|
event .preventDefault ();
|
|
@@ -1952,7 +1952,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1952
1952
|
{
|
|
1953
1953
|
const
|
|
1954
1954
|
target = $(event .target),
|
|
1955
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
1955
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
1956
1956
|
node = this .getNode (element);
|
|
1957
1957
|
|
|
1958
1958
|
event .preventDefault ();
|
|
@@ -1965,7 +1965,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1965
1965
|
{
|
|
1966
1966
|
const
|
|
1967
1967
|
target = $(event .target),
|
|
1968
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
1968
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
1969
1969
|
node = this .getNode (element);
|
|
1970
1970
|
|
|
1971
1971
|
event .preventDefault ();
|
|
@@ -1092,6 +1092,9 @@ module .exports = class OutlineView extends Interface
|
|
|
1092
1092
|
{
|
|
1093
1093
|
case X3D .X3DConstants .X3DLayerNode:
|
|
1094
1094
|
{
|
|
1095
|
+
if (node .getExecutionContext () !== this .executionContext)
|
|
1096
|
+
continue;
|
|
1097
|
+
|
|
1095
1098
|
buttons .push ($("<span></span>")
|
|
1096
1099
|
.attr ("order", "2")
|
|
1097
1100
|
.attr ("title", _("Activate layer."))
|
|
@@ -1247,7 +1250,9 @@ module .exports = class OutlineView extends Interface
|
|
|
1247
1250
|
if (!this .browser .getActiveLayer ())
|
|
1248
1251
|
return;
|
|
1249
1252
|
|
|
1250
|
-
this .sceneGraph .find (`.node[node-id=${this .browser .getActiveLayer () .getId ()}],
|
|
1253
|
+
this .sceneGraph .find (`.node[node-id=${this .browser .getActiveLayer () .getId ()}],
|
|
1254
|
+
.imported-node[node-id=${this .browser .getActiveLayer () .getId ()}],
|
|
1255
|
+
.exported-node[node-id=${this .browser .getActiveLayer () .getId ()}]`)
|
|
1251
1256
|
.find ("> .item .activate-layer")
|
|
1252
1257
|
.removeClass ("off")
|
|
1253
1258
|
.addClass ("green");
|
|
@@ -1256,7 +1261,9 @@ module .exports = class OutlineView extends Interface
|
|
|
1256
1261
|
updateNodeBound (node)
|
|
1257
1262
|
{
|
|
1258
1263
|
this .sceneGraph
|
|
1259
|
-
.find (`.node[node-id=${node .getId ()}],
|
|
1264
|
+
.find (`.node[node-id=${node .getId ()}],
|
|
1265
|
+
.imported-node[node-id=${node .getId ()}],
|
|
1266
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
1260
1267
|
.find ("> .item .bind-node")
|
|
1261
1268
|
.removeClass (["on", "off"])
|
|
1262
1269
|
.addClass (node ._isBound .getValue () ? "on" : "off")
|
|
@@ -1268,7 +1275,10 @@ module .exports = class OutlineView extends Interface
|
|
|
1268
1275
|
const [className] = this .getLoadState (node .checkLoadState (), node .getTypeName ());
|
|
1269
1276
|
|
|
1270
1277
|
this .sceneGraph
|
|
1271
|
-
.find (`.node[node-id=${node .getId ()}],
|
|
1278
|
+
.find (`.node[node-id=${node .getId ()}],
|
|
1279
|
+
.imported-node[node-id=${node .getId ()}],
|
|
1280
|
+
.exported-node[node-id=${node .getId ()}],
|
|
1281
|
+
.externproto[node-id=${node .getId ()}]`)
|
|
1272
1282
|
.find ("> .item .reload-node")
|
|
1273
1283
|
.removeClass (["not-started-state", "in-progress-state", "complete-state", "failed-state"])
|
|
1274
1284
|
.addClass (className);
|
|
@@ -1279,7 +1289,9 @@ module .exports = class OutlineView extends Interface
|
|
|
1279
1289
|
const buttons = [ ];
|
|
1280
1290
|
|
|
1281
1291
|
buttons .push (this .sceneGraph
|
|
1282
|
-
.find (`.node[node-id=${node .getId ()}],
|
|
1292
|
+
.find (`.node[node-id=${node .getId ()}],
|
|
1293
|
+
.imported-node[node-id=${node .getId ()}],
|
|
1294
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
1283
1295
|
.find ("> .item .play-node")
|
|
1284
1296
|
.removeClass (["on", "off"])
|
|
1285
1297
|
.addClass (node ._isPaused .getValue () ? "on" : "off")
|
|
@@ -1287,13 +1299,17 @@ module .exports = class OutlineView extends Interface
|
|
|
1287
1299
|
.text (node ._isActive .getValue () ? "pause" : "play_arrow"));
|
|
1288
1300
|
|
|
1289
1301
|
buttons .push (this .sceneGraph
|
|
1290
|
-
.find (`.node[node-id=${node .getId ()}],
|
|
1302
|
+
.find (`.node[node-id=${node .getId ()}],
|
|
1303
|
+
.imported-node[node-id=${node .getId ()}],
|
|
1304
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
1291
1305
|
.find ("> .item .stop-node")
|
|
1292
1306
|
.removeClass (["on", "off"])
|
|
1293
1307
|
.addClass (node ._isActive .getValue () ? "on" : "off"));
|
|
1294
1308
|
|
|
1295
1309
|
buttons .push (this .sceneGraph
|
|
1296
|
-
.find (`.node[node-id=${node .getId ()}],
|
|
1310
|
+
.find (`.node[node-id=${node .getId ()}],
|
|
1311
|
+
.imported-node[node-id=${node .getId ()}],
|
|
1312
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
1297
1313
|
.find ("> .item .loop-node")
|
|
1298
1314
|
.removeClass (["on", "off"])
|
|
1299
1315
|
.addClass (node ._loop .getValue () ? "on" : "off"));
|
|
@@ -1309,7 +1325,7 @@ module .exports = class OutlineView extends Interface
|
|
|
1309
1325
|
|
|
1310
1326
|
isInParents (parent, node)
|
|
1311
1327
|
{
|
|
1312
|
-
return parent .closest (
|
|
1328
|
+
return parent .closest (`.node[node-id=${node .getId ()}]`, this .sceneGraph) .length;
|
|
1313
1329
|
}
|
|
1314
1330
|
|
|
1315
1331
|
#importedNodeSymbol = Symbol ();
|
|
@@ -2710,7 +2726,9 @@ module .exports = class OutlineView extends Interface
|
|
|
2710
2726
|
|
|
2711
2727
|
nodeCloseClones (element)
|
|
2712
2728
|
{
|
|
2713
|
-
const opened = this .sceneGraph .find (`.node[node-id=${element .attr ("node-id")}],
|
|
2729
|
+
const opened = this .sceneGraph .find (`.node[node-id=${element .attr ("node-id")}],
|
|
2730
|
+
.imported-node[node-id=${element .attr ("node-id")}],
|
|
2731
|
+
.exported-node[node-id=${element .attr ("node-id")}]`);
|
|
2714
2732
|
|
|
2715
2733
|
opened .each (function (key, value)
|
|
2716
2734
|
{
|
|
@@ -2916,6 +2934,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2916
2934
|
|
|
2917
2935
|
// If node is somewhere else, don't disconnect.
|
|
2918
2936
|
if (Array .from (this .sceneGraph .find (`.node[node-id="${node .getId ()}"],
|
|
2937
|
+
.imported-node[node-id="${node .getId ()}"],
|
|
2919
2938
|
.exported-node[node-id="${node .getId ()}"]`))
|
|
2920
2939
|
.some (s => !$(s) .closest (element) .length))
|
|
2921
2940
|
{
|
|
@@ -3021,7 +3040,7 @@ module .exports = class OutlineView extends Interface
|
|
|
3021
3040
|
const
|
|
3022
3041
|
icon = $(event .currentTarget) ,
|
|
3023
3042
|
item = icon .closest (".item", this .sceneGraph),
|
|
3024
|
-
element = icon .closest (".node, .exported-node", this .sceneGraph),
|
|
3043
|
+
element = icon .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
3025
3044
|
node = this .objects .get (parseInt (element .attr ("node-id"))),
|
|
3026
3045
|
on = !!item .attr ("data-hasqtip");
|
|
3027
3046
|
|
|
@@ -3092,7 +3111,7 @@ module .exports = class OutlineView extends Interface
|
|
|
3092
3111
|
{
|
|
3093
3112
|
const
|
|
3094
3113
|
target = $(event .target),
|
|
3095
|
-
element = target .closest (".node, .
|
|
3114
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
3096
3115
|
node = this .getNode (element),
|
|
3097
3116
|
hidden = !node .isHidden ();
|
|
3098
3117
|
|
|
@@ -3101,7 +3120,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3101
3120
|
|
|
3102
3121
|
node .setHidden (hidden);
|
|
3103
3122
|
|
|
3104
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3123
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3124
|
+
.imported-node[node-id=${node .getId ()}],
|
|
3125
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
3105
3126
|
.find ("> .item .toggle-visibility")
|
|
3106
3127
|
.removeClass (["on", "off"])
|
|
3107
3128
|
.addClass (hidden ? "off" : "on")
|
|
@@ -3112,7 +3133,7 @@ module .exports = class OutlineView extends Interface
|
|
|
3112
3133
|
{
|
|
3113
3134
|
const
|
|
3114
3135
|
target = $(event .target),
|
|
3115
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
3136
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
3116
3137
|
node = this .getNode (element),
|
|
3117
3138
|
tool = node .getTool ();
|
|
3118
3139
|
|
|
@@ -3131,7 +3152,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3131
3152
|
|
|
3132
3153
|
node .setUserData (_changing, true);
|
|
3133
3154
|
|
|
3134
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}] > .item .toggle-tool,
|
|
3155
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}] > .item .toggle-tool,
|
|
3156
|
+
.imported-node[node-id=${node .getId ()}] > .item .toggle-tool,
|
|
3157
|
+
.exported-node[node-id=${node .getId ()}] > .item .toggle-tool`)
|
|
3135
3158
|
.removeClass (["on", "off"])
|
|
3136
3159
|
.addClass (tool ? "off" : "on");
|
|
3137
3160
|
}
|
|
@@ -3142,7 +3165,7 @@ module .exports = class OutlineView extends Interface
|
|
|
3142
3165
|
{
|
|
3143
3166
|
const
|
|
3144
3167
|
target = $(event .target),
|
|
3145
|
-
element = target .closest (".node, .exported-node", this .sceneGraph),
|
|
3168
|
+
element = target .closest (".node, .imported-node, .exported-node", this .sceneGraph),
|
|
3146
3169
|
node = this .getNode (element);
|
|
3147
3170
|
|
|
3148
3171
|
event .preventDefault ();
|
|
@@ -3161,7 +3184,7 @@ module .exports = class OutlineView extends Interface
|
|
|
3161
3184
|
{
|
|
3162
3185
|
const
|
|
3163
3186
|
target = $(event .target),
|
|
3164
|
-
element = target .closest (".node, .exported-node, .externproto", this .sceneGraph),
|
|
3187
|
+
element = target .closest (".node, .imported-node, .exported-node, .externproto", this .sceneGraph),
|
|
3165
3188
|
item = target .closest (".item"),
|
|
3166
3189
|
node = this .getNode (element);
|
|
3167
3190
|
|
|
@@ -3196,7 +3219,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3196
3219
|
|
|
3197
3220
|
node .setHidden (node .getType () .includes (X3D .X3DConstants .X3DShapeNode));
|
|
3198
3221
|
|
|
3199
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3222
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3223
|
+
.imported-node[node-id=${node .getId ()}],
|
|
3224
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
3200
3225
|
.find ("> .item .toggle-visibility")
|
|
3201
3226
|
.removeClass (["on", "off"])
|
|
3202
3227
|
.addClass (node .isHidden () ? "off" : "on")
|
|
@@ -3222,7 +3247,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3222
3247
|
|
|
3223
3248
|
node .setHidden (false);
|
|
3224
3249
|
|
|
3225
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3250
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3251
|
+
.imported-node[node-id=${node .getId ()}],
|
|
3252
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
3226
3253
|
.find ("> .item .toggle-visibility")
|
|
3227
3254
|
.removeClass ("off")
|
|
3228
3255
|
.addClass ("on")
|
|
@@ -3246,7 +3273,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3246
3273
|
|
|
3247
3274
|
node .setHidden (false);
|
|
3248
3275
|
|
|
3249
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3276
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3277
|
+
.imported-node[node-id=${node .getId ()}],
|
|
3278
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
3250
3279
|
.find ("> .item .toggle-visibility")
|
|
3251
3280
|
.removeClass ("off")
|
|
3252
3281
|
.addClass ("on")
|
|
@@ -3268,7 +3297,9 @@ module .exports = class OutlineView extends Interface
|
|
|
3268
3297
|
|
|
3269
3298
|
node .setHidden (false);
|
|
3270
3299
|
|
|
3271
|
-
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3300
|
+
this .sceneGraph .find (`.node[node-id=${node .getId ()}],
|
|
3301
|
+
.imported-node[node-id=${node .getId ()}],
|
|
3302
|
+
.exported-node[node-id=${node .getId ()}]`)
|
|
3272
3303
|
.find ("> .item .toggle-visibility")
|
|
3273
3304
|
.removeClass ("off")
|
|
3274
3305
|
.addClass ("on")
|
|
@@ -11,6 +11,20 @@ module .exports = class PrimitivesLibrary extends LibraryPane
|
|
|
11
11
|
|
|
12
12
|
#list;
|
|
13
13
|
|
|
14
|
+
open ()
|
|
15
|
+
{
|
|
16
|
+
// Set default config values.
|
|
17
|
+
|
|
18
|
+
this .config .global .setDefaultValues ({
|
|
19
|
+
recentPrimitives: [ ],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Clear output.
|
|
23
|
+
|
|
24
|
+
this .#list ?.remove ();
|
|
25
|
+
this .#list = undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
14
28
|
update ()
|
|
15
29
|
{
|
|
16
30
|
// Fill output.
|
|
@@ -33,6 +47,30 @@ module .exports = class PrimitivesLibrary extends LibraryPane
|
|
|
33
47
|
.sort ((a, b) => a .typeName .localeCompare (b .typeName))
|
|
34
48
|
.sort ((a, b) => a .componentInfo .name .localeCompare (b .componentInfo .name));
|
|
35
49
|
|
|
50
|
+
// Get recently used primitives.
|
|
51
|
+
|
|
52
|
+
const recentPrimitives = this .config .global .recentPrimitives;
|
|
53
|
+
|
|
54
|
+
// Create list for recently used elements.
|
|
55
|
+
|
|
56
|
+
if (recentPrimitives .length)
|
|
57
|
+
{
|
|
58
|
+
$("<li></li>")
|
|
59
|
+
.addClass ("component")
|
|
60
|
+
.attr ("name", "recent")
|
|
61
|
+
.text ("Recently Used Primitives")
|
|
62
|
+
.appendTo (this .#list);
|
|
63
|
+
|
|
64
|
+
for (const typeName of recentPrimitives)
|
|
65
|
+
{
|
|
66
|
+
$("<li></li>")
|
|
67
|
+
.addClass ("node")
|
|
68
|
+
.text (typeName)
|
|
69
|
+
.appendTo (this .#list)
|
|
70
|
+
.on ("dblclick", () => this .createRecentNode (nodes, typeName));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
36
74
|
// Create list elements.
|
|
37
75
|
|
|
38
76
|
let componentName = "";
|
|
@@ -52,9 +90,27 @@ module .exports = class PrimitivesLibrary extends LibraryPane
|
|
|
52
90
|
$("<li></li>")
|
|
53
91
|
.addClass ("node")
|
|
54
92
|
.text (node .typeName)
|
|
55
|
-
.attr ("x3dSyntax", node .x3dSyntax)
|
|
56
93
|
.appendTo (this .#list)
|
|
57
|
-
.on ("dblclick", () => this .
|
|
94
|
+
.on ("dblclick", () => this .createNode (node));
|
|
58
95
|
}
|
|
59
96
|
}
|
|
97
|
+
|
|
98
|
+
createRecentNode (nodes, typeName)
|
|
99
|
+
{
|
|
100
|
+
const node = nodes .find (node => node .typeName === typeName);
|
|
101
|
+
|
|
102
|
+
this .createNode (node);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
createNode ({ typeName, x3dSyntax})
|
|
106
|
+
{
|
|
107
|
+
const recentPrimitives = this .config .global .recentPrimitives .filter (name => name !== typeName);
|
|
108
|
+
|
|
109
|
+
recentPrimitives .unshift (typeName);
|
|
110
|
+
recentPrimitives .splice (10);
|
|
111
|
+
|
|
112
|
+
this .config .global .recentPrimitives = recentPrimitives;
|
|
113
|
+
|
|
114
|
+
this .importX3D (typeName, x3dSyntax);
|
|
115
|
+
}
|
|
60
116
|
};
|
package/src/Undo/Editor.js
CHANGED
|
@@ -680,7 +680,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
680
680
|
|
|
681
681
|
// Remove imported nodes if node is an Inline node.
|
|
682
682
|
|
|
683
|
-
for (const importedNode of executionContext .getImportedNodes ())
|
|
683
|
+
for (const importedNode of Array .from (executionContext .getImportedNodes ()))
|
|
684
684
|
{
|
|
685
685
|
if (importedNode .getInlineNode () .valueOf () === node)
|
|
686
686
|
this .removeImportedNode (executionContext, importedNode .getImportedName (), undoManager);
|
|
@@ -690,7 +690,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
690
690
|
|
|
691
691
|
if (executionContext instanceof X3D .X3DScene)
|
|
692
692
|
{
|
|
693
|
-
for (const exportedNode of executionContext .getExportedNodes ())
|
|
693
|
+
for (const exportedNode of Array .from (executionContext .getExportedNodes ()))
|
|
694
694
|
{
|
|
695
695
|
if (exportedNode .getLocalNode () .valueOf () === node)
|
|
696
696
|
this .removeExportedNode (executionContext, exportedNode .getExportedName (), undoManager);
|
|
@@ -2996,12 +2996,12 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
2996
2996
|
const
|
|
2997
2997
|
instance = node .getType () .includes (X3D .X3DConstants .X3DPrototypeInstance),
|
|
2998
2998
|
name = field .getName (),
|
|
2999
|
-
|
|
2999
|
+
auxiliary = field .create ();
|
|
3000
3000
|
|
|
3001
|
-
|
|
3002
|
-
|
|
3001
|
+
auxiliary .setUnit (field .getUnit ());
|
|
3002
|
+
auxiliary .fromString (string, executionContext);
|
|
3003
3003
|
|
|
3004
|
-
if (
|
|
3004
|
+
if (auxiliary .equals (field))
|
|
3005
3005
|
{
|
|
3006
3006
|
field .addEvent ();
|
|
3007
3007
|
return;
|
|
@@ -3014,7 +3014,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
3014
3014
|
else
|
|
3015
3015
|
undoManager .beginUndo (_("Change Field »%s« of Node %s"), field .getName (), node .getTypeName ());
|
|
3016
3016
|
|
|
3017
|
-
field .assign (
|
|
3017
|
+
field .assign (auxiliary);
|
|
3018
3018
|
|
|
3019
3019
|
if (node .isDefaultValue (field))
|
|
3020
3020
|
field .setModificationTime (0);
|
|
@@ -3045,11 +3045,11 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
3045
3045
|
const
|
|
3046
3046
|
instance = node .getType () .includes (X3D .X3DConstants .X3DPrototypeInstance),
|
|
3047
3047
|
name = field .getName (),
|
|
3048
|
-
|
|
3048
|
+
auxiliary = field .create ();
|
|
3049
3049
|
|
|
3050
|
-
|
|
3050
|
+
auxiliary .setValue (value);
|
|
3051
3051
|
|
|
3052
|
-
if (
|
|
3052
|
+
if (auxiliary .equals (field))
|
|
3053
3053
|
{
|
|
3054
3054
|
field .addEvent ();
|
|
3055
3055
|
return;
|
|
@@ -3062,7 +3062,7 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
|
|
|
3062
3062
|
else
|
|
3063
3063
|
undoManager .beginUndo (_("Change Field »%s« of Node %s"), field .getName (), node .getTypeName ());
|
|
3064
3064
|
|
|
3065
|
-
field .assign (
|
|
3065
|
+
field .assign (auxiliary);
|
|
3066
3066
|
|
|
3067
3067
|
if (node .isDefaultValue (field))
|
|
3068
3068
|
field .setModificationTime (0);
|