Skip to content

Commit ff9a037

Browse files
committed
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.
1 parent be43c5c commit ff9a037

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

meshroom/core/graph.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ def load(self, filepath: PathLike):
252252
Args:
253253
filepath: The path to the Meshroom Graph file to load.
254254
"""
255-
self._deserialize(Graph._loadGraphData(filepath))
256255
self._setFilepath(filepath)
256+
self._deserialize(Graph._loadGraphData(filepath))
257257
self._fileDateVersion = os.path.getmtime(filepath)
258258

259259
def initFromTemplate(self, filepath: PathLike, publishOutputs: bool = False):
@@ -293,7 +293,9 @@ def _deserialize(self, graphData: dict):
293293
Args:
294294
graphData: The serialized Graph.
295295
"""
296-
self.clear()
296+
self._clearGraphContent()
297+
self.header.clear()
298+
297299
self.header = graphData.get(GraphIO.Keys.Header, {})
298300
fileVersion = Version(self.header.get(GraphIO.Keys.FileVersion, "0.0"))
299301
graphContent = self._normalizeGraphContent(graphData, fileVersion)

meshroom/core/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ def isParallelized(self):
952952
def nbParallelizationBlocks(self):
953953
return len(self._chunks)
954954

955-
def hasStatus(self, status):
955+
def hasStatus(self, status: Status):
956956
if not self._chunks:
957957
return (status == Status.INPUT)
958958
for chunk in self._chunks:

0 commit comments

Comments
 (0)