sunrize 1.0.13 → 1.0.14
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 +8 -8
- package/src/sunrize/Application/Application.js +3 -3
- package/src/sunrize/Application/{SecondaryToolbar.js → Dashboard.js} +6 -2
- package/src/sunrize/Application/DataStorage.js +2 -2
- package/src/sunrize/Application/Document.js +3 -3
- package/src/sunrize/Application/Selection.js +7 -10
- package/src/sunrize/Application/Traverse.js +28 -3
- package/src/sunrize/Controls/EditUserDefinedFieldPopover.js +2 -2
- package/src/sunrize/Controls/RenameNodeInput.js +1 -1
- package/src/sunrize/Controls/Splitter.js +1 -1
- package/src/sunrize/Controls/Tabs.js +2 -2
- package/src/sunrize/Editors/Console.js +3 -3
- package/src/sunrize/Editors/Library.js +1 -1
- package/src/sunrize/Editors/OutlineEditor.js +4 -4
- package/src/sunrize/Editors/OutlineView.js +1 -1
- package/src/sunrize/Editors/ScriptEditor.js +1 -1
- package/src/sunrize/Tools/CADGeometry/CADAssemblyTool.js +1 -1
- package/src/sunrize/Tools/CADGeometry/CADFaceTool.js +1 -1
- package/src/sunrize/Tools/CADGeometry/CADLayerTool.js +1 -1
- package/src/sunrize/Tools/CADGeometry/CADPartTool.js +1 -1
- package/src/sunrize/Tools/Core/X3DNodeTool.js +54 -33
- package/src/sunrize/Tools/Core/X3DPrototypeInstanceTool.js +9 -4
- package/src/sunrize/Tools/Geospatial/GeoLODTool.js +3 -3
- package/src/sunrize/Tools/Geospatial/GeoLocationTool.js +1 -1
- package/src/sunrize/Tools/Geospatial/GeoTransformTool.js +1 -1
- package/src/sunrize/Tools/Grouping/GroupTool.js +1 -1
- package/src/sunrize/Tools/Grouping/StaticGroupTool.js +1 -1
- package/src/sunrize/Tools/Grouping/SwitchTool.js +1 -1
- package/src/sunrize/Tools/Grouping/TransformTool.js +1 -1
- package/src/sunrize/Tools/Grouping/X3DBoundedObjectTool.js +13 -6
- package/src/sunrize/Tools/Grouping/X3DTransformNodeTool.js +13 -6
- package/src/sunrize/Tools/HAnim/HAnimHumanoidTool.js +1 -1
- package/src/sunrize/Tools/HAnim/HAnimJointTool.js +1 -1
- package/src/sunrize/Tools/HAnim/HAnimSegmentTool.js +1 -1
- package/src/sunrize/Tools/HAnim/HAnimSiteTool.js +1 -1
- package/src/sunrize/Tools/Layering/LayerTool.js +1 -1
- package/src/sunrize/Tools/Layering/X3DLayerNodeTool.js +3 -3
- package/src/sunrize/Tools/Layout/LayoutGroupTool.js +7 -7
- package/src/sunrize/Tools/Layout/LayoutLayerTool.js +1 -1
- package/src/sunrize/Tools/Layout/ScreenGroupTool.js +1 -1
- package/src/sunrize/Tools/Navigation/BillboardTool.js +5 -5
- package/src/sunrize/Tools/Navigation/CollisionTool.js +10 -3
- package/src/sunrize/Tools/Navigation/LODTool.js +5 -5
- package/src/sunrize/Tools/Networking/AnchorTool.js +1 -1
- package/src/sunrize/Tools/Networking/InlineTool.js +1 -1
- package/src/sunrize/Tools/ParticleSystems/ParticleSystemTool.js +1 -1
- package/src/sunrize/Tools/Picking/PickableGroupTool.js +1 -1
- package/src/sunrize/Tools/RigidBodyPhysics/CollidableOffsetTool.js +10 -3
- package/src/sunrize/Tools/RigidBodyPhysics/CollidableShapeTool.js +10 -3
- package/src/sunrize/Tools/Shape/ShapeTool.js +1 -1
- package/src/sunrize/Tools/VolumeRendering/IsoSurfaceVolumeDataTool.js +1 -1
- package/src/sunrize/Tools/VolumeRendering/SegmentedVolumeDataTool.js +1 -1
- package/src/sunrize/Tools/VolumeRendering/VolumeDataTool.js +1 -1
- package/src/sunrize/Undo/Editor.js +49 -26
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunrize",
|
|
3
3
|
"productName": "Sunrize X3D Editor",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.14",
|
|
5
5
|
"description": "A Multi Platform X3D Editor",
|
|
6
6
|
"homepage": "https://create3000.github.io/sunrize/",
|
|
7
7
|
"author": "Holger Seelig",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@electron-forge/cli": "^6.0
|
|
37
|
+
"@electron-forge/cli": "^6.1.0",
|
|
38
38
|
"@electron-forge/maker-deb": "^6.1.0",
|
|
39
39
|
"@electron-forge/maker-rpm": "^6.1.0",
|
|
40
|
-
"@electron-forge/maker-squirrel": "^6.0
|
|
41
|
-
"@electron-forge/maker-zip": "^6.0
|
|
42
|
-
"electron": "^23.2.
|
|
40
|
+
"@electron-forge/maker-squirrel": "^6.1.0",
|
|
41
|
+
"@electron-forge/maker-zip": "^6.1.0",
|
|
42
|
+
"electron": "^23.2.1"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"capitalize": "^2.0.4",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"jquery": "^3.6.4",
|
|
51
51
|
"jquery-ui-dist": "^1.13.2",
|
|
52
52
|
"jstree": "^3.3.15",
|
|
53
|
-
"material-icons": "^1.13.
|
|
54
|
-
"material-symbols": "^0.5.
|
|
53
|
+
"material-icons": "^1.13.4",
|
|
54
|
+
"material-symbols": "^0.5.5",
|
|
55
55
|
"md5": "^2.3.0",
|
|
56
56
|
"monaco-editor": "^0.36.1",
|
|
57
57
|
"node-localstorage": "^2.2.1",
|
|
58
58
|
"qtip2": "^3.0.3",
|
|
59
59
|
"spectrum-colorpicker2": "^2.0.10",
|
|
60
60
|
"string-similarity": "^4.0.4",
|
|
61
|
-
"x_ite": "^8.6.
|
|
61
|
+
"x_ite": "^8.6.14"
|
|
62
62
|
},
|
|
63
63
|
"main": "src/main.js",
|
|
64
64
|
"bin": {
|
|
@@ -22,7 +22,7 @@ module .exports = class Application
|
|
|
22
22
|
if (electron .app .requestSingleInstanceLock ())
|
|
23
23
|
new this ()
|
|
24
24
|
else
|
|
25
|
-
electron .app .quit ()
|
|
25
|
+
electron .app .quit ()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
constructor ()
|
|
@@ -431,7 +431,7 @@ module .exports = class Application
|
|
|
431
431
|
checked: this .config .rubberband,
|
|
432
432
|
click: () =>
|
|
433
433
|
{
|
|
434
|
-
this .config .rubberband = !this .config .rubberband
|
|
434
|
+
this .config .rubberband = !this .config .rubberband
|
|
435
435
|
this .mainWindow .webContents .send ("display-rubberband", this .config .rubberband)
|
|
436
436
|
},
|
|
437
437
|
},
|
|
@@ -441,7 +441,7 @@ module .exports = class Application
|
|
|
441
441
|
checked: this .config .timings,
|
|
442
442
|
click: () =>
|
|
443
443
|
{
|
|
444
|
-
this .config .timings = !this .config .timings
|
|
444
|
+
this .config .timings = !this .config .timings
|
|
445
445
|
this .mainWindow .webContents .send ("display-timings", this .config .timings)
|
|
446
446
|
},
|
|
447
447
|
},
|
|
@@ -7,11 +7,11 @@ const
|
|
|
7
7
|
Box3 = X3D .require ("standard/Math/Geometry/Box3"),
|
|
8
8
|
_ = require ("./GetText")
|
|
9
9
|
|
|
10
|
-
module .exports = class
|
|
10
|
+
module .exports = class Dashboard extends Interface
|
|
11
11
|
{
|
|
12
12
|
constructor (element)
|
|
13
13
|
{
|
|
14
|
-
super ("Sunrize.
|
|
14
|
+
super ("Sunrize.Dashboard.")
|
|
15
15
|
|
|
16
16
|
this .toolbar = element
|
|
17
17
|
|
|
@@ -80,6 +80,8 @@ module .exports = class SecondaryToolbar extends Interface
|
|
|
80
80
|
|
|
81
81
|
this .arrowButton .removeClass ("active")
|
|
82
82
|
this .handButton .addClass ("active")
|
|
83
|
+
|
|
84
|
+
this .browser .setBrowserOption ("PrivateSensors", false)
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
arrow ()
|
|
@@ -91,6 +93,8 @@ module .exports = class SecondaryToolbar extends Interface
|
|
|
91
93
|
|
|
92
94
|
this .handButton .removeClass ("active")
|
|
93
95
|
this .arrowButton .addClass ("active")
|
|
96
|
+
|
|
97
|
+
this .browser .setBrowserOption ("PrivateSensors", true)
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
play (value)
|
|
@@ -65,7 +65,7 @@ const handler =
|
|
|
65
65
|
ownKeys .push (key .substring (namespace .length))
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
return ownKeys
|
|
68
|
+
return ownKeys
|
|
69
69
|
},
|
|
70
70
|
getOwnPropertyDescriptor: function (target, key)
|
|
71
71
|
{
|
|
@@ -73,7 +73,7 @@ const handler =
|
|
|
73
73
|
storage = target .getStorage (),
|
|
74
74
|
namespace = target .getNameSpace ()
|
|
75
75
|
|
|
76
|
-
return Object .getOwnPropertyDescriptor (storage, namespace + key)
|
|
76
|
+
return Object .getOwnPropertyDescriptor (storage, namespace + key)
|
|
77
77
|
},
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -10,7 +10,7 @@ const
|
|
|
10
10
|
X3D = require ("../X3D"),
|
|
11
11
|
Interface = require ("./Interface"),
|
|
12
12
|
Splitter = require ("../Controls/Splitter"),
|
|
13
|
-
|
|
13
|
+
Dashboard = require ("./Dashboard"),
|
|
14
14
|
Footer = require ("./Footer"),
|
|
15
15
|
Sidebar = require ("./Sidebar"),
|
|
16
16
|
Editor = require ("../Undo/Editor"),
|
|
@@ -27,7 +27,7 @@ module .exports = new class Document extends Interface
|
|
|
27
27
|
|
|
28
28
|
this .verticalSplitter = new Splitter ($("#vertical-splitter"), "vertical")
|
|
29
29
|
this .horizontalSplitter = new Splitter ($("#horizontal-splitter"), "horizontal")
|
|
30
|
-
this .secondaryToolbar = new
|
|
30
|
+
this .secondaryToolbar = new Dashboard ($("#secondary-toolbar"))
|
|
31
31
|
this .footer = new Footer ($("#footer"))
|
|
32
32
|
this .sidebar = new Sidebar ($("#sidebar"))
|
|
33
33
|
|
|
@@ -263,7 +263,7 @@ module .exports = new class Document extends Interface
|
|
|
263
263
|
|
|
264
264
|
this .saveFile (true)
|
|
265
265
|
|
|
266
|
-
undoManager .undo ()
|
|
266
|
+
undoManager .undo ()
|
|
267
267
|
|
|
268
268
|
this .filePath = oldFilePath
|
|
269
269
|
}
|
|
@@ -7,23 +7,20 @@ module .exports = new class Selection
|
|
|
7
7
|
this .nodes = new Map ()
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
clear (
|
|
10
|
+
clear ()
|
|
11
11
|
{
|
|
12
12
|
for (const node of this .nodes .values ())
|
|
13
|
-
|
|
14
|
-
if (node !== exception)
|
|
15
|
-
node .removeTool ()
|
|
16
|
-
}
|
|
13
|
+
node .removeTool ()
|
|
17
14
|
|
|
18
15
|
this .nodes .clear ()
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
set (node)
|
|
22
19
|
{
|
|
23
|
-
|
|
20
|
+
this .nodes .delete (this .node (node))
|
|
24
21
|
|
|
25
|
-
this .clear (
|
|
26
|
-
this .add (
|
|
22
|
+
this .clear ()
|
|
23
|
+
this .add (node)
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
add (node)
|
|
@@ -33,13 +30,13 @@ module .exports = new class Selection
|
|
|
33
30
|
|
|
34
31
|
remove (node)
|
|
35
32
|
{
|
|
36
|
-
this .tool (node)
|
|
33
|
+
this .tool (node) ?.removeTool ()
|
|
37
34
|
this .nodes .delete (this .node (node))
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
node (node)
|
|
41
38
|
{
|
|
42
|
-
return node .
|
|
39
|
+
return node .valueOf ()
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
tool (node)
|
|
@@ -106,12 +106,27 @@ module .exports = class Traverse
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
const type = node .getType ()
|
|
109
|
+
const type = node .getType ()
|
|
110
110
|
|
|
111
111
|
for (let t = type .length - 1; t >= 0; -- t)
|
|
112
112
|
{
|
|
113
113
|
switch (type [t])
|
|
114
114
|
{
|
|
115
|
+
case X3D .X3DConstants .X3DExternProtoDeclaration:
|
|
116
|
+
{
|
|
117
|
+
if (flags & this .EXTERNPROTO_DECLARATION_SCENE)
|
|
118
|
+
{
|
|
119
|
+
try
|
|
120
|
+
{
|
|
121
|
+
if (this .traverseScene (node .getInternalScene (), flags, callback, seen) === false)
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
catch
|
|
125
|
+
{ }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
break
|
|
129
|
+
}
|
|
115
130
|
case X3D .X3DConstants .X3DProtoDeclaration:
|
|
116
131
|
{
|
|
117
132
|
if (flags & Traverse .PROTO_DECLARATION_BODY)
|
|
@@ -132,6 +147,16 @@ module .exports = class Traverse
|
|
|
132
147
|
|
|
133
148
|
break
|
|
134
149
|
}
|
|
150
|
+
case X3D .X3DConstants .Inline:
|
|
151
|
+
{
|
|
152
|
+
if (flags & this .INLINE_SCENE)
|
|
153
|
+
{
|
|
154
|
+
if (this .traverseScene (node .getInternalScene (), flags, callback, seen) === false)
|
|
155
|
+
return false
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
break
|
|
159
|
+
}
|
|
135
160
|
default:
|
|
136
161
|
{
|
|
137
162
|
continue
|
|
@@ -288,7 +313,7 @@ module .exports = class Traverse
|
|
|
288
313
|
}
|
|
289
314
|
}
|
|
290
315
|
|
|
291
|
-
const type = node .getType ()
|
|
316
|
+
const type = node .getType ()
|
|
292
317
|
|
|
293
318
|
for (let t = type .length - 1; t >= 0; -- t)
|
|
294
319
|
{
|
|
@@ -300,7 +325,7 @@ module .exports = class Traverse
|
|
|
300
325
|
{
|
|
301
326
|
try
|
|
302
327
|
{
|
|
303
|
-
this .findInScene (
|
|
328
|
+
this .findInScene (node .getInternalScene (), object, flags, hierarchies, hierarchy, seen)
|
|
304
329
|
}
|
|
305
330
|
catch
|
|
306
331
|
{ }
|
|
@@ -99,12 +99,12 @@ $.fn.editUserDefinedFieldPopover = function (executionContext, node, field)
|
|
|
99
99
|
typeNameMenu
|
|
100
100
|
.find ("option")
|
|
101
101
|
.filter ((i, e) => $(e) .text () === field .getTypeName ())
|
|
102
|
-
.prop ("selected", true)
|
|
102
|
+
.prop ("selected", true)
|
|
103
103
|
|
|
104
104
|
accessTypeMenu
|
|
105
105
|
.find ("option")
|
|
106
106
|
.filter ((i, e) => $(e) .text () === accessTypes .get (field .getAccessType ()))
|
|
107
|
-
.prop ("selected", true)
|
|
107
|
+
.prop ("selected", true)
|
|
108
108
|
|
|
109
109
|
nameInput .val (field .getName ())
|
|
110
110
|
}
|
|
@@ -35,7 +35,7 @@ $.fn.renameNodeInput = function (node)
|
|
|
35
35
|
if (name === node .getName ())
|
|
36
36
|
return
|
|
37
37
|
|
|
38
|
-
const executionContext = node .getExecutionContext ()
|
|
38
|
+
const executionContext = node .getExecutionContext ()
|
|
39
39
|
|
|
40
40
|
if (node instanceof X3D .X3DProtoDeclarationNode)
|
|
41
41
|
{
|
|
@@ -20,8 +20,8 @@ module .exports = class Tabs extends Interface
|
|
|
20
20
|
this .addTabs ()
|
|
21
21
|
|
|
22
22
|
this .element .tabs ()
|
|
23
|
-
this .element .tabs ("option", "classes.ui-tabs", this .orientation)
|
|
24
|
-
this .element .on ("tabsactivate", () => this .tabActivated ())
|
|
23
|
+
this .element .tabs ("option", "classes.ui-tabs", this .orientation)
|
|
24
|
+
this .element .on ("tabsactivate", () => this .tabActivated ())
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
addTabs () { }
|
|
@@ -23,7 +23,7 @@ module .exports = class Console extends Interface
|
|
|
23
23
|
{
|
|
24
24
|
super (`Sunrize.Console.${element .attr ("id")}.`)
|
|
25
25
|
|
|
26
|
-
this .suspendConsole = false
|
|
26
|
+
this .suspendConsole = false
|
|
27
27
|
this .messageTime = 0
|
|
28
28
|
this .historyIndex = 0
|
|
29
29
|
this .history = [ ]
|
|
@@ -88,8 +88,8 @@ module .exports = class Console extends Interface
|
|
|
88
88
|
if (event !== X3D .X3DConstants .INITIALIZED_EVENT)
|
|
89
89
|
return
|
|
90
90
|
|
|
91
|
-
this .scriptNode = this .browser .currentScene .createNode ("Script")
|
|
92
|
-
this .scriptNode .url = new X3D .MFString ("ecmascript:")
|
|
91
|
+
this .scriptNode = this .browser .currentScene .createNode ("Script", { warn: false })
|
|
92
|
+
this .scriptNode .url = new X3D .MFString ("ecmascript:")
|
|
93
93
|
}
|
|
94
94
|
catch (error)
|
|
95
95
|
{ }
|
|
@@ -191,7 +191,7 @@ module .exports = new class Library extends Dialog
|
|
|
191
191
|
|
|
192
192
|
createNode (typeName)
|
|
193
193
|
{
|
|
194
|
-
const node = this .executionContext .createNode (typeName)
|
|
194
|
+
const node = this .executionContext .createNode (typeName, { warn: false })
|
|
195
195
|
|
|
196
196
|
UndoManager .shared .beginUndo (_ ("Create Node %s"), typeName)
|
|
197
197
|
|
|
@@ -640,7 +640,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
640
640
|
parentNodeElement = parentFieldElement .closest (".node, .proto, .scene", this .sceneGraph),
|
|
641
641
|
parentNode = this .getNode (parentNodeElement),
|
|
642
642
|
parentField = parentFieldElement .hasClass ("scene") ? parentNode .rootNodes : this .getField (parentFieldElement),
|
|
643
|
-
node = executionContext .createNode (typeName) .getValue (),
|
|
643
|
+
node = executionContext .createNode (typeName, { warn: false }) .getValue (),
|
|
644
644
|
field = node .getField (fieldName)
|
|
645
645
|
|
|
646
646
|
UndoManager .shared .beginUndo (_ ("Add Parent Group %s to Node %s"), typeName, childNode .getTypeName ())
|
|
@@ -1129,7 +1129,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1129
1129
|
|
|
1130
1130
|
// Add route.
|
|
1131
1131
|
|
|
1132
|
-
Editor .addRoute (executionContext,
|
|
1132
|
+
Editor .addRoute (executionContext, this .connector .node, this .connector .field .getName (), node, field .getName ())
|
|
1133
1133
|
|
|
1134
1134
|
if (event .shiftKey)
|
|
1135
1135
|
break
|
|
@@ -1161,7 +1161,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1161
1161
|
|
|
1162
1162
|
// Add route.
|
|
1163
1163
|
|
|
1164
|
-
Editor .addRoute (executionContext,
|
|
1164
|
+
Editor .addRoute (executionContext, node, field .getName (), this .connector .node, this .connector .field .getName ())
|
|
1165
1165
|
|
|
1166
1166
|
if (event .shiftKey)
|
|
1167
1167
|
break
|
|
@@ -1807,7 +1807,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1807
1807
|
|
|
1808
1808
|
if (sourceIndexOffsets .has (sourceParentField))
|
|
1809
1809
|
{
|
|
1810
|
-
if (sourceParentField !== destinationParentField || destinationIndex > sourceIndex)
|
|
1810
|
+
if (sourceParentField !== destinationParentField || destinationIndex > sourceIndex || isNaN (destinationIndex))
|
|
1811
1811
|
sourceIndexOffsets .set (sourceParentField, sourceIndexOffsets .get (sourceParentField) - 1)
|
|
1812
1812
|
}
|
|
1813
1813
|
else
|
|
@@ -2288,7 +2288,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2288
2288
|
this .beforeOpen (element)
|
|
2289
2289
|
this .expandNode (element, node, full, this .expandTime)
|
|
2290
2290
|
|
|
2291
|
-
node .setUserData (_expanded, field?.getId () ?? true)
|
|
2291
|
+
node .setUserData (_expanded, field ?.getId () ?? true)
|
|
2292
2292
|
node .setUserData (_fullExpanded, full)
|
|
2293
2293
|
}
|
|
2294
2294
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
3
|
const
|
|
4
|
-
path
|
|
5
|
-
url
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
path = require ("path"),
|
|
5
|
+
url = require ("url"),
|
|
6
|
+
Traverse = require("../../Application/Traverse"),
|
|
7
|
+
X3D = require ("../../X3D"),
|
|
8
|
+
Fields = X3D .require ("x_ite/Fields"),
|
|
9
|
+
X3DNode = X3D .require ("x_ite/Components/Core/X3DNode")
|
|
9
10
|
|
|
10
11
|
const handler =
|
|
11
12
|
{
|
|
@@ -14,32 +15,38 @@ const handler =
|
|
|
14
15
|
if (key in target)
|
|
15
16
|
return target [key]
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const property = target .toolNode [key]
|
|
19
|
+
|
|
20
|
+
if (typeof property === "function")
|
|
21
|
+
return property .bind (target .toolNode)
|
|
22
|
+
|
|
23
|
+
else
|
|
24
|
+
return property
|
|
18
25
|
},
|
|
19
26
|
set: function (target, key, value)
|
|
20
27
|
{
|
|
21
28
|
if (key in target)
|
|
22
29
|
{
|
|
23
|
-
target [key] = value
|
|
24
|
-
return true
|
|
30
|
+
target [key] = value
|
|
31
|
+
return true
|
|
25
32
|
}
|
|
26
33
|
|
|
27
|
-
target .
|
|
28
|
-
return true
|
|
34
|
+
target .toolNode [key] = value
|
|
35
|
+
return true
|
|
29
36
|
},
|
|
30
37
|
has: function (target, key)
|
|
31
38
|
{
|
|
32
|
-
return key in target .
|
|
39
|
+
return key in target .toolNode
|
|
33
40
|
},
|
|
34
41
|
ownKeys: function (target)
|
|
35
42
|
{
|
|
36
|
-
return Object .keys (target .
|
|
43
|
+
return Object .keys (target .toolNode)
|
|
37
44
|
},
|
|
38
45
|
getOwnPropertyDescriptor: function (target, key)
|
|
39
46
|
{
|
|
40
|
-
return Object .getOwnPropertyDescriptor (target .
|
|
47
|
+
return Object .getOwnPropertyDescriptor (target .toolNode, key)
|
|
41
48
|
},
|
|
42
|
-
}
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
class X3DNodeTool
|
|
45
52
|
{
|
|
@@ -47,24 +54,40 @@ class X3DNodeTool
|
|
|
47
54
|
{
|
|
48
55
|
const proxy = new Proxy (this, handler)
|
|
49
56
|
|
|
50
|
-
this .
|
|
57
|
+
this .toolTarget = this
|
|
58
|
+
this .toolProxy = proxy
|
|
59
|
+
this .toolNode = node
|
|
51
60
|
|
|
52
61
|
this .replaceNode (node, proxy)
|
|
53
62
|
this .setup ()
|
|
54
63
|
|
|
55
|
-
return proxy
|
|
64
|
+
return proxy
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
setup ()
|
|
59
68
|
{
|
|
60
|
-
this .initialize ()
|
|
69
|
+
this .initialize ()
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
initialize () { }
|
|
64
73
|
|
|
74
|
+
addTool ()
|
|
75
|
+
{
|
|
76
|
+
return this .toolProxy
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
removeTool ()
|
|
80
|
+
{
|
|
81
|
+
Traverse .traverse (this .tool, Traverse .ROOT_NODES | Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES, node => node .dispose ())
|
|
82
|
+
|
|
83
|
+
this .replaceNode (this, this .toolNode)
|
|
84
|
+
|
|
85
|
+
return this .toolNode
|
|
86
|
+
}
|
|
87
|
+
|
|
65
88
|
static scenes = new Map ()
|
|
66
89
|
|
|
67
|
-
async
|
|
90
|
+
async loadTool (... args)
|
|
68
91
|
{
|
|
69
92
|
const
|
|
70
93
|
URL = url .pathToFileURL (path .resolve (... args)),
|
|
@@ -80,12 +103,13 @@ class X3DNodeTool
|
|
|
80
103
|
|
|
81
104
|
X3DNodeTool .scenes .set (URL .href, scene)
|
|
82
105
|
|
|
83
|
-
scene .
|
|
106
|
+
scene .setPrivate (true)
|
|
107
|
+
scene .setLive (true)
|
|
84
108
|
|
|
85
109
|
this .tool = scene .createProto ("Tool")
|
|
86
110
|
}
|
|
87
111
|
|
|
88
|
-
this .
|
|
112
|
+
this .toolInnerNode = this .tool .getValue () .getInnerNode ()
|
|
89
113
|
}
|
|
90
114
|
|
|
91
115
|
replaceNode (node, replacement)
|
|
@@ -93,26 +117,24 @@ class X3DNodeTool
|
|
|
93
117
|
for (const parent of new Set (node .getParents ()))
|
|
94
118
|
{
|
|
95
119
|
if (parent instanceof Fields .SFNode)
|
|
96
|
-
parent .setValue (replacement)
|
|
120
|
+
parent .setValue (replacement)
|
|
97
121
|
}
|
|
98
122
|
}
|
|
99
123
|
|
|
100
|
-
|
|
124
|
+
getInnerNode ()
|
|
101
125
|
{
|
|
102
|
-
return this
|
|
126
|
+
return this .toolProxy
|
|
103
127
|
}
|
|
104
128
|
|
|
105
|
-
|
|
129
|
+
valueOf ()
|
|
106
130
|
{
|
|
107
|
-
this .
|
|
108
|
-
|
|
109
|
-
return this .node
|
|
131
|
+
return this .toolNode .valueOf ()
|
|
110
132
|
}
|
|
111
133
|
|
|
112
134
|
dispose ()
|
|
113
135
|
{
|
|
114
|
-
this .removeTool ()
|
|
115
|
-
this .
|
|
136
|
+
this .removeTool ()
|
|
137
|
+
this .toolNode .dispose ()
|
|
116
138
|
}
|
|
117
139
|
}
|
|
118
140
|
|
|
@@ -120,13 +142,12 @@ Object .assign (X3DNode .prototype,
|
|
|
120
142
|
{
|
|
121
143
|
addTool: function ()
|
|
122
144
|
{
|
|
123
|
-
return this
|
|
145
|
+
return this
|
|
124
146
|
},
|
|
125
|
-
|
|
147
|
+
removeTool: function ()
|
|
126
148
|
{
|
|
127
|
-
return
|
|
149
|
+
return this
|
|
128
150
|
},
|
|
129
|
-
removeTool: function () { return this },
|
|
130
151
|
})
|
|
131
152
|
|
|
132
153
|
module .exports = X3DNodeTool
|
|
@@ -11,20 +11,25 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
|
|
|
11
11
|
{
|
|
12
12
|
super (node)
|
|
13
13
|
|
|
14
|
-
this .
|
|
14
|
+
this .toolNode .getInnerNode () .addTool ()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
removeTool ()
|
|
18
18
|
{
|
|
19
|
-
this .
|
|
19
|
+
this .toolNode .getInnerNode () .removeTool ()
|
|
20
20
|
|
|
21
|
-
super .removeTool ()
|
|
21
|
+
return super .removeTool ()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getInnerNode ()
|
|
25
|
+
{
|
|
26
|
+
return this .toolNode .getInnerNode ()
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
Object .assign (X3DPrototypeInstance .prototype,
|
|
26
31
|
{
|
|
27
|
-
|
|
32
|
+
addTool: function ()
|
|
28
33
|
{
|
|
29
34
|
return new X3DPrototypeInstanceTool (this)
|
|
30
35
|
},
|
|
@@ -24,16 +24,16 @@ class GeoLODTool extends X3DBoundedObjectTool
|
|
|
24
24
|
{
|
|
25
25
|
super .reshape ()
|
|
26
26
|
|
|
27
|
-
const center = this .
|
|
27
|
+
const center = this .toolNode .getCoord (this .toolNode ._center, GeoLODTool .center)
|
|
28
28
|
|
|
29
29
|
if (!this .tool .center .getValue () .equals (center))
|
|
30
|
-
this .tool .center = center
|
|
30
|
+
this .tool .center = center
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
Object .assign (GeoLOD .prototype,
|
|
35
35
|
{
|
|
36
|
-
|
|
36
|
+
addTool: function ()
|
|
37
37
|
{
|
|
38
38
|
return new GeoLODTool (this)
|
|
39
39
|
},
|