diff options
-rw-r--r-- | core/math/vector2.h | 4 | ||||
-rw-r--r-- | core/math/vector2i.h | 22 | ||||
-rw-r--r-- | doc/classes/Color.xml | 5 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 10 |
4 files changed, 27 insertions, 14 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index 123e3dc7b6..92ac5257b0 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -60,10 +60,10 @@ struct _NO_DISCARD_ Vector2 { }; _FORCE_INLINE_ real_t &operator[](int p_idx) { - return p_idx ? y : x; + return coord[p_idx]; } _FORCE_INLINE_ const real_t &operator[](int p_idx) const { - return p_idx ? y : x; + return coord[p_idx]; } _FORCE_INLINE_ void set_all(const real_t p_value) { diff --git a/core/math/vector2i.h b/core/math/vector2i.h index 707c8c9490..3f5f12d4dd 100644 --- a/core/math/vector2i.h +++ b/core/math/vector2i.h @@ -43,19 +43,25 @@ struct _NO_DISCARD_ Vector2i { }; union { - int32_t x = 0; - int32_t width; - }; - union { - int32_t y = 0; - int32_t height; + struct { + union { + int32_t x; + int32_t width; + }; + union { + int32_t y; + int32_t height; + }; + }; + + int32_t coord[2] = { 0 }; }; _FORCE_INLINE_ int32_t &operator[](int p_idx) { - return p_idx ? y : x; + return coord[p_idx]; } _FORCE_INLINE_ const int32_t &operator[](int p_idx) const { - return p_idx ? y : x; + return coord[p_idx]; } _FORCE_INLINE_ Vector2i::Axis min_axis_index() const { diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 4e73d4d9d8..8fd01509ec 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -221,14 +221,15 @@ Returns a new color from [code]rgba[/code], an HTML hexadecimal color string. [code]rgba[/code] is not case sensitive, and may be prefixed with a '#' character. [code]rgba[/code] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [code]rgba[/code] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If [code]rgba[/code] is invalid a Color(0.0, 0.0, 0.0, 1.0) is returned. + [b]Note:[/b] This method is not implemented in C#, but the same functionality is provided in the class constructor. [codeblocks] [gdscript] var green = Color.html("#00FF00FF") # set green to Color(0.0, 1.0, 0.0, 1.0) var blue = Color.html("#0000FF") # set blue to Color(0.0, 0.0, 1.0, 1.0) [/gdscript] [csharp] - var green = Color.Html("#00FF00FF"); // set green to Color(0.0, 1.0, 0.0, 1.0) - var blue = Color.Html("#0000FF"); // set blue to Color(0.0, 0.0, 1.0, 1.0) + var green = new Color("#00FF00FF"); // set green to Color(0.0, 1.0, 0.0, 1.0) + var blue = new Color("#0000FF"); // set blue to Color(0.0, 0.0, 1.0, 1.0) [/csharp] [/codeblocks] </description> diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 2e8ae1a286..e35af6dd64 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1468,6 +1468,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } break; case MouseButton::LEFT: { if (b->is_pressed()) { + clicked_wants_append = b->is_shift_pressed(); + if (_edit.mode != TRANSFORM_NONE && _edit.instant) { commit_transform(); 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 - clicked_wants_append = b->is_shift_pressed(); - if (clicked.is_null()) { //default to regionselect cursor.region_select = true; @@ -1727,6 +1727,12 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { _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) { cursor.region_end = m->get_position(); surface->update(); |