x_ite 8.7.7 → 8.7.9
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/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +25 -25
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +18 -18
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +27 -27
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +27 -33
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +22 -22
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +18 -18
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +35 -35
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +24 -24
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +30 -30
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +527 -460
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/package.json +1 -1
- package/src/assets/shaders/webgl1/include/Shadow.glsl.js +21 -25
- package/src/assets/shaders/webgl2/include/Shadow.glsl.js +23 -27
- package/src/x_ite/Base/X3DBaseNode.js +4 -5
- package/src/x_ite/Base/X3DObject.js +1 -1
- package/src/x_ite/Base/X3DObjectArrayField.js +18 -40
- package/src/x_ite/Base/X3DTypedArrayField.js +2 -2
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +10 -2
- package/src/x_ite/Components/Core/X3DNode.js +15 -15
- package/src/x_ite/Components/Core.js +2 -2
- package/src/x_ite/Components/EnvironmentalEffects.js +2 -2
- package/src/x_ite/Components/EnvironmentalSensor.js +2 -2
- package/src/x_ite/Components/Followers.js +2 -2
- package/src/x_ite/Components/Geometry3D.js +2 -2
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +1 -3
- package/src/x_ite/Components/Grouping.js +2 -2
- package/src/x_ite/Components/Interpolation.js +2 -2
- package/src/x_ite/Components/Layering.js +2 -2
- package/src/x_ite/Components/Lighting.js +2 -2
- package/src/x_ite/Components/NURBS/Contour2D.js +1 -3
- package/src/x_ite/Components/NURBS/NurbsSet.js +1 -3
- package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +1 -3
- package/src/x_ite/Components/Navigation.js +2 -2
- package/src/x_ite/Components/Networking.js +2 -2
- package/src/x_ite/Components/PointingDeviceSensor.js +2 -2
- package/src/x_ite/Components/Rendering.js +2 -2
- package/src/x_ite/Components/Scripting/Script.js +7 -7
- package/src/x_ite/Components/Shaders.js +2 -2
- package/src/x_ite/Components/Shape.js +2 -2
- package/src/x_ite/Components/Sound.js +2 -2
- package/src/x_ite/Components/Texturing.js +2 -2
- package/src/x_ite/Components/Time.js +2 -2
- package/src/x_ite/Components.js +2 -2
- package/src/x_ite/Configuration/NodeTypeArray.js +68 -0
- package/src/x_ite/Configuration/SupportedNodes.js +13 -20
- package/src/x_ite/Execution/X3DExecutionContext.js +67 -49
- package/src/x_ite/Execution/X3DScene.js +1 -1
- package/src/x_ite/Execution/X3DWorld.js +1 -1
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +1 -1
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +1 -1
- package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +1 -1
- package/src/x_ite/Routing/X3DRoute.js +8 -0
|
@@ -353,13 +353,6 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
|
|
|
353
353
|
|
|
354
354
|
this .context = this .getContext (sourceText);
|
|
355
355
|
|
|
356
|
-
// Call initialize function.
|
|
357
|
-
|
|
358
|
-
const initialize = this .context .get ("initialize");
|
|
359
|
-
|
|
360
|
-
if (typeof initialize === "function")
|
|
361
|
-
this .call__ (initialize, "initialize");
|
|
362
|
-
|
|
363
356
|
// Connect shutdown.
|
|
364
357
|
|
|
365
358
|
const shutdown = this .context .get ("shutdown");
|
|
@@ -407,6 +400,13 @@ Script .prototype = Object .assign (Object .create (X3DScriptNode .prototype),
|
|
|
407
400
|
}
|
|
408
401
|
}
|
|
409
402
|
}
|
|
403
|
+
|
|
404
|
+
// Call initialize function.
|
|
405
|
+
|
|
406
|
+
const initialize = this .context .get ("initialize");
|
|
407
|
+
|
|
408
|
+
if (typeof initialize === "function")
|
|
409
|
+
this .call__ (initialize, "initialize");
|
|
410
410
|
},
|
|
411
411
|
call__: function (callback, name)
|
|
412
412
|
{
|
|
@@ -78,9 +78,9 @@ const AbstractTypes =
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
for (const typeName in Types)
|
|
81
|
-
SupportedNodes .
|
|
81
|
+
SupportedNodes .addNodeType (typeName, Types [typeName]);
|
|
82
82
|
|
|
83
83
|
for (const typeName in AbstractTypes)
|
|
84
|
-
SupportedNodes .
|
|
84
|
+
SupportedNodes .addAbstractNodeType (typeName, AbstractTypes [typeName]);
|
|
85
85
|
|
|
86
86
|
export default undefined;
|
|
@@ -86,9 +86,9 @@ const AbstractTypes =
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
for (const typeName in Types)
|
|
89
|
-
SupportedNodes .
|
|
89
|
+
SupportedNodes .addNodeType (typeName, Types [typeName]);
|
|
90
90
|
|
|
91
91
|
for (const typeName in AbstractTypes)
|
|
92
|
-
SupportedNodes .
|
|
92
|
+
SupportedNodes .addAbstractNodeType (typeName, AbstractTypes [typeName]);
|
|
93
93
|
|
|
94
94
|
export default undefined;
|
|
@@ -108,9 +108,9 @@ const AbstractTypes =
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
for (const typeName in Types)
|
|
111
|
-
SupportedNodes .
|
|
111
|
+
SupportedNodes .addNodeType (typeName, Types [typeName]);
|
|
112
112
|
|
|
113
113
|
for (const typeName in AbstractTypes)
|
|
114
|
-
SupportedNodes .
|
|
114
|
+
SupportedNodes .addAbstractNodeType (typeName, AbstractTypes [typeName]);
|
|
115
115
|
|
|
116
116
|
export default undefined;
|
|
@@ -90,9 +90,9 @@ const AbstractTypes =
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
for (const typeName in Types)
|
|
93
|
-
SupportedNodes .
|
|
93
|
+
SupportedNodes .addNodeType (typeName, Types [typeName]);
|
|
94
94
|
|
|
95
95
|
for (const typeName in AbstractTypes)
|
|
96
|
-
SupportedNodes .
|
|
96
|
+
SupportedNodes .addAbstractNodeType (typeName, AbstractTypes [typeName]);
|
|
97
97
|
|
|
98
98
|
export default undefined;
|
|
@@ -60,9 +60,9 @@ const AbstractTypes =
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
for (const typeName in Types)
|
|
63
|
-
SupportedNodes .
|
|
63
|
+
SupportedNodes .addNodeType (typeName, Types [typeName]);
|
|
64
64
|
|
|
65
65
|
for (const typeName in AbstractTypes)
|
|
66
|
-
SupportedNodes .
|
|
66
|
+
SupportedNodes .addAbstractNodeType (typeName, AbstractTypes [typeName]);
|
|
67
67
|
|
|
68
68
|
export default undefined;
|
package/src/x_ite/Components.js
CHANGED
|
@@ -74,13 +74,13 @@ class Components
|
|
|
74
74
|
if (types)
|
|
75
75
|
{
|
|
76
76
|
for (const [typeName, type] of Object .entries (types))
|
|
77
|
-
SupportedNodes .
|
|
77
|
+
SupportedNodes .addNodeType (typeName, type);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (abstractTypes)
|
|
81
81
|
{
|
|
82
82
|
for (const [typeName, type] of Object .entries (abstractTypes))
|
|
83
|
-
SupportedNodes .
|
|
83
|
+
SupportedNodes .addAbstractNodeType (typeName, type);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (browserContext)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4
|
+
*
|
|
5
|
+
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
|
|
6
|
+
*
|
|
7
|
+
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
|
|
8
|
+
*
|
|
9
|
+
* The copyright notice above does not evidence any actual of intended
|
|
10
|
+
* publication of such source code, and is an unpublished work by create3000.
|
|
11
|
+
* This material contains CONFIDENTIAL INFORMATION that is the property of
|
|
12
|
+
* create3000.
|
|
13
|
+
*
|
|
14
|
+
* No permission is granted to copy, distribute, or create derivative works from
|
|
15
|
+
* the contents of this software, in whole or in part, without the prior written
|
|
16
|
+
* permission of create3000.
|
|
17
|
+
*
|
|
18
|
+
* NON-MILITARY USE ONLY
|
|
19
|
+
*
|
|
20
|
+
* All create3000 software are effectively free software with a non-military use
|
|
21
|
+
* restriction. It is free. Well commented source is provided. You may reuse the
|
|
22
|
+
* source in any way you please with the exception anything that uses it must be
|
|
23
|
+
* marked to indicate is contains 'non-military use only' components.
|
|
24
|
+
*
|
|
25
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
26
|
+
*
|
|
27
|
+
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
|
|
28
|
+
*
|
|
29
|
+
* This file is part of the X_ITE Project.
|
|
30
|
+
*
|
|
31
|
+
* X_ITE is free software: you can redistribute it and/or modify it under the
|
|
32
|
+
* terms of the GNU General Public License version 3 only, as published by the
|
|
33
|
+
* Free Software Foundation.
|
|
34
|
+
*
|
|
35
|
+
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
36
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
37
|
+
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
|
|
38
|
+
* details (a copy is included in the LICENSE file that accompanied this code).
|
|
39
|
+
*
|
|
40
|
+
* You should have received a copy of the GNU General Public License version 3
|
|
41
|
+
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
|
|
42
|
+
* copy of the GPLv3 License.
|
|
43
|
+
*
|
|
44
|
+
* For Silvio, Joy and Adi.
|
|
45
|
+
*
|
|
46
|
+
******************************************************************************/
|
|
47
|
+
|
|
48
|
+
import X3DInfoArray from "../Base/X3DInfoArray.js";
|
|
49
|
+
import X3DNode from "../Components/Core/X3DNode.js";
|
|
50
|
+
|
|
51
|
+
function NodeTypeArray (values)
|
|
52
|
+
{
|
|
53
|
+
return X3DInfoArray .call (this, values, X3DNode);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
NodeTypeArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
|
|
57
|
+
{
|
|
58
|
+
constructor: NodeTypeArray,
|
|
59
|
+
getTypeName: function ()
|
|
60
|
+
{
|
|
61
|
+
return "NodeTypeArray";
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
for (const key of Reflect .ownKeys (NodeTypeArray .prototype))
|
|
66
|
+
Object .defineProperty (NodeTypeArray .prototype, key, { enumerable: false });
|
|
67
|
+
|
|
68
|
+
export default NodeTypeArray;
|
|
@@ -45,24 +45,25 @@
|
|
|
45
45
|
*
|
|
46
46
|
******************************************************************************/
|
|
47
47
|
|
|
48
|
-
import
|
|
49
|
-
import
|
|
48
|
+
import NodeTypeArray from "./NodeTypeArray.js";
|
|
49
|
+
import X3DConstants from "../Base/X3DConstants.js";
|
|
50
|
+
import HTMLSupport from "../Parser/HTMLSupport.js";
|
|
50
51
|
|
|
51
52
|
const _fieldDefinitions = Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions");
|
|
52
53
|
|
|
53
54
|
const
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
nodeTypes = new NodeTypeArray (),
|
|
56
|
+
abstractNodeTypes = new NodeTypeArray ();
|
|
56
57
|
|
|
57
58
|
let nodeType = X3DConstants .X3DBaseNode;
|
|
58
59
|
|
|
59
60
|
const SupportedNodes =
|
|
60
61
|
{
|
|
61
|
-
|
|
62
|
+
addNodeType: function (typeName, Type)
|
|
62
63
|
{
|
|
63
64
|
X3DConstants [typeName] = ++ nodeType; // Start with 1, as X3DBaseNode is 0.
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
nodeTypes .add (typeName, Type);
|
|
66
67
|
|
|
67
68
|
HTMLSupport .addNodeTypeName (typeName);
|
|
68
69
|
|
|
@@ -74,27 +75,19 @@ const SupportedNodes =
|
|
|
74
75
|
HTMLSupport .addFieldName (name)
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
+
getNodeTypes ()
|
|
78
79
|
{
|
|
79
|
-
return
|
|
80
|
+
return nodeTypes;
|
|
80
81
|
},
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
return Array .from (types .values ());
|
|
84
|
-
},
|
|
85
|
-
addAbstractType: function (typeName, Type)
|
|
82
|
+
addAbstractNodeType: function (typeName, Type)
|
|
86
83
|
{
|
|
87
84
|
X3DConstants [typeName] = ++ nodeType;
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
getAbstractType: function (typeName)
|
|
92
|
-
{
|
|
93
|
-
return abstractTypes .get (typeName);
|
|
86
|
+
abstractNodeTypes .add (typeName, Type);
|
|
94
87
|
},
|
|
95
|
-
|
|
88
|
+
getAbstractNodeTypes ()
|
|
96
89
|
{
|
|
97
|
-
return
|
|
90
|
+
return abstractNodeTypes;
|
|
98
91
|
},
|
|
99
92
|
};
|
|
100
93
|
|
|
@@ -62,7 +62,7 @@ import X3DCast from "../Base/X3DCast.js";
|
|
|
62
62
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
63
63
|
import SFNodeCache from "../Fields/SFNodeCache.js";
|
|
64
64
|
|
|
65
|
-
SupportedNodes .
|
|
65
|
+
SupportedNodes .addAbstractNodeType ("X3DExecutionContext", X3DExecutionContext);
|
|
66
66
|
|
|
67
67
|
const
|
|
68
68
|
_namedNodes = Symbol (),
|
|
@@ -218,15 +218,10 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
218
218
|
|
|
219
219
|
for (;;)
|
|
220
220
|
{
|
|
221
|
-
const
|
|
221
|
+
const protoNode = executionContext .protos .get (name) ?? executionContext .externprotos .get (name);
|
|
222
222
|
|
|
223
|
-
if (
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
const externproto = executionContext .externprotos .get (name);
|
|
227
|
-
|
|
228
|
-
if (externproto)
|
|
229
|
-
return externproto .createInstance (this, setup);
|
|
223
|
+
if (protoNode)
|
|
224
|
+
return protoNode .createInstance (this, setup);
|
|
230
225
|
|
|
231
226
|
if (executionContext .isScene ())
|
|
232
227
|
break;
|
|
@@ -241,10 +236,31 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
241
236
|
},
|
|
242
237
|
addNamedNode: function (name, node)
|
|
243
238
|
{
|
|
239
|
+
name = String (name);
|
|
240
|
+
node = X3DCast (X3DConstants .X3DNode, node, false);
|
|
241
|
+
|
|
242
|
+
if (!node)
|
|
243
|
+
throw new Error ("Couldn't add named node: node must be of type X3DNode.");
|
|
244
|
+
|
|
245
|
+
if (node .getExecutionContext () !== this)
|
|
246
|
+
throw new Error ("Couldn't add named node: node does not belong to this execution context.");
|
|
247
|
+
|
|
248
|
+
if (name .length === 0)
|
|
249
|
+
throw new Error ("Couldn't add named node: node name is empty.");
|
|
250
|
+
|
|
244
251
|
if (this [_namedNodes] .has (name))
|
|
245
252
|
throw new Error ("Couldn't add named node: node named '" + name + "' is already in use.");
|
|
246
253
|
|
|
247
|
-
this .
|
|
254
|
+
if (this [_namedNodes] .get (node .getName ()) ?.getValue () === node)
|
|
255
|
+
throw new Error ("Couldn't add named node: node named '" + node .getName () + "' is already added.");
|
|
256
|
+
|
|
257
|
+
// Add named node.
|
|
258
|
+
|
|
259
|
+
node .setName (name);
|
|
260
|
+
|
|
261
|
+
this [_namedNodes] .add (name, SFNodeCache .get (node));
|
|
262
|
+
|
|
263
|
+
this ._namedNodes_changed = this .getBrowser () .getCurrentTime ();
|
|
248
264
|
},
|
|
249
265
|
updateNamedNode: function (name, node)
|
|
250
266
|
{
|
|
@@ -269,7 +285,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
269
285
|
|
|
270
286
|
node .setName (name);
|
|
271
287
|
|
|
272
|
-
this [_namedNodes] .add (name, node);
|
|
288
|
+
this [_namedNodes] .add (name, SFNodeCache .get (node));
|
|
273
289
|
|
|
274
290
|
this ._namedNodes_changed = this .getBrowser () .getCurrentTime ();
|
|
275
291
|
},
|
|
@@ -279,10 +295,10 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
279
295
|
|
|
280
296
|
const node = this [_namedNodes] .get (name);
|
|
281
297
|
|
|
282
|
-
if (!node)
|
|
298
|
+
if (!node || !node .getValue ())
|
|
283
299
|
return;
|
|
284
300
|
|
|
285
|
-
node .setName ("");
|
|
301
|
+
node .getValue () .setName ("");
|
|
286
302
|
|
|
287
303
|
this [_namedNodes] .remove (name);
|
|
288
304
|
|
|
@@ -295,7 +311,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
295
311
|
const node = this [_namedNodes] .get (name);
|
|
296
312
|
|
|
297
313
|
if (node)
|
|
298
|
-
return
|
|
314
|
+
return node;
|
|
299
315
|
|
|
300
316
|
throw new Error ("Named node '" + name + "' not found.");
|
|
301
317
|
},
|
|
@@ -307,11 +323,8 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
307
323
|
{
|
|
308
324
|
return getUniqueName (this [_namedNodes], name);
|
|
309
325
|
},
|
|
310
|
-
addImportedNode: function (inlineNode, exportedName, importedName)
|
|
326
|
+
addImportedNode: function (inlineNode, exportedName, importedName = exportedName)
|
|
311
327
|
{
|
|
312
|
-
if (importedName === undefined)
|
|
313
|
-
importedName = exportedName;
|
|
314
|
-
|
|
315
328
|
exportedName = String (exportedName);
|
|
316
329
|
importedName = String (importedName);
|
|
317
330
|
|
|
@@ -444,9 +457,15 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
444
457
|
if (!(proto instanceof X3DProtoDeclaration))
|
|
445
458
|
throw new Error ("Couldn't add proto declaration: proto must be of type X3DProtoDeclaration.");
|
|
446
459
|
|
|
460
|
+
if (proto .getExecutionContext () !== this)
|
|
461
|
+
throw new Error ("Couldn't add proto declaration: proto does not belong to this execution context.");
|
|
462
|
+
|
|
447
463
|
if (this [_protos] .get (name))
|
|
448
464
|
throw new Error ("Couldn't add proto declaration: proto '" + name + "' already in use.");
|
|
449
465
|
|
|
466
|
+
if (this [_protos] .get (proto .getName ()) === proto)
|
|
467
|
+
throw new Error ("Couldn't add proto declaration: proto '" + proto .getName () + "' already added.");
|
|
468
|
+
|
|
450
469
|
name = String (name);
|
|
451
470
|
|
|
452
471
|
if (name .length === 0)
|
|
@@ -462,12 +481,15 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
462
481
|
name = String (name);
|
|
463
482
|
|
|
464
483
|
if (!(proto instanceof X3DProtoDeclaration))
|
|
465
|
-
throw new Error ("Couldn't
|
|
484
|
+
throw new Error ("Couldn't update proto declaration: proto must be of type X3DProtoDeclaration.");
|
|
485
|
+
|
|
486
|
+
if (proto .getExecutionContext () !== this)
|
|
487
|
+
throw new Error ("Couldn't update proto declaration: proto does not belong to this execution context.");
|
|
466
488
|
|
|
467
489
|
name = String (name);
|
|
468
490
|
|
|
469
491
|
if (name .length === 0)
|
|
470
|
-
throw new Error ("Couldn't
|
|
492
|
+
throw new Error ("Couldn't update proto declaration: proto name is empty.");
|
|
471
493
|
|
|
472
494
|
this [_protos] .update (proto .getName (), name, proto);
|
|
473
495
|
proto .setName (name);
|
|
@@ -508,9 +530,15 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
508
530
|
if (!(externproto instanceof X3DExternProtoDeclaration))
|
|
509
531
|
throw new Error ("Couldn't add extern proto declaration: extern proto must be of type X3DExternProtoDeclaration.");
|
|
510
532
|
|
|
533
|
+
if (externproto .getExecutionContext () !== this)
|
|
534
|
+
throw new Error ("Couldn't add extern proto declaration: extern proto does not belong to this execution context.");
|
|
535
|
+
|
|
511
536
|
if (this [_externprotos] .get (name))
|
|
512
537
|
throw new Error ("Couldn't add extern proto declaration: extern proto '" + name + "' already in use.");
|
|
513
538
|
|
|
539
|
+
if (this [_externprotos] .get (externproto .getName ()) === externproto)
|
|
540
|
+
throw new Error ("Couldn't add extern proto declaration: extern proto '" + externproto .getName () + "' already added.");
|
|
541
|
+
|
|
514
542
|
name = String (name);
|
|
515
543
|
|
|
516
544
|
if (name .length === 0)
|
|
@@ -526,12 +554,15 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
526
554
|
name = String (name);
|
|
527
555
|
|
|
528
556
|
if (!(externproto instanceof X3DExternProtoDeclaration))
|
|
529
|
-
throw new Error ("Couldn't
|
|
557
|
+
throw new Error ("Couldn't update extern proto declaration: extern proto must be of type X3DExternProtoDeclaration.");
|
|
558
|
+
|
|
559
|
+
if (externproto .getExecutionContext () !== this)
|
|
560
|
+
throw new Error ("Couldn't update extern proto declaration: extern proto does not belong to this execution context.");
|
|
530
561
|
|
|
531
562
|
name = String (name);
|
|
532
563
|
|
|
533
564
|
if (name .length === 0)
|
|
534
|
-
throw new Error ("Couldn't
|
|
565
|
+
throw new Error ("Couldn't update extern proto declaration: extern proto name is empty.");
|
|
535
566
|
|
|
536
567
|
this [_externprotos] .update (externproto .getName (), name, externproto);
|
|
537
568
|
externproto .setName (name);
|
|
@@ -638,7 +669,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
638
669
|
if (sourceField .getType () !== destinationField .getType ())
|
|
639
670
|
throw new Error ("ROUTE types " + sourceField .getTypeName () + " and " + destinationField .getTypeName () + " do not match.");
|
|
640
671
|
|
|
641
|
-
const id =
|
|
672
|
+
const id = X3DRoute .getId (sourceField, destinationField);
|
|
642
673
|
|
|
643
674
|
let route = this [_routes] .get (id);
|
|
644
675
|
|
|
@@ -662,37 +693,26 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
662
693
|
{
|
|
663
694
|
// sourceNode, sourceField, destinationNode, destinationField
|
|
664
695
|
if (arguments .length === 4)
|
|
665
|
-
|
|
666
|
-
route = this .getRoute .apply (this, arguments);
|
|
696
|
+
route = this .getRoute (... arguments);
|
|
667
697
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
698
|
+
if (!(route instanceof X3DRoute))
|
|
699
|
+
return;
|
|
671
700
|
|
|
672
|
-
if (
|
|
673
|
-
|
|
701
|
+
if (route .getExecutionContext () !== this)
|
|
702
|
+
return;
|
|
703
|
+
|
|
704
|
+
this .deleteSimpleRoute (route);
|
|
705
|
+
this .deleteImportedRoute (route .sourceNode, route .destinationNode, route);
|
|
674
706
|
},
|
|
675
707
|
deleteSimpleRoute: function (route)
|
|
676
708
|
{
|
|
677
|
-
|
|
678
|
-
{
|
|
679
|
-
const
|
|
680
|
-
sourceField = route .getSourceField (),
|
|
681
|
-
destinationField = route .getDestinationField (),
|
|
682
|
-
id = sourceField .getId () + "." + destinationField .getId ();
|
|
709
|
+
const id = X3DRoute .getId (route .getSourceField (), route .getDestinationField ());
|
|
683
710
|
|
|
684
|
-
|
|
685
|
-
route .disconnect ();
|
|
711
|
+
this [_routes] .remove (id);
|
|
686
712
|
|
|
687
|
-
|
|
713
|
+
route .disconnect ();
|
|
688
714
|
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
catch (error)
|
|
692
|
-
{
|
|
693
|
-
console .error (error);
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
715
|
+
this ._routes_changed = this .getBrowser () .getCurrentTime ();
|
|
696
716
|
},
|
|
697
717
|
deleteImportedRoute (sourceNode, destinationNode, route)
|
|
698
718
|
{
|
|
@@ -754,9 +774,7 @@ X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .pr
|
|
|
754
774
|
sourceField = sourceNode .getField (sourceField);
|
|
755
775
|
destinationField = destinationNode .getField (destinationField);
|
|
756
776
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
return this [_routes] .get (id);
|
|
777
|
+
return this [_routes] .get (X3DRoute .getId (sourceField, destinationField));
|
|
760
778
|
},
|
|
761
779
|
getRoutes: function ()
|
|
762
780
|
{
|
|
@@ -58,7 +58,7 @@ import X3DCast from "../Base/X3DCast.js";
|
|
|
58
58
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
59
59
|
import SFNodeCache from "../Fields/SFNodeCache.js";
|
|
60
60
|
|
|
61
|
-
SupportedNodes .
|
|
61
|
+
SupportedNodes .addAbstractNodeType ("X3DScene", X3DScene);
|
|
62
62
|
|
|
63
63
|
const
|
|
64
64
|
_browser = Symbol .for ("X_ITE.X3DEventObject.browser"),
|
|
@@ -53,7 +53,7 @@ import Layer from "../Components/Layering/Layer.js";
|
|
|
53
53
|
import X3DCast from "../Base/X3DCast.js";
|
|
54
54
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
55
55
|
|
|
56
|
-
SupportedNodes .
|
|
56
|
+
SupportedNodes .addAbstractNodeType ("X3DWorld", X3DWorld);
|
|
57
57
|
|
|
58
58
|
function X3DWorld (executionContext)
|
|
59
59
|
{
|
|
@@ -54,7 +54,7 @@ import X3DProtoDeclarationNode from "./X3DProtoDeclarationNode.js";
|
|
|
54
54
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
55
55
|
import FileLoader from "../InputOutput/FileLoader.js";
|
|
56
56
|
|
|
57
|
-
SupportedNodes .
|
|
57
|
+
SupportedNodes .addAbstractNodeType ("X3DExternProtoDeclaration", X3DExternProtoDeclaration);
|
|
58
58
|
|
|
59
59
|
const
|
|
60
60
|
_proto = Symbol (),
|
|
@@ -53,7 +53,7 @@ import X3DExecutionContext from "../Execution/X3DExecutionContext.js";
|
|
|
53
53
|
import X3DProtoDeclarationNode from "./X3DProtoDeclarationNode.js";
|
|
54
54
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
55
55
|
|
|
56
|
-
SupportedNodes .
|
|
56
|
+
SupportedNodes .addAbstractNodeType ("X3DProtoDeclaration", X3DProtoDeclaration);
|
|
57
57
|
|
|
58
58
|
const
|
|
59
59
|
_body = Symbol ();
|
|
@@ -52,7 +52,7 @@ import X3DPrototypeInstance from "../Components/Core/X3DPrototypeInstance.js";
|
|
|
52
52
|
import SFNodeCache from "../Fields/SFNodeCache.js";
|
|
53
53
|
import X3DConstants from "../Base/X3DConstants.js";
|
|
54
54
|
|
|
55
|
-
SupportedNodes .
|
|
55
|
+
SupportedNodes .addAbstractNodeType ("X3DProtoDeclarationNode", X3DProtoDeclarationNode);
|
|
56
56
|
|
|
57
57
|
function X3DProtoDeclarationNode (executionContext)
|
|
58
58
|
{
|
|
@@ -297,4 +297,12 @@ Object .defineProperties (X3DRoute .prototype,
|
|
|
297
297
|
},
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
+
Object .assign (X3DRoute,
|
|
301
|
+
{
|
|
302
|
+
getId: function (sourceField, destinationField)
|
|
303
|
+
{
|
|
304
|
+
return sourceField .getId () + "." + destinationField .getId ();
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
|
|
300
308
|
export default X3DRoute;
|