diff --git a/src/editor/js/structures/graph/graph.ts b/src/editor/js/structures/graph/graph.ts index 0307c21cb43018d16487ef23d5280d85a08630bc..c7df25961f40d894f25d5d3409a9eaeddf31c337 100644 --- a/src/editor/js/structures/graph/graph.ts +++ b/src/editor/js/structures/graph/graph.ts @@ -305,7 +305,12 @@ export class Graph extends ManagedData { // No need to replace node ids with proper node objects, since that should be done in the graph itself. Only have to prepare valid GraphData }); - // Collect all node types + // Collect all node types and give id of none given yet + let typeId: number = undefined; + if (data.nodes[0].type.id === undefined) { + typeId = 0; + } + // TODO: Remove, when types are directly parsed and not just implicit data.nodes.forEach((node) => { const sharedType: NodeType = data.types.find( @@ -318,6 +323,11 @@ export class Graph extends ManagedData { return; } + if (typeId !== undefined) { + node.type.id = typeId; + typeId += 1; + } + // Doesn't exist in list yet, so add data.types.push(node.type); });