@woosh/meep-engine 2.47.41 → 2.47.42
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
CHANGED
|
@@ -29,12 +29,14 @@ function nodeParametersFromJSON(node, json, deserializers) {
|
|
|
29
29
|
* @param {{nodes:[], connections:[], descriptions:[]}} json
|
|
30
30
|
* @param {NodeRegistry} [node_registry]
|
|
31
31
|
* @param {Map<string, function>} [deserializers]
|
|
32
|
+
* @param {boolean} [allow_node_id_collisions]
|
|
32
33
|
*/
|
|
33
34
|
export function deserializeNodeGraphFromJSON({
|
|
34
35
|
graph,
|
|
35
36
|
json,
|
|
36
37
|
node_registry = new NodeRegistry(),
|
|
37
|
-
deserializers = new Map()
|
|
38
|
+
deserializers = new Map(),
|
|
39
|
+
allow_node_id_collisions = false
|
|
38
40
|
}) {
|
|
39
41
|
|
|
40
42
|
const j_nodes = json.nodes;
|
|
@@ -79,12 +81,21 @@ export function deserializeNodeGraphFromJSON({
|
|
|
79
81
|
} else {
|
|
80
82
|
|
|
81
83
|
if (!existing_node.equals(loaded_node)) {
|
|
82
|
-
throw new Error(`Loaded node does not match the one in the registry. Loaded: ${loaded_node}, Existing: ${existing_node}`);
|
|
83
|
-
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
// collision exists
|
|
86
|
+
|
|
87
|
+
if (allow_node_id_collisions) {
|
|
88
|
+
descriptions[i] = loaded_node;
|
|
89
|
+
} else {
|
|
90
|
+
// illegal collision
|
|
91
|
+
throw new Error(`Loaded node does not match the one in the registry. Loaded: ${loaded_node}, Existing: ${existing_node}`);
|
|
92
|
+
}
|
|
87
93
|
|
|
94
|
+
} else {
|
|
95
|
+
|
|
96
|
+
// re-use node from registry
|
|
97
|
+
descriptions[i] = existing_node;
|
|
98
|
+
}
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
}
|