Skip to content

Commit

Permalink
[ui] Additive mode for select following Nodes
Browse files Browse the repository at this point in the history
Implement additive selection behavior when selecting downstream
nodes from a node, using Alt+Shift+Click.
  • Loading branch information
yann-lty committed Dec 9, 2024
1 parent 4730cc0 commit 944ff15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,12 @@ def selectNodes(self, nodes, command=QItemSelectionModel.SelectionFlag.ClearAndS
self.selectNodesByIndices(indices, command)

@Slot(Node)
def selectFollowing(self, node: Node):
@Slot(Node, int)
def selectFollowing(self, node: Node, command=QItemSelectionModel.SelectionFlag.ClearAndSelect):
"""Select all the nodes that depend on `node`."""
self.selectNodes(self._graph.dfsOnDiscover(startNodes=[node], reverse=True, dependenciesOnly=True)[0])
self.selectNodes(
self._graph.dfsOnDiscover(startNodes=[node], reverse=True, dependenciesOnly=True)[0], command
)
self.selectedNode = node

@Slot(int)
Expand Down
7 changes: 6 additions & 1 deletion meshroom/ui/qml/GraphEditor/GraphEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,12 @@ Item {
selectionMode = ItemSelectionModel.Toggle;
}
if(mouse.modifiers & Qt.AltModifier) {
uigraph.selectFollowing(node);
let selectFollowingMode = ItemSelectionModel.ClearAndSelect;
if(mouse.modifiers & Qt.ShiftModifier) {
selectFollowingMode = ItemSelectionModel.Select;
}
uigraph.selectFollowing(node, selectFollowingMode);
// Indicate selection has been dealt with by setting conservative Select mode.
selectionMode = ItemSelectionModel.Select;
}
}
Expand Down

0 comments on commit 944ff15

Please sign in to comment.