Skip to content

Commit

Permalink
[ui] Graph: Using Grouped UI Graph Modification to disable animation …
Browse files Browse the repository at this point in the history
…for qml elements

Used graph's disabledAnimation flag to halt the animations when a backdrop node is resized during an undo.
  • Loading branch information
waaake committed Jan 8, 2025
1 parent 54a569a commit 68e1ba3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,18 @@ def groupedGraphModification(self, title, disableUpdates=True):
"""
return commands.GroupedGraphModification(self._graph, self._undoStack, title, disableUpdates)

def groupedUIGraphModification(self, title, disableUpdates=True):
""" Get a GroupedUIGraphModification for this Graph.
Args:
title (str): the title of the macro command
disableUpdates (bool): whether to disable graph and ui updates
Returns:
GroupedGraphModification: the instantiated context manager
"""
return commands.GroupedUIGraphModification(self, self._undoStack, title, disableUpdates)

@Slot(str)
def beginModification(self, name):
""" Begin a Graph modification. Calls to beginModification and endModification may be nested, but
Expand Down Expand Up @@ -698,7 +710,7 @@ def resizeAndMoveNode(self, node, width, height, position=None):
position (QPoint): Node's position.
"""
# Update the node size
with self.groupedGraphModification("Resize Node"):
with self.groupedUIGraphModification("Resize Node"):
if node.hasInternalAttribute("nodeWidth"):
self.setAttribute(node.internalAttribute("nodeWidth"), width)
if node.hasInternalAttribute("nodeHeight"):
Expand Down
2 changes: 1 addition & 1 deletion meshroom/ui/qml/GraphEditor/GraphEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ Item {
}

Behavior on x {
enabled: !nodeRepeater.ongoingDrag && !resizing
enabled: !nodeRepeater.ongoingDrag && !resizing && !uigraph.animationsDisabled;
NumberAnimation { duration: 100 }
}
Behavior on y {
Expand Down

0 comments on commit 68e1ba3

Please sign in to comment.