nodeparamview: focus next best node when node is removed

Fixes #1616
This commit is contained in:
itsmattkc
2021-05-10 10:52:34 +10:00
parent 8383929476
commit 1c983f6b8c
+10 -1
View File
@@ -342,8 +342,17 @@ void NodeParamView::RemoveNode(Node *n)
delete items_.take(n);
if (focused_node_ == n) {
// Try to find new node with gizmos to focus
focused_node_ = nullptr;
emit FocusedNodeChanged(nullptr);
for (auto it=items_.cbegin(); it!=items_.cend(); it++) {
if (it.key()->HasGizmos()) {
focused_node_ = it.key();
it.value()->SetHighlighted(true);
break;
}
}
emit FocusedNodeChanged(focused_node_);
}
}