summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorMarcus Brummer <mbrlabs7@gmail.com>2022-02-10 00:24:52 +0100
committerMarcus Brummer <mbrlabs7@gmail.com>2022-02-11 09:43:40 +0100
commit3c4c73b1005ccb975e3398aa95ed42e52d95f658 (patch)
tree13d376f227baaa263266002d5d2af96b18cfeb0f /editor/plugins
parent8161e285126797b8076dbf7583df38bf0539d0a8 (diff)
Fixed issues with 3D region-select in the editor
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp27
-rw-r--r--editor/plugins/node_3d_editor_plugin.h1
2 files changed, 17 insertions, 11 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index e35af6dd64..bee3aa3bfe 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1595,9 +1595,9 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
- clicked = _select_ray(b->get_position());
-
//clicking is always deferred to either move or release
+ clicked = _select_ray(b->get_position());
+ selection_in_progress = true;
if (clicked.is_null()) {
//default to regionselect
@@ -1616,6 +1616,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
+ selection_in_progress = false;
+
if (clicked.is_valid()) {
_select_clicked(false);
}
@@ -1720,17 +1722,14 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
nav_mode = NAVIGATION_ORBIT;
} else {
const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE;
- if (clicked.is_valid() && movement_threshold_passed) {
- _compute_edit(_edit.original_mouse_pos);
- clicked = ObjectID();
-
- _edit.mode = TRANSFORM_TRANSLATE;
- }
// enable region-select if nothing has been selected yet or multi-select (shift key) is active
- if (movement_threshold_passed && (get_selected_count() == 0 || clicked_wants_append)) {
- cursor.region_select = true;
- cursor.region_begin = _edit.original_mouse_pos;
+ if (selection_in_progress && movement_threshold_passed) {
+ if (get_selected_count() == 0 || clicked_wants_append) {
+ cursor.region_select = true;
+ cursor.region_begin = _edit.original_mouse_pos;
+ clicked = ObjectID();
+ }
}
if (cursor.region_select) {
@@ -1739,6 +1738,12 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
return;
}
+ if (clicked.is_valid() && movement_threshold_passed) {
+ _compute_edit(_edit.original_mouse_pos);
+ clicked = ObjectID();
+ _edit.mode = TRANSFORM_TRANSLATE;
+ }
+
if (_edit.mode == TRANSFORM_NONE) {
return;
}
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index bbe5615570..16d9815288 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -269,6 +269,7 @@ private:
ObjectID clicked;
Vector<_RayResult> selection_results;
bool clicked_wants_append;
+ bool selection_in_progress = false;
PopupMenu *selection_menu;