Skip to content

Commit 61d3590

Browse files
committed
[core] Discard attribute callbacks during graph loading
1 parent 98f1a9d commit 61d3590

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
@@ -214,6 +214,7 @@ def getFeaturesForVersion(fileVersion):
214214
def __init__(self, name, parent=None):
215215
super(Graph, self).__init__(parent)
216216
self.name = name
217+
self._loading = False
217218
self._updateEnabled = True
218219
self._updateRequested = False
219220
self.dirtyTopology = False
@@ -246,6 +247,11 @@ def fileFeatures(self):
246247
""" Get loaded file supported features based on its version. """
247248
return Graph.IO.getFeaturesForVersion(self.header.get(Graph.IO.Keys.FileVersion, "0.0"))
248249

250+
@property
251+
def isLoading(self):
252+
""" Return True if the graph is currently being loaded. """
253+
return self._loading
254+
249255
@Slot(str)
250256
def load(self, filepath, setupProjectFile=True, importProject=False, publishOutputs=False):
251257
"""
@@ -259,6 +265,13 @@ def load(self, filepath, setupProjectFile=True, importProject=False, publishOutp
259265
of opened.
260266
publishOutputs: True if "Publish" nodes from templates should not be ignored.
261267
"""
268+
self._loading = True
269+
try:
270+
self._load(filepath, setupProjectFile, importProject, publishOutputs)
271+
finally:
272+
self._loading = False
273+
274+
def _load(self, filepath, setupProjectFile, importProject, publishOutputs):
262275
if not importProject:
263276
self.clear()
264277
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)