Skip to content

Commit 9acd7f8

Browse files
committed
[core] Discard attribute callbacks during graph loading
1 parent 87e538c commit 9acd7f8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

meshroom/core/graph.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def getFeaturesForVersion(fileVersion):
215215
def __init__(self, name, parent=None):
216216
super(Graph, self).__init__(parent)
217217
self.name = name
218+
self._loading = False
218219
self._updateEnabled = True
219220
self._updateRequested = False
220221
self.dirtyTopology = False
@@ -247,6 +248,11 @@ def fileFeatures(self):
247248
""" Get loaded file supported features based on its version. """
248249
return Graph.IO.getFeaturesForVersion(self.header.get(Graph.IO.Keys.FileVersion, "0.0"))
249250

251+
@property
252+
def isLoading(self):
253+
""" Return True if the graph is currently being loaded. """
254+
return self._loading
255+
250256
@Slot(str)
251257
def load(self, filepath, setupProjectFile=True, importProject=False, publishOutputs=False):
252258
"""
@@ -260,6 +266,13 @@ def load(self, filepath, setupProjectFile=True, importProject=False, publishOutp
260266
of opened.
261267
publishOutputs: True if "Publish" nodes from templates should not be ignored.
262268
"""
269+
self._loading = True
270+
try:
271+
self._load(filepath, setupProjectFile, importProject, publishOutputs)
272+
finally:
273+
self._loading = False
274+
275+
def _load(self, filepath, setupProjectFile, importProject, publishOutputs):
263276
if not importProject:
264277
self.clear()
265278
with open(filepath) as jsonFile:

meshroom/core/node.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,10 @@ def _onAttributeChanged(self, attr: Attribute):
964964
if attr.value is None:
965965
# Discard dynamic values depending on the graph processing.
966966
return
967+
968+
if self.graph and self.graph.isLoading:
969+
# Do not trigger attribute callbacks during the graph loading.
970+
return
967971

968972
callback = self._getAttributeChangedCallback(attr)
969973

0 commit comments

Comments
 (0)