Skip to content

Commit c821f64

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

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

meshroom/ui/graph.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,14 @@ def setAttribute(self, attribute, value):
855855
@Slot(Attribute)
856856
def resetAttribute(self, attribute):
857857
""" Reset 'attribute' to its default value """
858-
# if the attribute is a ListAttribute, remove all edges
859-
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()))
858+
with self.groupedGraphModification("Reset Attribute '{}'".format(attribute.name)):
859+
# if the attribute is a ListAttribute, remove all edges
860+
if isinstance(attribute, ListAttribute):
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()))
865866

866867
@Slot(CompatibilityNode, result=Node)
867868
def upgradeNode(self, node):

0 commit comments

Comments
 (0)