1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Improved region-select in the 3D editor viewport

This commit is contained in:
Marcus Brummer
2022-02-09 10:32:03 +01:00
parent 79077e6c10
commit c283a0ece7

View File

@@ -1468,6 +1468,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
} break; } break;
case MouseButton::LEFT: { case MouseButton::LEFT: {
if (b->is_pressed()) { if (b->is_pressed()) {
clicked_wants_append = b->is_shift_pressed();
if (_edit.mode != TRANSFORM_NONE && _edit.instant) { if (_edit.mode != TRANSFORM_NONE && _edit.instant) {
commit_transform(); commit_transform();
break; // just commit the edit, stop processing the event so we don't deselect the object break; // just commit the edit, stop processing the event so we don't deselect the object
@@ -1597,8 +1599,6 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
//clicking is always deferred to either move or release //clicking is always deferred to either move or release
clicked_wants_append = b->is_shift_pressed();
if (clicked.is_null()) { if (clicked.is_null()) {
//default to regionselect //default to regionselect
cursor.region_select = true; cursor.region_select = true;
@@ -1727,6 +1727,12 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
_edit.mode = TRANSFORM_TRANSLATE; _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 (cursor.region_select) { if (cursor.region_select) {
cursor.region_end = m->get_position(); cursor.region_end = m->get_position();
surface->update(); surface->update();