Better deselection handling in AnimationTree editors

This commit is contained in:
vaner-org
2025-08-30 17:56:36 +05:30
parent 825ef2387f
commit f6a6aad6eb
5 changed files with 77 additions and 0 deletions

View File

@@ -203,6 +203,11 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
}
}
}
// If no point or triangle was selected, select host BlendSpace2D node.
if (selected_point == -1 && selected_triangle == -1) {
EditorNode::get_singleton()->push_item(blend_space.ptr(), "", true);
}
}
if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
@@ -727,7 +732,12 @@ void AnimationNodeBlendSpace2DEditor::_erase_selected() {
undo_redo->add_do_method(this, "_update_space");
undo_redo->add_undo_method(this, "_update_space");
undo_redo->commit_action();
// Return selection to host BlendSpace2D node.
EditorNode::get_singleton()->push_item(blend_space.ptr(), "", true);
updating = false;
_update_tool_erase();
blend_space_draw->queue_redraw();
} else if (selected_triangle != -1) {
@@ -739,7 +749,11 @@ void AnimationNodeBlendSpace2DEditor::_erase_selected() {
undo_redo->add_do_method(this, "_update_space");
undo_redo->add_undo_method(this, "_update_space");
undo_redo->commit_action();
selected_triangle = -1;
updating = false;
_update_tool_erase();
blend_space_draw->queue_redraw();
}