From aebf3ecc9d9cf3df69c2052108b524a7bc6af7b2 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 11 Aug 2022 11:20:37 +0200 Subject: [PATCH] Ported some missing changes. --- editor/plugins/spatial_editor_plugin.cpp | 59 +++++++++++++++--------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index fb8a5b9d1..bdbdd3113 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1361,24 +1361,37 @@ void SpatialEditorViewport::_sinput(const Ref &p_event) { return; //do NONE } + EditorPlugin::AfterGUIInput after = EditorPlugin::AFTER_GUI_INPUT_PASS; + { EditorNode *en = editor; + EditorPluginList *force_input_forwarding_list = en->get_editor_plugins_force_input_forwarding(); if (!force_input_forwarding_list->empty()) { - bool discard = force_input_forwarding_list->forward_spatial_gui_input(camera, p_event, true); - if (discard) { + EditorPlugin::AfterGUIInput discard = force_input_forwarding_list->forward_spatial_gui_input(camera, p_event, true); + + if (discard == EditorPlugin::AFTER_GUI_INPUT_STOP) { return; } + + if (discard == EditorPlugin::AFTER_GUI_INPUT_DESELECT) { + after = EditorPlugin::AFTER_GUI_INPUT_DESELECT; + } } } { EditorNode *en = editor; EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); if (!over_plugin_list->empty()) { - bool discard = over_plugin_list->forward_spatial_gui_input(camera, p_event, false); - if (discard) { + EditorPlugin::AfterGUIInput discard = over_plugin_list->forward_spatial_gui_input(camera, p_event, false); + + if (discard == EditorPlugin::AFTER_GUI_INPUT_STOP) { return; } + + if (discard == EditorPlugin::AFTER_GUI_INPUT_DESELECT) { + after = EditorPlugin::AFTER_GUI_INPUT_DESELECT; + } } } @@ -1635,20 +1648,22 @@ void SpatialEditorViewport::_sinput(const Ref &p_event) { break; } - clicked = _select_ray(b->get_position()); + if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) { + clicked = _select_ray(b->get_position()); - //TODO is this needed? - selection_in_progress = true; + //TODO is this needed? + selection_in_progress = true; - //clicking is always deferred to either move or release + //clicking is always deferred to either move or release - clicked_wants_append = b->get_shift(); + clicked_wants_append = b->get_shift(); - if (!clicked) { - //default to regionselect - cursor.region_select = true; - cursor.region_begin = b->get_position(); - cursor.region_end = b->get_position(); + if (!clicked) { + //default to regionselect + cursor.region_select = true; + cursor.region_begin = b->get_position(); + cursor.region_end = b->get_position(); + } } surface->update(); @@ -1659,14 +1674,16 @@ void SpatialEditorViewport::_sinput(const Ref &p_event) { break; } - if (clicked) { - _select_clicked(false); - } + if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) { + if (clicked) { + _select_clicked(false); + } - if (cursor.region_select) { - _select_region(); - cursor.region_select = false; - surface->update(); + if (cursor.region_select) { + _select_region(); + cursor.region_select = false; + surface->update(); + } } selection_in_progress = false;