Ported some missing changes.

This commit is contained in:
Relintai 2022-08-11 11:20:37 +02:00
parent 3cbdd9cfa1
commit aebf3ecc9d

View File

@ -1361,24 +1361,37 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
return; //do NONE return; //do NONE
} }
EditorPlugin::AfterGUIInput after = EditorPlugin::AFTER_GUI_INPUT_PASS;
{ {
EditorNode *en = editor; EditorNode *en = editor;
EditorPluginList *force_input_forwarding_list = en->get_editor_plugins_force_input_forwarding(); EditorPluginList *force_input_forwarding_list = en->get_editor_plugins_force_input_forwarding();
if (!force_input_forwarding_list->empty()) { if (!force_input_forwarding_list->empty()) {
bool discard = force_input_forwarding_list->forward_spatial_gui_input(camera, p_event, true); EditorPlugin::AfterGUIInput discard = force_input_forwarding_list->forward_spatial_gui_input(camera, p_event, true);
if (discard) {
if (discard == EditorPlugin::AFTER_GUI_INPUT_STOP) {
return; return;
} }
if (discard == EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
after = EditorPlugin::AFTER_GUI_INPUT_DESELECT;
}
} }
} }
{ {
EditorNode *en = editor; EditorNode *en = editor;
EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
if (!over_plugin_list->empty()) { if (!over_plugin_list->empty()) {
bool discard = over_plugin_list->forward_spatial_gui_input(camera, p_event, false); EditorPlugin::AfterGUIInput discard = over_plugin_list->forward_spatial_gui_input(camera, p_event, false);
if (discard) {
if (discard == EditorPlugin::AFTER_GUI_INPUT_STOP) {
return; return;
} }
if (discard == EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
after = EditorPlugin::AFTER_GUI_INPUT_DESELECT;
}
} }
} }
@ -1635,20 +1648,22 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break; break;
} }
clicked = _select_ray(b->get_position()); if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
clicked = _select_ray(b->get_position());
//TODO is this needed? //TODO is this needed?
selection_in_progress = true; 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) { if (!clicked) {
//default to regionselect //default to regionselect
cursor.region_select = true; cursor.region_select = true;
cursor.region_begin = b->get_position(); cursor.region_begin = b->get_position();
cursor.region_end = b->get_position(); cursor.region_end = b->get_position();
}
} }
surface->update(); surface->update();
@ -1659,14 +1674,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break; break;
} }
if (clicked) { if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
_select_clicked(false); if (clicked) {
} _select_clicked(false);
}
if (cursor.region_select) { if (cursor.region_select) {
_select_region(); _select_region();
cursor.region_select = false; cursor.region_select = false;
surface->update(); surface->update();
}
} }
selection_in_progress = false; selection_in_progress = false;