Skip to content

Commit

Permalink
[core][graphIO] Add "template" as an explicit key
Browse files Browse the repository at this point in the history
  • Loading branch information
yann-lty committed Dec 10, 2024
1 parent 03d01e1 commit b3117de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions meshroom/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion meshroom/core/graphIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Keys(object):
ReleaseVersion = "releaseVersion"
FileVersion = "fileVersion"
Graph = "graph"
Template = "template"

class Features(Enum):
"""File Features."""
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b3117de

Please sign in to comment.