mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
Prevent duplication/removal a node more than once in the same action
This commit is contained in:
parent
c4c8b5c8d5
commit
819d9e3e70
1 changed files with 6 additions and 2 deletions
|
@ -559,9 +559,11 @@ class UIGraph(QObject):
|
|||
"""
|
||||
with self.groupedGraphModification("Remove Nodes From Selected Nodes"):
|
||||
nodesToRemove, _ = self._graph.dfsOnDiscover(startNodes=nodes, reverse=True, dependenciesOnly=True)
|
||||
# filter out nodes that will be removed more than once
|
||||
uniqueNodesToRemove = list(dict.fromkeys(nodesToRemove))
|
||||
# Perform nodes removal from leaves to start node so that edges
|
||||
# can be re-created in correct order on redo.
|
||||
self.removeNodes(list(reversed(nodesToRemove)))
|
||||
self.removeNodes(list(reversed(uniqueNodesToRemove)))
|
||||
|
||||
@Slot(QObject, result="QVariantList")
|
||||
def duplicateNodes(self, nodes):
|
||||
|
@ -609,7 +611,9 @@ class UIGraph(QObject):
|
|||
"""
|
||||
with self.groupedGraphModification("Duplicate Nodes From Selected Nodes"):
|
||||
nodesToDuplicate, _ = self._graph.dfsOnDiscover(startNodes=nodes, reverse=True, dependenciesOnly=True)
|
||||
duplicates = self.duplicateNodes(nodesToDuplicate)
|
||||
# filter out nodes that will be duplicated more than once
|
||||
uniqueNodesToDuplicate = list(dict.fromkeys(nodesToDuplicate))
|
||||
duplicates = self.duplicateNodes(uniqueNodesToDuplicate)
|
||||
return duplicates
|
||||
|
||||
@Slot(QObject)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue