From b08f83552e6b89272e5731c2e01a16d92bd41072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 28 Nov 2022 09:42:08 +0100 Subject: [PATCH] [ui] Clear locally submitted nodes before loading a new graph When loading a new graph while the opened one was locally computing nodes, computations were automatically stopped to be able to load the new graph. However, the computing chunks' status were not being updated before the graphs were switched up. This meant that opening that previously computing graph again would lead to a display in which nodes appeared to be computing although there was no ongoing computations. --- meshroom/core/graph.py | 5 +++++ meshroom/core/node.py | 6 ++++++ meshroom/ui/graph.py | 3 +++ 3 files changed, 14 insertions(+) diff --git a/meshroom/core/graph.py b/meshroom/core/graph.py index 4ad528fd..235239f9 100644 --- a/meshroom/core/graph.py +++ b/meshroom/core/graph.py @@ -1366,6 +1366,11 @@ class Graph(BaseObject): for node in self.nodes: node.clearSubmittedChunks() + def clearLocallySubmittedNodes(self): + """ Reset the status of already locally submitted nodes to Status.NONE """ + for node in self.nodes: + node.clearLocallySubmittedChunks() + def iterChunksByStatus(self, status): """ Iterate over NodeChunks with the given status """ for node in self.nodes: diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 29df5be3..e754bb28 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -779,6 +779,12 @@ class BaseNode(BaseObject): if chunk.isAlreadySubmitted(): chunk.upgradeStatusTo(Status.NONE, ExecMode.NONE) + def clearLocallySubmittedChunks(self): + """ Reset all locally submitted chunks to Status.NONE. """ + for chunk in self._chunks: + if chunk.isAlreadySubmitted() and not chunk.isExtern(): + chunk.upgradeStatusTo(Status.NONE, ExecMode.NONE) + def upgradeStatusTo(self, newStatus): """ Upgrade node to the given status and save it on disk. diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index 100671be..c96384b5 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -284,6 +284,9 @@ class UIGraph(QObject): """ Set the internal graph. """ if self._graph: self.stopExecution() + # Clear all the locally submitted nodes at once before the graph gets changed, as it won't receive further updates + if self._computingLocally: + self._graph.clearLocallySubmittedNodes() self.clear() oldGraph = self._graph self._graph = g