Skip to content

Commit de54481

Browse files
committed
[ui] Reset ListAttribute connected as for loop remove also edges in one element of undo stack
1 parent ae7b980 commit de54481

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

meshroom/ui/graph.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -857,11 +857,14 @@ def resetAttribute(self, attribute):
857857
""" Reset 'attribute' to its default value """
858858
# if the attribute is a ListAttribute, remove all edges
859859
if isinstance(attribute, ListAttribute):
860-
for edge in self._graph.edges:
861-
# if the edge is connected to one of the ListAttribute's elements, remove it
862-
if edge.src in attribute.value:
863-
self.removeEdge(edge)
864-
self.push(commands.SetAttributeCommand(self._graph, attribute, attribute.defaultValue()))
860+
with self.groupedGraphModification("Reset List Attribute '{}'".format(attribute.name)):
861+
for edge in self._graph.edges:
862+
# if the edge is connected to one of the ListAttribute's elements, remove it
863+
if edge.src in attribute.value:
864+
self.removeEdge(edge)
865+
self.push(commands.SetAttributeCommand(self._graph, attribute, attribute.defaultValue()))
866+
else:
867+
self.push(commands.SetAttributeCommand(self._graph, attribute, attribute.defaultValue()))
865868

866869
@Slot(CompatibilityNode, result=Node)
867870
def upgradeNode(self, node):

0 commit comments

Comments
 (0)