From ff9a0370ac95e7bf8bceacdee46ee337cd1cccbc Mon Sep 17 00:00:00 2001 From: Fabien Castan Date: Mon, 14 Apr 2025 22:45:47 +0200 Subject: [PATCH] Fix node states after loading The states of nodes were not valid the first time they were loaded, but became valid after any topological update (such as creating or removing a node or edge). The reason was that the loading of the graph was done before setting the project path (and thus the cacheDir). So the status files of the nodes were not available during the graph creation and were not updated at the end of the load. Now we set the filepath/cache first, so everything is right from the start. --- meshroom/core/graph.py | 6 ++++-- meshroom/core/node.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meshroom/core/graph.py b/meshroom/core/graph.py index 05c511cf..8197602d 100644 --- a/meshroom/core/graph.py +++ b/meshroom/core/graph.py @@ -252,8 +252,8 @@ class Graph(BaseObject): Args: filepath: The path to the Meshroom Graph file to load. """ - self._deserialize(Graph._loadGraphData(filepath)) self._setFilepath(filepath) + self._deserialize(Graph._loadGraphData(filepath)) self._fileDateVersion = os.path.getmtime(filepath) def initFromTemplate(self, filepath: PathLike, publishOutputs: bool = False): @@ -293,7 +293,9 @@ class Graph(BaseObject): Args: graphData: The serialized Graph. """ - self.clear() + self._clearGraphContent() + self.header.clear() + self.header = graphData.get(GraphIO.Keys.Header, {}) fileVersion = Version(self.header.get(GraphIO.Keys.FileVersion, "0.0")) graphContent = self._normalizeGraphContent(graphData, fileVersion) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index d8722de5..dc8fcd22 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -952,7 +952,7 @@ class BaseNode(BaseObject): def nbParallelizationBlocks(self): return len(self._chunks) - def hasStatus(self, status): + def hasStatus(self, status: Status): if not self._chunks: return (status == Status.INPUT) for chunk in self._chunks: