From b3117defddf646b414e3fae16e3a69cd1651d0b7 Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Mon, 9 Dec 2024 18:31:13 +0100 Subject: [PATCH] [core][graphIO] Add "template" as an explicit key --- meshroom/core/graph.py | 4 ++-- meshroom/core/graphIO.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meshroom/core/graph.py b/meshroom/core/graph.py index bbc0a34191..02840fc321 100644 --- a/meshroom/core/graph.py +++ b/meshroom/core/graph.py @@ -273,7 +273,7 @@ def _deserialize(self, graphData: dict): self.header = graphData.get(GraphIO.Keys.Header, {}) fileVersion = Version(self.header.get(GraphIO.Keys.FileVersion, "0.0")) graphContent = self._normalizeGraphContent(graphData, fileVersion) - isTemplate = self.header.get("template", False) + isTemplate = self.header.get(GraphIO.Keys.Template, False) with GraphModification(self): # iterate over nodes sorted by suffix index in their names @@ -331,7 +331,7 @@ def _deserializeNode(self, nodeData: dict, nodeName: str, fromGraph: "Graph"): # 3. fallback behavior: default to "0.0" if "version" not in nodeData: nodeData["version"] = fromGraph._getNodeTypeVersionFromHeader(nodeData["nodeType"], "0.0") - inTemplate = fromGraph.header.get("template", False) + inTemplate = fromGraph.header.get(GraphIO.Keys.Template, False) node = nodeFactory(nodeData, nodeName, inTemplate=inTemplate) self._addNode(node, nodeName) return node diff --git a/meshroom/core/graphIO.py b/meshroom/core/graphIO.py index 5f81db2648..196888036a 100644 --- a/meshroom/core/graphIO.py +++ b/meshroom/core/graphIO.py @@ -24,6 +24,7 @@ class Keys(object): ReleaseVersion = "releaseVersion" FileVersion = "fileVersion" Graph = "graph" + Template = "template" class Features(Enum): """File Features.""" @@ -122,7 +123,7 @@ class TemplateGraphSerializer(GraphSerializer): def serializeHeader(self) -> dict: header = super().serializeHeader() - header["template"] = True + header[GraphIO.Keys.Template] = True return header def serializeNode(self, node: Node) -> dict: