From 10d7fccb549a743a867b92f12a6d64717c45ba86 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Thu, 7 Jan 2021 22:37:37 -0500 Subject: [PATCH 1/2] Rename ButtonList enum and members to MouseButton --- core/core_constants.cpp | 30 ++++---- core/input/input.cpp | 10 +-- core/input/input_event.cpp | 56 +++++++------- core/input/input_event.h | 30 ++++---- doc/classes/@GlobalScope.xml | 28 +++---- doc/classes/BaseButton.xml | 2 +- doc/classes/Control.xml | 2 +- doc/classes/Sprite2D.xml | 2 +- editor/action_map_editor.cpp | 2 +- editor/animation_bezier_editor.cpp | 18 ++--- editor/animation_track_editor.cpp | 34 ++++----- editor/animation_track_editor_plugins.cpp | 4 +- editor/code_editor.cpp | 8 +- .../debugger/editor_performance_profiler.cpp | 2 +- editor/debugger/editor_profiler.cpp | 4 +- editor/debugger/editor_visual_profiler.cpp | 4 +- editor/editor_audio_buses.cpp | 2 +- editor/editor_inspector.cpp | 6 +- editor/editor_node.cpp | 6 +- editor/editor_properties.cpp | 12 +-- editor/editor_spin_slider.cpp | 10 +-- editor/import/scene_import_settings.cpp | 6 +- editor/plugins/abstract_polygon_2d_editor.cpp | 12 +-- .../animation_blend_space_1d_editor.cpp | 10 +-- .../animation_blend_space_2d_editor.cpp | 12 +-- .../animation_state_machine_editor.cpp | 12 +-- editor/plugins/canvas_item_editor_plugin.cpp | 74 +++++++++---------- .../collision_polygon_3d_editor_plugin.cpp | 10 +-- .../collision_shape_2d_editor_plugin.cpp | 2 +- editor/plugins/curve_editor_plugin.cpp | 8 +- editor/plugins/mesh_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 27 +++---- editor/plugins/path_2d_editor_plugin.cpp | 10 +-- editor/plugins/path_3d_editor_plugin.cpp | 4 +- editor/plugins/polygon_2d_editor_plugin.cpp | 10 +-- editor/plugins/script_editor_plugin.cpp | 4 +- editor/plugins/script_text_editor.cpp | 2 +- editor/plugins/shader_editor_plugin.cpp | 2 +- .../plugins/sprite_frames_editor_plugin.cpp | 10 +-- editor/plugins/text_editor.cpp | 2 +- .../plugins/texture_layered_editor_plugin.cpp | 2 +- .../plugins/texture_region_editor_plugin.cpp | 10 +-- editor/plugins/tile_map_editor_plugin.cpp | 10 +-- editor/plugins/tile_set_editor_plugin.cpp | 36 ++++----- .../plugins/visual_shader_editor_plugin.cpp | 2 +- editor/project_manager.cpp | 2 +- editor/property_editor.cpp | 2 +- editor/scene_tree_dock.cpp | 2 +- modules/gridmap/grid_map_editor_plugin.cpp | 20 ++--- .../visual_script/visual_script_editor.cpp | 2 +- platform/android/display_server_android.cpp | 38 +++++----- .../javascript/display_server_javascript.cpp | 18 ++--- platform/linuxbsd/display_server_x11.cpp | 2 +- platform/osx/display_server_osx.mm | 30 ++++---- platform/uwp/app.cpp | 16 ++-- platform/windows/display_server_windows.cpp | 20 ++--- scene/gui/base_button.h | 2 +- scene/gui/color_picker.cpp | 14 ++-- scene/gui/graph_edit.cpp | 28 +++---- scene/gui/graph_node.cpp | 4 +- scene/gui/item_list.cpp | 18 ++--- scene/gui/line_edit.cpp | 6 +- scene/gui/popup_menu.cpp | 2 +- scene/gui/rich_text_label.cpp | 6 +- scene/gui/scroll_bar.cpp | 6 +- scene/gui/scroll_container.cpp | 10 +-- scene/gui/slider.cpp | 6 +- scene/gui/spin_box.cpp | 14 ++-- scene/gui/split_container.cpp | 2 +- scene/gui/tab_container.cpp | 2 +- scene/gui/tabs.cpp | 10 +-- scene/gui/text_edit.cpp | 26 +++---- scene/gui/tree.cpp | 52 ++++++------- scene/main/viewport.cpp | 26 +++---- tests/test_physics_2d.cpp | 4 +- 75 files changed, 468 insertions(+), 473 deletions(-) diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 5abfee05bf06..4f2faf417269 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -106,7 +106,7 @@ static Vector<_CoreConstant> _global_constants; VARIANT_ENUM_CAST(KeyList); VARIANT_ENUM_CAST(KeyModifierMask); -VARIANT_ENUM_CAST(ButtonList); +VARIANT_ENUM_CAST(MouseButton); VARIANT_ENUM_CAST(JoyButtonList); VARIANT_ENUM_CAST(JoyAxisList); VARIANT_ENUM_CAST(MidiMessageList); @@ -397,20 +397,20 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH); // mouse - BIND_CORE_ENUM_CONSTANT(BUTTON_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MIDDLE); - BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON1); - BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON2); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_UP); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_DOWN); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_MIDDLE); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MIDDLE); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON1); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON2); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_UP); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_DOWN); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_MIDDLE); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON1); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON2); // Joypad buttons BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID); diff --git a/core/input/input.cpp b/core/input/input.cpp index 3a8c1c16285f..09a5c5ef320a 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -560,11 +560,11 @@ void Input::_parse_input_event_impl(const Ref &p_event, bool p_is_em button_event->set_position(st->get_position()); button_event->set_global_position(st->get_position()); button_event->set_pressed(st->is_pressed()); - button_event->set_button_index(BUTTON_LEFT); + button_event->set_button_index(MOUSE_BUTTON_LEFT); if (st->is_pressed()) { - button_event->set_button_mask(mouse_button_mask | (1 << (BUTTON_LEFT - 1))); + button_event->set_button_mask(mouse_button_mask | (1 << (MOUSE_BUTTON_LEFT - 1))); } else { - button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1))); + button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1))); } _parse_input_event_impl(button_event, true); @@ -792,8 +792,8 @@ void Input::ensure_touch_mouse_raised() { button_event->set_position(mouse_pos); button_event->set_global_position(mouse_pos); button_event->set_pressed(false); - button_event->set_button_index(BUTTON_LEFT); - button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1))); + button_event->set_button_index(MOUSE_BUTTON_LEFT); + button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1))); _parse_input_event_impl(button_event, true); } diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index c6910d2b1f33..99cc51b95e9b 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -619,15 +619,15 @@ String InputEventMouseButton::as_text() const { // Button int idx = get_button_index(); switch (idx) { - case BUTTON_LEFT: - case BUTTON_RIGHT: - case BUTTON_MIDDLE: - case BUTTON_WHEEL_UP: - case BUTTON_WHEEL_DOWN: - case BUTTON_WHEEL_LEFT: - case BUTTON_WHEEL_RIGHT: - case BUTTON_XBUTTON1: - case BUTTON_XBUTTON2: + case MOUSE_BUTTON_LEFT: + case MOUSE_BUTTON_RIGHT: + case MOUSE_BUTTON_MIDDLE: + case MOUSE_BUTTON_WHEEL_UP: + case MOUSE_BUTTON_WHEEL_DOWN: + case MOUSE_BUTTON_WHEEL_LEFT: + case MOUSE_BUTTON_WHEEL_RIGHT: + case MOUSE_BUTTON_XBUTTON1: + case MOUSE_BUTTON_XBUTTON2: full_string += RTR(_mouse_button_descriptions[idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1 break; default: @@ -651,15 +651,15 @@ String InputEventMouseButton::to_string() { String button_string = itos(idx); switch (idx) { - case BUTTON_LEFT: - case BUTTON_RIGHT: - case BUTTON_MIDDLE: - case BUTTON_WHEEL_UP: - case BUTTON_WHEEL_DOWN: - case BUTTON_WHEEL_LEFT: - case BUTTON_WHEEL_RIGHT: - case BUTTON_XBUTTON1: - case BUTTON_XBUTTON2: + case MOUSE_BUTTON_LEFT: + case MOUSE_BUTTON_RIGHT: + case MOUSE_BUTTON_MIDDLE: + case MOUSE_BUTTON_WHEEL_UP: + case MOUSE_BUTTON_WHEEL_DOWN: + case MOUSE_BUTTON_WHEEL_LEFT: + case MOUSE_BUTTON_WHEEL_RIGHT: + case MOUSE_BUTTON_XBUTTON1: + case MOUSE_BUTTON_XBUTTON2: button_string += " (" + RTR(_mouse_button_descriptions[idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1 break; default: @@ -761,20 +761,20 @@ String InputEventMouseMotion::to_string() { int button_mask = get_button_mask(); String button_mask_string = itos(button_mask); switch (get_button_mask()) { - case BUTTON_MASK_LEFT: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_LEFT - 1]) + ")"; + case MOUSE_BUTTON_MASK_LEFT: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_LEFT - 1]) + ")"; break; - case BUTTON_MASK_MIDDLE: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_MIDDLE - 1]) + ")"; + case MOUSE_BUTTON_MASK_MIDDLE: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_MIDDLE - 1]) + ")"; break; - case BUTTON_MASK_RIGHT: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_RIGHT - 1]) + ")"; + case MOUSE_BUTTON_MASK_RIGHT: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_RIGHT - 1]) + ")"; break; - case BUTTON_MASK_XBUTTON1: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON1 - 1]) + ")"; + case MOUSE_BUTTON_MASK_XBUTTON1: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON1 - 1]) + ")"; break; - case BUTTON_MASK_XBUTTON2: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON2 - 1]) + ")"; + case MOUSE_BUTTON_MASK_XBUTTON2: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON2 - 1]) + ")"; break; default: break; diff --git a/core/input/input_event.h b/core/input/input_event.h index df81b9fc7505..42bfdd340ee9 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -42,21 +42,21 @@ * The events are pretty obvious. */ -enum ButtonList { - BUTTON_LEFT = 1, - BUTTON_RIGHT = 2, - BUTTON_MIDDLE = 3, - BUTTON_WHEEL_UP = 4, - BUTTON_WHEEL_DOWN = 5, - BUTTON_WHEEL_LEFT = 6, - BUTTON_WHEEL_RIGHT = 7, - BUTTON_XBUTTON1 = 8, - BUTTON_XBUTTON2 = 9, - BUTTON_MASK_LEFT = (1 << (BUTTON_LEFT - 1)), - BUTTON_MASK_RIGHT = (1 << (BUTTON_RIGHT - 1)), - BUTTON_MASK_MIDDLE = (1 << (BUTTON_MIDDLE - 1)), - BUTTON_MASK_XBUTTON1 = (1 << (BUTTON_XBUTTON1 - 1)), - BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1)) +enum MouseButton { + MOUSE_BUTTON_LEFT = 1, + MOUSE_BUTTON_RIGHT = 2, + MOUSE_BUTTON_MIDDLE = 3, + MOUSE_BUTTON_WHEEL_UP = 4, + MOUSE_BUTTON_WHEEL_DOWN = 5, + MOUSE_BUTTON_WHEEL_LEFT = 6, + MOUSE_BUTTON_WHEEL_RIGHT = 7, + MOUSE_BUTTON_XBUTTON1 = 8, + MOUSE_BUTTON_XBUTTON2 = 9, + MOUSE_BUTTON_MASK_LEFT = (1 << (MOUSE_BUTTON_LEFT - 1)), + MOUSE_BUTTON_MASK_RIGHT = (1 << (MOUSE_BUTTON_RIGHT - 1)), + MOUSE_BUTTON_MASK_MIDDLE = (1 << (MOUSE_BUTTON_MIDDLE - 1)), + MOUSE_BUTTON_MASK_XBUTTON1 = (1 << (MOUSE_BUTTON_XBUTTON1 - 1)), + MOUSE_BUTTON_MASK_XBUTTON2 = (1 << (MOUSE_BUTTON_XBUTTON2 - 1)) }; enum JoyButtonList { diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 7e9da0127599..cc6cd8a6621a 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2061,46 +2061,46 @@ Group Switch key mask. - + Left mouse button. - + Right mouse button. - + Middle mouse button. - + Extra mouse button 1 (only present on some mice). - + Extra mouse button 2 (only present on some mice). - + Mouse wheel up. - + Mouse wheel down. - + Mouse wheel left button (only present on some mice). - + Mouse wheel right button (only present on some mice). - + Left mouse button mask. - + Right mouse button mask. - + Middle mouse button mask. - + Extra mouse button 1 mask. - + Extra mouse button 2 mask. diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 45ef4cb14c62..f7e31f5f9ca3 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -49,7 +49,7 @@ Binary mask to choose which mouse buttons this button will respond to. - To allow both left-click and right-click, use [code]BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT[/code]. + To allow both left-click and right-click, use [code]MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_RIGHT[/code]. If [code]true[/code], the button is in disabled state and can't be clicked or toggled. diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index c5e820e9fe3d..b22878e56af2 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -50,7 +50,7 @@ [gdscript] func _gui_input(event): if event is InputEventMouseButton: - if event.button_index == BUTTON_LEFT and event.pressed: + if event.button_index == MOUSE_BUTTON_LEFT and event.pressed: print("I've been clicked D:") [/gdscript] [csharp] diff --git a/doc/classes/Sprite2D.xml b/doc/classes/Sprite2D.xml index 7a949d26e08d..617ad3a37147 100644 --- a/doc/classes/Sprite2D.xml +++ b/doc/classes/Sprite2D.xml @@ -18,7 +18,7 @@ [codeblocks] [gdscript] func _input(event): - if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT: + if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: if get_rect().has_point(to_local(event.position)): print("A click!") [/gdscript] diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 55640ca59051..9949fd819968 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -307,7 +307,7 @@ void InputEventConfigurationDialog::_update_input_list() { mouse_root->set_collapsed(collapse); mouse_root->set_meta("__type", INPUT_MOUSE_BUTTON); - int mouse_buttons[9] = { BUTTON_LEFT, BUTTON_RIGHT, BUTTON_MIDDLE, BUTTON_WHEEL_UP, BUTTON_WHEEL_DOWN, BUTTON_WHEEL_LEFT, BUTTON_WHEEL_RIGHT, BUTTON_XBUTTON1, BUTTON_XBUTTON2 }; + MouseButton mouse_buttons[9] = { MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_WHEEL_DOWN, MOUSE_BUTTON_WHEEL_LEFT, MOUSE_BUTTON_WHEEL_RIGHT, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_XBUTTON2 }; for (int i = 0; i < 9; i++) { Ref mb; mb.instance(); diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 5d2b825c4f11..92b468301897 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -615,7 +615,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { } Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); @@ -628,7 +628,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { update(); } - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); @@ -641,7 +641,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { update(); } - if (mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) { if (mb->is_pressed()) { int x = mb->get_position().x - timeline->get_name_limit(); panning_timeline_from = x / timeline->get_zoom_scale(); @@ -652,7 +652,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { } } - if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { menu_insert_key = mb->get_position(); if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) { Vector2 popup_pos = get_global_transform().xform(mb->get_position()); @@ -672,7 +672,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { } } - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (close_icon_rect.has_point(mb->get_position())) { emit_signal("close_request"); return; @@ -789,7 +789,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { } } - if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (box_selecting) { //do actual select if (!box_selecting_add) { @@ -819,7 +819,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { update(); } - if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { undo_redo->create_action(TTR("Move Bezier Points")); undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left); undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right); @@ -831,7 +831,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { update(); } - if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (moving_selection) { //combit it @@ -927,7 +927,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { } Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) { v_scroll += mm->get_relative().y * v_zoom; if (v_scroll > 100000) { v_scroll = 100000; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index de8f8b1d3bbe..4274fb993ff4 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1643,24 +1643,24 @@ void AnimationTimelineEdit::_play_position_draw() { void AnimationTimelineEdit::_gui_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) { dragging_hsize = true; dragging_hsize_from = mb->get_position().x; dragging_hsize_at = name_limit; } - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && dragging_hsize) { + if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && dragging_hsize) { dragging_hsize = false; } if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) { - if (!panning_timeline && mb->get_button_index() == BUTTON_LEFT) { + if (!panning_timeline && mb->get_button_index() == MOUSE_BUTTON_LEFT) { int x = mb->get_position().x - get_name_limit(); float ofs = x / get_zoom_scale() + get_value(); emit_signal("timeline_changed", ofs, false); dragging_timeline = true; } - if (!dragging_timeline && mb->get_button_index() == BUTTON_MIDDLE) { + if (!dragging_timeline && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) { int x = mb->get_position().x - get_name_limit(); panning_timeline_from = x / get_zoom_scale(); panning_timeline = true; @@ -1668,11 +1668,11 @@ void AnimationTimelineEdit::_gui_input(const Ref &p_event) { } } - if (dragging_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) { + if (dragging_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) { dragging_timeline = false; } - if (panning_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE && !mb->is_pressed()) { + if (panning_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE && !mb->is_pressed()) { panning_timeline = false; } @@ -2540,7 +2540,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Point2 pos = mb->get_position(); if (check_rect.has_point(pos)) { @@ -2683,7 +2683,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } } - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { Point2 pos = mb->get_position(); if (pos.x >= timeline->get_name_limit() && pos.x <= get_size().width - timeline->get_buttons_width()) { // Can do something with menu too! show insert key. @@ -2713,7 +2713,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } } - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && clicking_on_name) { + if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && clicking_on_name) { if (!path) { path_popup = memnew(Popup); path_popup->set_wrap_controls(true); @@ -2735,7 +2735,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } if (mb.is_valid() && moving_selection_attempt) { - if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { moving_selection_attempt = false; if (moving_selection) { emit_signal("move_selection_commit"); @@ -2746,7 +2746,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { select_single_attempt = -1; } - if (moving_selection && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + if (moving_selection && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { moving_selection_attempt = false; moving_selection = false; emit_signal("move_selection_cancel"); @@ -2754,7 +2754,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT && moving_selection_attempt) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && moving_selection_attempt) { if (!moving_selection) { moving_selection = true; emit_signal("move_selection_begin"); @@ -4955,17 +4955,17 @@ void AnimationTrackEditor::_box_selection_draw() { void AnimationTrackEditor::_scroll_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); scroll->accept_event(); } - if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); scroll->accept_event(); } - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { box_selecting = true; box_selecting_from = scroll->get_global_transform().xform(mb->get_position()); @@ -4993,12 +4993,12 @@ void AnimationTrackEditor::_scroll_input(const Ref &p_event) { Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) { timeline->set_value(timeline->get_value() - mm->get_relative().x / timeline->get_zoom_scale()); } if (mm.is_valid() && box_selecting) { - if (!(mm->get_button_mask() & BUTTON_MASK_LEFT)) { + if (!(mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) { //no longer box_selection->hide(); box_selecting = false; diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 0c0ee2856e81..fa27dfb3e52e 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -1076,7 +1076,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref &p_event) { } Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) { len_resizing = true; len_resizing_start = mb->get_shift(); len_resizing_from_px = mb->get_position().x; @@ -1086,7 +1086,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref &p_event) { return; } - if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale(); if (len_resizing_start) { float prev_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), len_resizing_index); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index f4717830bc7b..11be365f0acd 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -723,9 +723,9 @@ void CodeTextEditor::_text_editor_gui_input(const Ref &p_event) { if (mb.is_valid()) { if (mb->is_pressed() && mb->get_command()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { _zoom_in(); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { _zoom_out(); } } @@ -1548,7 +1548,7 @@ void CodeTextEditor::validate_script() { void CodeTextEditor::_warning_label_gui_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { _warning_button_pressed(); } } @@ -1572,7 +1572,7 @@ void CodeTextEditor::_toggle_scripts_pressed() { void CodeTextEditor::_error_pressed(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { goto_error(); } } diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 33d08a2f6bec..fc0104c07adf 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -249,7 +249,7 @@ TreeItem *EditorPerformanceProfiler::_create_monitor_item(const StringName &p_mo void EditorPerformanceProfiler::_marker_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector active; for (OrderedHashMap::Element i = monitors.front(); i; i = i.next()) { if (i.value().item->is_checked(0)) { diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 9304b116d069..c4290b7cca02 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -482,7 +482,7 @@ void EditorProfiler::_graph_tex_input(const Ref &p_ev) { Ref mm = p_ev; if ( - (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) || + (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) || (mm.is_valid())) { int x = me->get_position().x; x = x * frame_metrics.size() / graph->get_size().width; @@ -510,7 +510,7 @@ void EditorProfiler::_graph_tex_input(const Ref &p_ev) { hover_metric = -1; } - if (mb.is_valid() || mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { //cursor_metric=x; updating_frame = true; diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index d825a980c79e..5bb10b3794fb 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -517,7 +517,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref &p_ev) { Ref mm = p_ev; if ( - (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) || + (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) || (mm.is_valid())) { int half_w = graph->get_size().width / 2; int x = me->get_position().x; @@ -549,7 +549,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref &p_ev) { hover_metric = -1; } - if (mb.is_valid() || mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { //cursor_metric=x; updating_frame = true; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 9a826ab10669..3a5ebe8e8517 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -532,7 +532,7 @@ void EditorAudioBus::_effect_add(int p_which) { void EditorAudioBus::_gui_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); bus_popup->set_position(get_global_position() + pos); bus_popup->popup(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 9b03731fd858..70d1a514b5c0 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -693,7 +693,7 @@ void EditorProperty::_gui_input(const Ref &p_event) { if (is_layout_rtl()) { mpos.x = get_size().x - mpos.x; } - bool button_left = me->get_button_mask() & BUTTON_MASK_LEFT; + bool button_left = me->get_button_mask() & MOUSE_BUTTON_MASK_LEFT; bool new_keying_hover = keying_rect.has_point(mpos) && !button_left; if (new_keying_hover != keying_hover) { @@ -722,7 +722,7 @@ void EditorProperty::_gui_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 mpos = mb->get_position(); if (is_layout_rtl()) { mpos.x = get_size().x - mpos.x; @@ -1359,7 +1359,7 @@ void EditorInspectorSection::_gui_input(const Ref &p_event) { } Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Ref font = get_theme_font("font", "Tree"); int font_size = get_theme_font_size("font_size", "Tree"); if (mb->get_position().y > font->get_height(font_size)) { //clicked outside diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2e402d013beb..756f1d208fd5 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4836,15 +4836,15 @@ void EditorNode::_scene_tab_input(const Ref &p_input) { if (mb.is_valid()) { if (scene_tabs->get_hovered_tab() >= 0) { - if (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed()) { _scene_tab_closed(scene_tabs->get_hovered_tab()); } } else { - if ((mb->get_button_index() == BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed())) { + if ((mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed())) { _menu_option_confirm(FILE_NEW_SCENE, true); } } - if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { // context menu scene_tabs_context_menu->clear(); scene_tabs_context_menu->set_size(Size2(1, 1)); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 2d7235038a4d..d09e3726fb80 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -621,7 +621,7 @@ class EditorPropertyLayersGrid : public Control { const Ref mb = p_ev; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index >= 0) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed() && hovered_index >= 0) { // Toggle the flag. // We base our choice on the hovered flag, so that it always matches the hovered flag. if (value & (1 << hovered_index)) { @@ -927,11 +927,11 @@ EditorPropertyFloat::EditorPropertyFloat() { void EditorPropertyEasing::_drag_easing(const Ref &p_ev) { const Ref mb = p_ev; if (mb.is_valid()) { - if (mb->is_doubleclick() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_doubleclick() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { _setup_spin(); } - if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position())); preset->popup(); @@ -940,7 +940,7 @@ void EditorPropertyEasing::_drag_easing(const Ref &p_ev) { easing_draw->update(); } - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { dragging = mb->is_pressed(); // Update to display the correct dragging color easing_draw->update(); @@ -949,7 +949,7 @@ void EditorPropertyEasing::_drag_easing(const Ref &p_ev) { const Ref mm = p_ev; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { float rel = mm->get_relative().x; if (rel == 0) { return; @@ -2814,7 +2814,7 @@ void EditorPropertyResource::_sub_inspector_object_id_selected(int p_id) { void EditorPropertyResource::_button_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { _update_menu_items(); Vector2 pos = get_screen_position() + mb->get_position(); //pos = assign->get_global_transform().xform(pos); diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index bbabc08ea42d..c09d78826cab 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -53,7 +53,7 @@ void EditorSpinSlider::_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { if (updown_offset != -1 && mb->get_position().x > updown_offset) { //there is an updown, so use it. @@ -84,7 +84,7 @@ void EditorSpinSlider::_gui_input(const Ref &p_event) { grabbing_spinner_attempt = false; } } - } else if (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP || mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { if (grabber->is_visible()) { call_deferred("update"); } @@ -146,17 +146,17 @@ void EditorSpinSlider::_grabber_gui_input(const Ref &p_event) { if (grabbing_grabber) { if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { set_value(get_value() + get_step()); mousewheel_over_grabber = true; - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { set_value(get_value() - get_step()); mousewheel_over_grabber = true; } } } - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { grabbing_grabber = true; if (!mousewheel_over_grabber) { diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 5ae67f413a78..48340ac24249 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -668,21 +668,21 @@ void SceneImportSettings::_viewport_input(const Ref &p_input) { zoom = &md.cam_zoom; } Ref mm = p_input; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { (*rot_x) -= mm->get_relative().y * 0.01 * EDSCALE; (*rot_y) -= mm->get_relative().x * 0.01 * EDSCALE; (*rot_x) = CLAMP((*rot_x), -Math_PI / 2, Math_PI / 2); _update_camera(); } Ref mb = p_input; - if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { (*zoom) *= 1.1; if ((*zoom) > 10.0) { (*zoom) = 10.0; } _update_camera(); } - if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { (*zoom) /= 1.1; if ((*zoom) < 0.1) { (*zoom) = 0.1; diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index c90f87de56cf..80d0a7db60cc 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -264,7 +264,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position()))); if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { if (mb->get_control() || mb->get_shift() || mb->get_alt()) { return false; @@ -326,7 +326,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) return true; } } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && !edited_point.valid()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && !edited_point.valid()) { const PosVertex closest = closest_point(gpoint); if (closest.valid()) { @@ -335,7 +335,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) } } } else if (mode == MODE_DELETE) { - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { const PosVertex closest = closest_point(gpoint); if (closest.valid()) { @@ -346,7 +346,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) } if (mode == MODE_CREATE) { - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { if (_is_line()) { // for lines, we don't have a wip mode, and we can undo each single add point. Vector vertices = _get_polygon(0); @@ -384,7 +384,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) return true; } } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) { _wip_cancel(); } } @@ -395,7 +395,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) if (mm.is_valid()) { Vector2 gpoint = mm->get_position(); - if (edited_point.valid() && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) { + if (edited_point.valid() && (wip_active || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT))) { Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint))); //Move the point in a single axis. Should only work when editing a polygon and while holding shift. diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index d69913cc4692..025fcaf81890 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -51,7 +51,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) { + if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) { menu->clear(); animations_menu->clear(); animations_to_add.clear(); @@ -110,7 +110,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refis_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { blend_space_draw->update(); // why not // try to see if a point can be selected @@ -132,7 +132,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refis_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (dragging_selected) { // move float point = blend_space->get_blend_point_position(selected_point); @@ -161,7 +161,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refis_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { float blend_pos = mb->get_position().x / blend_space_draw->get_size().x; blend_pos *= blend_space->get_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); @@ -184,7 +184,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refis_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { float blend_pos = mm->get_position().x / blend_space_draw->get_size().x; blend_pos *= blend_space->get_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 6a57463dbcb8..af9c39117430 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -79,7 +79,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) { + if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) { menu->clear(); animations_menu->clear(); animations_to_add.clear(); @@ -134,7 +134,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refis_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { blend_space_draw->update(); //update anyway //try to see if a point can be selected selected_point = -1; @@ -174,7 +174,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refis_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { blend_space_draw->update(); //update anyway //try to see if a point can be selected selected_point = -1; @@ -209,7 +209,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refis_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (dragging_selected) { //move Vector2 point = blend_space->get_blend_point_position(selected_point); @@ -236,7 +236,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refupdate(); } - if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 blend_pos = (mb->get_position() / blend_space_draw->get_size()); blend_pos.y = 1.0 - blend_pos.y; blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space()); @@ -270,7 +270,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refupdate(); } - if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { Vector2 blend_pos = (mm->get_position() / blend_space_draw->get_size()); blend_pos.y = 1.0 - blend_pos.y; blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space()); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index c6d2faf849ba..a9709bbb16fd 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -76,7 +76,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref mb = p_event; //Add new node - if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == BUTTON_LEFT))) { + if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT))) { menu->clear(); animations_menu->clear(); animations_to_add.clear(); @@ -124,7 +124,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Refget_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->get_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { selected_transition_from = StringName(); selected_transition_to = StringName(); selected_node = StringName(); @@ -216,7 +216,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Refget_button_index() == BUTTON_LEFT && !mb->is_pressed()) { + if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) { if (dragging_selected) { Ref an = state_machine->get_node(selected_node); updating = true; @@ -237,7 +237,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Refis_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb.is_valid() && ((tool_select->is_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected connecting = true; @@ -250,7 +250,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Refget_button_index() == BUTTON_LEFT && !mb->is_pressed()) { + if (mb.is_valid() && connecting && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) { if (connecting_to_node != StringName()) { if (state_machine->has_transition(connecting_from, connecting_to_node)) { EditorNode::get_singleton()->show_warning(TTR("Transition exists!")); @@ -284,7 +284,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref mm = p_event; //pan window - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) { h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 23467c8377fc..d4e06aa9caf9 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1095,7 +1095,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref &p_eve } // Start dragging a guide - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { // Press button if (b->get_position().x < RULER_WIDTH && b->get_position().y < RULER_WIDTH) { // Drag a new double guide @@ -1154,7 +1154,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref &p_eve } // Release confirms the guide move - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) { if (show_guides && EditorNode::get_singleton()->get_edited_scene()) { Transform2D xform = viewport_scrollable->get_transform() * transform; @@ -1268,7 +1268,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo if (pan_on_scroll) { // Perform horizontal scrolling first so we can check for Shift being held. if (b->is_pressed() && - (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_UP))) { + (b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP))) { // Pan left view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); update_viewport(); @@ -1276,7 +1276,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo } if (b->is_pressed() && - (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_DOWN))) { + (b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN))) { // Pan right view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); update_viewport(); @@ -1284,7 +1284,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo } } - if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) { + if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { // Scroll or pan down if (pan_on_scroll) { view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); @@ -1299,7 +1299,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo return true; } - if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_UP) { + if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { // Scroll or pan up if (pan_on_scroll) { view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); @@ -1316,17 +1316,17 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo if (!panning) { if (b->is_pressed() && - (b->get_button_index() == BUTTON_MIDDLE || - b->get_button_index() == BUTTON_RIGHT || - (b->get_button_index() == BUTTON_LEFT && tool == TOOL_PAN) || - (b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) { + (b->get_button_index() == MOUSE_BUTTON_MIDDLE || + b->get_button_index() == MOUSE_BUTTON_RIGHT || + (b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_PAN) || + (b->get_button_index() == MOUSE_BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) { // Pan the viewport panning = true; } } if (panning) { - if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != BUTTON_WHEEL_DOWN && b->get_button_index() != BUTTON_WHEEL_UP))) { + if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != MOUSE_BUTTON_WHEEL_DOWN && b->get_button_index() != MOUSE_BUTTON_WHEEL_UP))) { // Stop panning the viewport (for any mouse button press except zooming) panning = false; } @@ -1412,7 +1412,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref &p_event) { // Drag the pivot (in pivot mode / with V key) if (drag_type == DRAG_NONE) { - if ((b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) || + if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) || (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_V)) { List selection = _get_edited_canvas_items(); @@ -1466,7 +1466,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref &p_event) { // Confirm the pivot move if (drag_selection.size() >= 1 && - ((b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) || + ((b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) || (k.is_valid() && !k->is_pressed() && k->get_keycode() == KEY_V))) { _commit_canvas_item_state( drag_selection, @@ -1480,7 +1480,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection); drag_type = DRAG_NONE; viewport->update(); @@ -1566,7 +1566,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref &p_event) { // Start rotation if (drag_type == DRAG_NONE) { - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { List selection = _get_edited_canvas_items(); @@ -1610,7 +1610,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref &p_event) { } // Confirms the node rotation - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) { if (drag_selection.size() != 1) { _commit_canvas_item_state( drag_selection, @@ -1634,7 +1634,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection); drag_type = DRAG_NONE; viewport->update(); @@ -1648,7 +1648,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref b = p_event; // Open a sub-scene on double-click - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && b->is_doubleclick() && tool == TOOL_SELECT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && b->is_doubleclick() && tool == TOOL_SELECT) { List selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; @@ -1667,7 +1667,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref &p_event) { // Starts anchor dragging if needed if (drag_type == DRAG_NONE) { - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { List selection = _get_edited_canvas_items(); if (selection.size() == 1) { Control *control = Object::cast_to(selection[0]); @@ -1787,7 +1787,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref &p_event) { } // Confirms new anchor position - if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) { + if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) { _commit_canvas_item_state( drag_selection, vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection[0]->get_name())); @@ -1796,7 +1796,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection); drag_type = DRAG_NONE; viewport->update(); @@ -1812,7 +1812,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref &p_event) { // Drag resize handles if (drag_type == DRAG_NONE) { - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { List selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; @@ -1966,7 +1966,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref &p_event) { } // Confirm resize - if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) { + if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) { const Node2D *node2d = Object::cast_to(drag_selection[0]); if (node2d) { // Extends from Node2D. @@ -2003,7 +2003,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection); snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; @@ -2021,7 +2021,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { // Drag resize handles if (drag_type == DRAG_NONE) { - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) { List selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; @@ -2117,7 +2117,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { } // Confirm resize - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) { if (drag_selection.size() != 1) { _commit_canvas_item_state( drag_selection, @@ -2142,7 +2142,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection); drag_type = DRAG_NONE; viewport->update(); @@ -2159,7 +2159,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { if (drag_type == DRAG_NONE) { //Start moving the nodes - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) { List selection = _get_edited_canvas_items(); @@ -2262,7 +2262,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { } // Confirm the move (only if it was moved) - if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) { + if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) { if (transform.affine_inverse().xform(b->get_position()) != drag_from) { if (drag_selection.size() != 1) { _commit_canvas_item_state( @@ -2295,7 +2295,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { } // Cancel a drag - if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { _restore_canvas_item_state(drag_selection, true); snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; @@ -2435,8 +2435,8 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { if (drag_type == DRAG_NONE) { if (b.is_valid() && - ((b->get_button_index() == BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) || - (b->get_button_index() == BUTTON_LEFT && tool == TOOL_LIST_SELECT))) { + ((b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) || + (b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_LIST_SELECT))) { // Popup the selection menu list Point2 click = transform.affine_inverse().xform(b->get_position()); @@ -2497,7 +2497,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { } } - if (b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && b->get_control()) { + if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_control()) { add_node_menu->set_position(get_global_transform().xform(get_local_mouse_position())); add_node_menu->set_size(Vector2(1, 1)); add_node_menu->popup(); @@ -2505,7 +2505,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { return true; } - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) { // Single item selection Point2 click = transform.affine_inverse().xform(b->get_position()); @@ -2571,7 +2571,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { } if (drag_type == DRAG_BOX_SELECTION) { - if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) { + if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) { // Confirms box selection Node *scene = editor->get_edited_scene(); if (scene) { @@ -2597,7 +2597,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { return true; } - if (b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_RIGHT) { + if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT) { // Cancel box selection drag_type = DRAG_NONE; viewport->update(); @@ -2634,7 +2634,7 @@ bool CanvasItemEditor::_gui_input_ruler_tool(const Ref &p_event) { ruler_tool_origin = snap_point(viewport->get_local_mouse_position() / zoom + view_offset); } - if (b.is_valid() && b->get_button_index() == BUTTON_LEFT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT) { if (b->is_pressed()) { ruler_tool_active = true; } else { diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index 0c1897525865..b50a497ccfb1 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -142,7 +142,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con switch (mode) { case MODE_CREATE: { - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { if (!wip_active) { wip.clear(); wip.push_back(cpoint); @@ -166,14 +166,14 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con return true; } } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) { _wip_close(); } } break; case MODE_EDIT: { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { if (mb->get_control()) { if (poly.size() < 3) { @@ -267,7 +267,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con } } } - if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { int closest_idx = -1; Vector2 closest_pos; real_t closest_dist = 1e10; @@ -301,7 +301,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con Ref mm = p_event; if (mm.is_valid()) { - if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) { + if (edited_point != -1 && (wip_active || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) { Vector2 gpoint = mm->get_position(); Vector3 ray_from = p_camera->project_ray_origin(gpoint); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 141ee35cdbcb..c38458c37f3f 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -325,7 +325,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref &p_e if (mb.is_valid()) { Vector2 gpoint = mb->get_position(); - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { for (int i = 0; i < handles.size(); i++) { if (xform.xform(handles[i]).distance_to(gpoint) < 8) { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index bff5cb8d2a09..db999f50abf7 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -115,22 +115,22 @@ void CurveEditor::on_gui_input(const Ref &p_event) { } switch (mb.get_button_index()) { - case BUTTON_RIGHT: + case MOUSE_BUTTON_RIGHT: _context_click_pos = mpos; open_context_menu(get_global_transform().xform(mpos)); break; - case BUTTON_MIDDLE: + case MOUSE_BUTTON_MIDDLE: remove_point(_hover_point); break; - case BUTTON_LEFT: + case MOUSE_BUTTON_LEFT: _dragging = true; break; } } - if (!mb.is_pressed() && _dragging && mb.get_button_index() == BUTTON_LEFT) { + if (!mb.is_pressed() && _dragging && mb.get_button_index() == MOUSE_BUTTON_LEFT) { _dragging = false; if (_has_undo_data) { UndoRedo &ur = *EditorNode::get_singleton()->get_undo_redo(); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 1e4553a9673a..77719104b136 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -34,7 +34,7 @@ void MeshEditor::_gui_input(Ref p_event) { Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { rot_x -= mm->get_relative().y * 0.01; rot_y -= mm->get_relative().x * 0.01; if (rot_x < -Math_PI / 2) { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 449968eb7b25..fccc042a0253 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -186,7 +186,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector &r_axis) { void ViewportRotationControl::_gui_input(Ref p_event) { const Ref mb = p_event; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 pos = mb->get_position(); if (mb->is_pressed()) { if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) { @@ -1123,23 +1123,21 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { float zoom_factor = 1 + (ZOOM_FREELOOK_MULTIPLIER - 1) * b->get_factor(); switch (b->get_button_index()) { - case BUTTON_WHEEL_UP: { + case MOUSE_BUTTON_WHEEL_UP: { if (is_freelook_active()) { scale_freelook_speed(zoom_factor); } else { scale_cursor_distance(1.0 / zoom_factor); } } break; - - case BUTTON_WHEEL_DOWN: { + case MOUSE_BUTTON_WHEEL_DOWN: { if (is_freelook_active()) { scale_freelook_speed(1.0 / zoom_factor); } else { scale_cursor_distance(zoom_factor); } } break; - - case BUTTON_RIGHT: { + case MOUSE_BUTTON_RIGHT: { NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); if (b->is_pressed() && _edit.gizmo.is_valid()) { @@ -1200,7 +1198,7 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { } } break; - case BUTTON_MIDDLE: { + case MOUSE_BUTTON_MIDDLE: { if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) { switch (_edit.plane) { case TRANSFORM_VIEW: { @@ -1231,7 +1229,7 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { } } } break; - case BUTTON_LEFT: { + case MOUSE_BUTTON_LEFT: { if (b->is_pressed()) { NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) { @@ -1440,7 +1438,7 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle); set_message(n + ": " + String(v)); - } else if (m->get_button_mask() & BUTTON_MASK_LEFT) { + } else if (m->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) { nav_mode = NAVIGATION_ORBIT; } else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) { @@ -1830,8 +1828,7 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { } } } - - } else if ((m->get_button_mask() & BUTTON_MASK_RIGHT) || freelook_active) { + } else if ((m->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) || freelook_active) { if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) { nav_mode = NAVIGATION_ZOOM; } else if (freelook_active) { @@ -1840,7 +1837,7 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (m->get_button_mask() & BUTTON_MASK_MIDDLE) { + } else if (m->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) { const int mod = _get_key_modifier(m); if (nav_scheme == NAVIGATION_GODOT) { if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) { @@ -1851,13 +1848,11 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { // Always allow Alt as a modifier to better support graphic tablets. nav_mode = NAVIGATION_ORBIT; } - } else if (nav_scheme == NAVIGATION_MAYA) { if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) { nav_mode = NAVIGATION_PAN; } } - } else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case const int mod = _get_key_modifier(m); @@ -4199,7 +4194,7 @@ Node3DEditorViewport::~Node3DEditorViewport() { void Node3DEditorViewportContainer::_gui_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { Vector2 size = get_size(); @@ -6611,7 +6606,7 @@ void Node3DEditor::_update_preview_environment() { void Node3DEditor::_sun_direction_input(const Ref &p_event) { Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { float x = -mm->get_relative().y * 0.02 * EDSCALE; float y = mm->get_relative().x * 0.02 * EDSCALE; diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 908235f89f31..84b4516452c0 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -88,7 +88,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_in(i))); // Check for point movement start (for point + in/out controls). - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mode == MODE_EDIT && !mb->get_shift() && dist_to_p < grab_threshold) { // Points can only be moved in edit mode. @@ -118,7 +118,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { } // Check for point deletion. - if ((mb->get_button_index() == BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == BUTTON_LEFT && mode == MODE_DELETE)) { + if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_DELETE)) { if (dist_to_p < grab_threshold) { undo_redo->create_action(TTR("Remove Point from Curve")); undo_redo->add_do_method(curve.ptr(), "remove_point", i); @@ -149,7 +149,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { } // Check for point creation. - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) { Ref curve = node->get_curve(); undo_redo->create_action(TTR("Add Point to Curve")); @@ -170,7 +170,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { } // Check for segment split. - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_EDIT && on_edge) { Vector2 gpoint2 = mb->get_position(); Ref curve = node->get_curve(); @@ -207,7 +207,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { } // Check for point movement completion. - if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && action != ACTION_NONE) { + if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && action != ACTION_NONE) { Ref curve = node->get_curve(); Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 3783af8fc6f2..47bd1114d2e6 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -316,7 +316,7 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref set_handle_clicked(false); } - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { //click into curve, break it down Vector v3a = c->tessellate(); int idx = 0; @@ -411,7 +411,7 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref //add new at pos } - } else if (mb->is_pressed() && ((mb->get_button_index() == BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == BUTTON_RIGHT && curve_edit->is_pressed()))) { + } else if (mb->is_pressed() && ((mb->get_button_index() == MOUSE_BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == MOUSE_BUTTON_RIGHT && curve_edit->is_pressed()))) { for (int i = 0; i < c->get_point_count(); i++) { real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_position(i))).distance_to(mbpos); real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_out(i))).distance_to(mbpos); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 3d7b01c149cb..470d897dccb9 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -447,7 +447,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { Ref mb = p_input; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { uv_drag_from = snap_point(Vector2(mb->get_position().x, mb->get_position().y)); uv_drag = true; @@ -759,7 +759,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { bone_painting = false; } } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { _cancel_editing(); if (bone_painting) { @@ -768,9 +768,9 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { uv_edit_draw->update(); - } else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) { uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb->get_factor()))); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) { uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb->get_factor()))); } } @@ -778,7 +778,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { Ref mm = p_input; if (mm.is_valid()) { - if ((mm->get_button_mask() & BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { + if ((mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { Vector2 drag(mm->get_relative().x, mm->get_relative().y); uv_hscroll->set_value(uv_hscroll->get_value() - drag.x); uv_vscroll->set_value(uv_vscroll->get_value() - drag.y); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 8bf5d0611d72..b29847440686 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2737,7 +2737,7 @@ void ScriptEditor::_script_list_gui_input(const Ref &ev) { Ref mb = ev; if (mb.is_valid() && mb->is_pressed()) { switch (mb->get_button_index()) { - case BUTTON_MIDDLE: { + case MOUSE_BUTTON_MIDDLE: { // Right-click selects automatically; middle-click does not. int idx = script_list->get_item_at_position(mb->get_position(), true); if (idx >= 0) { @@ -2747,7 +2747,7 @@ void ScriptEditor::_script_list_gui_input(const Ref &ev) { } } break; - case BUTTON_RIGHT: { + case MOUSE_BUTTON_RIGHT: { _make_script_list_context_menu(); } break; } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index b6df66b8afcc..ec931caac355 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1517,7 +1517,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref &ev) { bool create_menu = false; CodeEdit *tx = code_editor->get_text_editor(); - if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { local_pos = mb->get_global_position() - tx->get_global_position(); create_menu = true; } else if (k.is_valid() && k->get_keycode() == KEY_MENU) { diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index c8a46715ad27..8f8a4b3054fe 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -460,7 +460,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref &ev) { Ref mb = ev; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { int col, row; CodeEdit *tx = shader_editor->get_text_editor(); tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index a6949c873e9e..bd6dac74904c 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -105,7 +105,7 @@ void SpriteFramesEditor::_sheet_preview_draw() { void SpriteFramesEditor::_sheet_preview_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Size2i size = split_sheet_preview->get_size(); int h = split_sheet_h->get_value(); int v = split_sheet_v->get_value(); @@ -150,11 +150,11 @@ void SpriteFramesEditor::_sheet_scroll_input(const Ref &p_event) { // Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer // to allow performing this action anywhere, even if the cursor isn't // hovering the texture in the workspace. - if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { _sheet_zoom_in(); // Don't scroll up after zooming in. accept_event(); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { _sheet_zoom_out(); // Don't scroll down after zooming out. accept_event(); @@ -694,11 +694,11 @@ void SpriteFramesEditor::_tree_input(const Ref &p_event) { const Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { _zoom_in(); // Don't scroll up after zooming in. accept_event(); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { _zoom_out(); // Don't scroll down after zooming out. accept_event(); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index b88f1c91e638..2b8bfe067d42 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -469,7 +469,7 @@ void TextEditor::_text_edit_gui_input(const Ref &ev) { Ref mb = ev; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_RIGHT) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { int col, row; CodeEdit *tx = code_editor->get_text_editor(); tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col); diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 254ad3d56e20..265d4ccc1e6d 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -36,7 +36,7 @@ void TextureLayeredEditor::_gui_input(Ref p_event) { Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { y_rot += -mm->get_relative().x * 0.01; x_rot += mm->get_relative().y * 0.01; _update_material(); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 4cbfe185940c..7b927ad98b5e 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -285,7 +285,7 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { Ref mb = p_input; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { if (node_ninepatch || obj_styleBox.is_valid()) { edited_margin = -1; @@ -447,7 +447,7 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { creating = false; } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { if (drag) { drag = false; if (edited_margin >= 0) { @@ -466,9 +466,9 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { drag_index = -1; } } - } else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) { _zoom_on_position(draw_zoom * ((0.95 + (0.05 * mb->get_factor())) / 0.95), mb->get_position()); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) { _zoom_on_position(draw_zoom * (1 - (0.05 * mb->get_factor())), mb->get_position()); } } @@ -476,7 +476,7 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { Ref mm = p_input; if (mm.is_valid()) { - if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { + if (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom); hscroll->set_value(hscroll->get_value() - dragged.x); vscroll->set_value(vscroll->get_value() - dragged.y); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 59730a4fd344..bd721244ea83 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -233,11 +233,11 @@ void TileMapEditor::_palette_input(const Ref &p_event) { // Zoom in/out using Ctrl + mouse wheel. if (mb.is_valid() && mb->is_pressed() && mb->get_command()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { size_slider->set_value(size_slider->get_value() + 0.2); } - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { size_slider->set_value(size_slider->get_value() - 0.2); } } @@ -1027,7 +1027,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { if (Input::get_singleton()->is_key_pressed(KEY_SPACE)) { return false; // Drag. @@ -1177,7 +1177,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { return true; } } - } else if (mb->get_button_index() == BUTTON_RIGHT) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { if (mb->is_pressed()) { if (tool == TOOL_SELECTING || selection_active) { tool = TOOL_NONE; @@ -1462,7 +1462,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { return true; } - if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { + if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) { _pick_tile(over_tile); return true; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index b97ee107433d..cca4f594e96b 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1246,12 +1246,12 @@ void TileSetEditor::_on_scroll_container_input(const Ref &p_event) { // Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer // to allow performing this action anywhere, even if the cursor isn't // hovering the texture in the workspace. - if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { print_line("zooming in"); _zoom_in(); // Don't scroll up after zooming in. accept_event(); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { print_line("zooming out"); _zoom_out(); // Don't scroll down after zooming out. @@ -1280,7 +1280,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { const Ref mm = p_ie; if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && !creating_shape) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !creating_shape) { if (!current_tile_region.has_point(mb->get_position())) { List *tiles = new List(); tileset->get_tile_list(tiles); @@ -1304,7 +1304,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { } // Drag Middle Mouse if (mm.is_valid()) { - if (mm->get_button_mask() & BUTTON_MASK_MIDDLE) { + if (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) { Vector2 dragged(mm->get_relative().x, mm->get_relative().y); scroll->set_h_scroll(scroll->get_h_scroll() - dragged.x * workspace->get_scale().x); scroll->set_v_scroll(scroll->get_v_scroll() - dragged.y * workspace->get_scale().x); @@ -1313,7 +1313,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { if (edit_mode == EDITMODE_REGION) { if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (get_current_tile() >= 0 || workspace_mode != WORKSPACE_EDIT) { dragging = true; region_from = mb->get_position(); @@ -1322,13 +1322,13 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { workspace_overlay->update(); return; } - } else if (dragging && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + } else if (dragging && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { dragging = false; edited_region = Rect2(); workspace->update(); workspace_overlay->update(); return; - } else if (dragging && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + } else if (dragging && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { dragging = false; update_edited_region(mb->get_position()); edited_region.position -= WORKSPACE_MARGIN; @@ -1428,7 +1428,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { switch (edit_mode) { case EDITMODE_ICON: { if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && current_tile_region.has_point(mb->get_position())) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && current_tile_region.has_point(mb->get_position())) { Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y))); undo_redo->create_action(TTR("Set Tile Icon")); undo_redo->add_do_method(tileset.ptr(), "autotile_set_icon_coordinate", get_current_tile(), coord); @@ -1445,9 +1445,9 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { if (dragging) { return; } - if ((mb->get_button_index() == BUTTON_RIGHT || mb->get_button_index() == BUTTON_LEFT) && current_tile_region.has_point(mb->get_position())) { + if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT || mb->get_button_index() == MOUSE_BUTTON_LEFT) && current_tile_region.has_point(mb->get_position())) { dragging = true; - erasing = (mb->get_button_index() == BUTTON_RIGHT); + erasing = (mb->get_button_index() == MOUSE_BUTTON_RIGHT); alternative = Input::get_singleton()->is_key_pressed(KEY_SHIFT); Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y))); Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y)); @@ -1518,7 +1518,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { } } } else { - if ((erasing && mb->get_button_index() == BUTTON_RIGHT) || (!erasing && mb->get_button_index() == BUTTON_LEFT)) { + if ((erasing && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (!erasing && mb->get_button_index() == MOUSE_BUTTON_LEFT)) { dragging = false; erasing = false; alternative = false; @@ -1612,7 +1612,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { shape_anchor += current_tile_region.position; if (tools[TOOL_SELECT]->is_pressed()) { if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (edit_mode != EDITMODE_PRIORITY && current_shape.size() > 0) { int grabbed_point = get_grabbed_point(mb->get_position(), grab_threshold); @@ -1630,7 +1630,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { } } workspace->update(); - } else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + } else if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (edit_mode == EDITMODE_COLLISION) { if (dragging_point >= 0) { dragging_point = -1; @@ -1705,7 +1705,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { } } else if (tools[SHAPE_NEW_POLYGON]->is_pressed()) { if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 pos = mb->get_position(); pos = snap_point(pos); if (creating_shape) { @@ -1725,7 +1725,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { current_shape.push_back(snap_point(pos)); workspace->update(); } - } else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + } else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { if (creating_shape) { creating_shape = false; _select_edited_shape_coord(); @@ -1739,7 +1739,7 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { } } else if (tools[SHAPE_NEW_RECTANGLE]->is_pressed()) { if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { _set_edited_collision_shape(Ref()); current_shape.resize(0); Vector2 pos = mb->get_position(); @@ -1751,13 +1751,13 @@ void TileSetEditor::_on_workspace_input(const Ref &p_ie) { creating_shape = true; workspace->update(); return; - } else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + } else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { if (creating_shape) { creating_shape = false; _select_edited_shape_coord(); workspace->update(); } - } else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + } else if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (creating_shape) { // if the first two corners are within grabbing distance of one another, expand the rect to fill the tile if (is_within_grabbing_distance_of_first_point(current_shape[1], grab_threshold)) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index a63e641c2bc5..69bdc05b3a5a 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2504,7 +2504,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref &p_event) { Ref mb = p_event; VisualShader::Type type = get_current_shader_type(); - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { selected_constants.clear(); selected_uniforms.clear(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index f4aa628b65e1..914806039fbb 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1741,7 +1741,7 @@ void ProjectList::_panel_input(const Ref &p_ev, Node *p_hb) { int clicked_index = p_hb->get_index(); const Item &clicked_project = _projects[clicked_index]; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->get_shift() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) { int anchor_index = -1; for (int i = 0; i < _projects.size(); ++i) { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 8ce715335541..0a4f432e4af4 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -1353,7 +1353,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { void CustomPropertyEditor::_drag_easing(const Ref &p_ev) { Ref mm = p_ev; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { float rel = mm->get_relative().x; if (rel == 0) { return; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6547e3048d0b..023019b2aa27 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -63,7 +63,7 @@ void SceneTreeDock::_quick_open() { void SceneTreeDock::_input(Ref p_event) { Ref mb = p_event; - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { restore_script_editor_on_drag = false; //lost chance } } diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 3472f295055d..74ae45a46ee2 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -615,13 +615,13 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP && (mb->get_command() || mb->get_shift())) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && (mb->get_command() || mb->get_shift())) { if (mb->is_pressed()) { floor->set_value(floor->get_value() + mb->get_factor()); } return true; // Eaten. - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && (mb->get_command() || mb->get_shift())) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && (mb->get_command() || mb->get_shift())) { if (mb->is_pressed()) { floor->set_value(floor->get_value() - mb->get_factor()); } @@ -632,7 +632,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Refget("editors/3d/navigation/navigation_scheme").operator int(); if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) { input_action = INPUT_NONE; - } else if (mb->get_button_index() == BUTTON_LEFT) { + } else if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { bool can_edit = (node && node->get_mesh_library().is_valid()); if (input_action == INPUT_PASTE) { _do_paste(); @@ -647,7 +647,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Refget_button_index() == BUTTON_RIGHT) { + } else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { if (input_action == INPUT_PASTE) { _clear_clipboard_data(); input_action = INPUT_NONE; @@ -666,7 +666,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Refget_position().x, mb->get_position().y), true); } else { - if ((mb->get_button_index() == BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_PAINT)) { + if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) { if (set_items.size()) { undo_redo->create_action(TTR("GridMap Paint")); for (List::Element *E = set_items.front(); E; E = E->next()) { @@ -685,19 +685,19 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref 0; } - if (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_SELECT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_SELECT) { undo_redo->create_action("GridMap Selection"); undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end); undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end); undo_redo->commit_action(); } - if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action != INPUT_NONE) { set_items.clear(); input_action = INPUT_NONE; return true; } - if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) { input_action = INPUT_NONE; return true; } @@ -811,11 +811,11 @@ void GridMapEditor::_mesh_library_palette_input(const Ref &p_ie) { // Zoom in/out using Ctrl + mouse wheel if (mb.is_valid() && mb->is_pressed() && mb->get_command()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { size_slider->set_value(size_slider->get_value() + 0.2); } - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { size_slider->set_value(size_slider->get_value() - 0.2); } } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 3b2cd505444b..d520837d43b9 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1837,7 +1837,7 @@ void VisualScriptEditor::_input(const Ref &p_event) { void VisualScriptEditor::_graph_gui_input(const Ref &p_event) { Ref key = p_event; - if (key.is_valid() && key->is_pressed() && key->get_button_mask() == BUTTON_RIGHT) { + if (key.is_valid() && key->is_pressed() && key->get_button_mask() == MOUSE_BUTTON_RIGHT) { saved_position = graph->get_local_mouse_position(); Point2 gpos = Input::get_singleton()->get_mouse_position(); diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 5f7e5eaa832c..ab28afe95063 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -741,15 +741,15 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio ev->set_pressed(true); buttons_state = event_buttons_mask; if (event_vertical_factor > 0) { - _wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_UP, event_vertical_factor); + _wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_UP, event_vertical_factor); } else if (event_vertical_factor < 0) { - _wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_DOWN, -event_vertical_factor); + _wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_DOWN, -event_vertical_factor); } if (event_horizontal_factor > 0) { - _wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_RIGHT, event_horizontal_factor); + _wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_RIGHT, event_horizontal_factor); } else if (event_horizontal_factor < 0) { - _wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_LEFT, -event_horizontal_factor); + _wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_LEFT, -event_horizontal_factor); } } break; } @@ -784,16 +784,16 @@ void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Poi int DisplayServerAndroid::_button_index_from_mask(int button_mask) { switch (button_mask) { - case BUTTON_MASK_LEFT: - return BUTTON_LEFT; - case BUTTON_MASK_RIGHT: - return BUTTON_RIGHT; - case BUTTON_MASK_MIDDLE: - return BUTTON_MIDDLE; - case BUTTON_MASK_XBUTTON1: - return BUTTON_XBUTTON1; - case BUTTON_MASK_XBUTTON2: - return BUTTON_XBUTTON2; + case MOUSE_BUTTON_MASK_LEFT: + return MOUSE_BUTTON_LEFT; + case MOUSE_BUTTON_MASK_RIGHT: + return MOUSE_BUTTON_RIGHT; + case MOUSE_BUTTON_MASK_MIDDLE: + return MOUSE_BUTTON_MIDDLE; + case MOUSE_BUTTON_MASK_XBUTTON1: + return MOUSE_BUTTON_XBUTTON1; + case MOUSE_BUTTON_MASK_XBUTTON2: + return MOUSE_BUTTON_XBUTTON2; default: return 0; } @@ -854,19 +854,19 @@ int DisplayServerAndroid::mouse_get_button_state() const { int DisplayServerAndroid::_android_button_mask_to_godot_button_mask(int android_button_mask) { int godot_button_mask = 0; if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) { - godot_button_mask |= BUTTON_MASK_LEFT; + godot_button_mask |= MOUSE_BUTTON_MASK_LEFT; } if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) { - godot_button_mask |= BUTTON_MASK_RIGHT; + godot_button_mask |= MOUSE_BUTTON_MASK_RIGHT; } if (android_button_mask & AMOTION_EVENT_BUTTON_TERTIARY) { - godot_button_mask |= BUTTON_MASK_MIDDLE; + godot_button_mask |= MOUSE_BUTTON_MASK_MIDDLE; } if (android_button_mask & AMOTION_EVENT_BUTTON_BACK) { - godot_button_mask |= BUTTON_MASK_XBUTTON1; + godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON1; } if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) { - godot_button_mask |= BUTTON_MASK_XBUTTON2; + godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON2; } return godot_button_mask; diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index e2c0a3d763a5..ff8ac825386f 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -189,19 +189,19 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E switch (p_event->button) { case DOM_BUTTON_LEFT: - ev->set_button_index(BUTTON_LEFT); + ev->set_button_index(MOUSE_BUTTON_LEFT); break; case DOM_BUTTON_MIDDLE: - ev->set_button_index(BUTTON_MIDDLE); + ev->set_button_index(MOUSE_BUTTON_MIDDLE); break; case DOM_BUTTON_RIGHT: - ev->set_button_index(BUTTON_RIGHT); + ev->set_button_index(MOUSE_BUTTON_RIGHT); break; case DOM_BUTTON_XBUTTON1: - ev->set_button_index(BUTTON_XBUTTON1); + ev->set_button_index(MOUSE_BUTTON_XBUTTON1); break; case DOM_BUTTON_XBUTTON2: - ev->set_button_index(BUTTON_XBUTTON2); + ev->set_button_index(MOUSE_BUTTON_XBUTTON2); break; default: return false; @@ -461,13 +461,13 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript ev->set_metakey(input->is_key_pressed(KEY_META)); if (p_event->deltaY < 0) - ev->set_button_index(BUTTON_WHEEL_UP); + ev->set_button_index(MOUSE_BUTTON_WHEEL_UP); else if (p_event->deltaY > 0) - ev->set_button_index(BUTTON_WHEEL_DOWN); + ev->set_button_index(MOUSE_BUTTON_WHEEL_DOWN); else if (p_event->deltaX > 0) - ev->set_button_index(BUTTON_WHEEL_LEFT); + ev->set_button_index(MOUSE_BUTTON_WHEEL_LEFT); else if (p_event->deltaX < 0) - ev->set_button_index(BUTTON_WHEEL_RIGHT); + ev->set_button_index(MOUSE_BUTTON_WHEEL_RIGHT); else return false; diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 3bc859e17d7e..27b9d9485a9e 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -3298,7 +3298,7 @@ void DisplayServerX11::process_events() { if (xi.pressure_supported) { mm->set_pressure(xi.pressure); } else { - mm->set_pressure((mouse_get_button_state() & (1 << (BUTTON_LEFT - 1))) ? 1.0f : 0.0f); + mm->set_pressure((mouse_get_button_state() & (1 << (MOUSE_BUTTON_LEFT - 1))) ? 1.0f : 0.0f); } mm->set_tilt(xi.tilt); diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index ed7d89009f77..412dd59f56ab 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -829,7 +829,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i mb->set_position(pos); mb->set_global_position(pos); mb->set_button_mask(DS_OSX->last_button_state); - if (index == BUTTON_LEFT && pressed) { + if (index == MOUSE_BUTTON_LEFT && pressed) { mb->set_doubleclick([event clickCount] == 2); } @@ -842,10 +842,10 @@ - (void)mouseDown:(NSEvent *)event { if (([event modifierFlags] & NSEventModifierFlagControl)) { wd.mouse_down_control = true; - _mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, true); } else { wd.mouse_down_control = false; - _mouseDownEvent(window_id, event, BUTTON_LEFT, BUTTON_MASK_LEFT, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MASK_LEFT, true); } } @@ -858,9 +858,9 @@ - (void)mouseUp:(NSEvent *)event { DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; if (wd.mouse_down_control) { - _mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, false); } else { - _mouseDownEvent(window_id, event, BUTTON_LEFT, BUTTON_MASK_LEFT, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MASK_LEFT, false); } } @@ -946,7 +946,7 @@ - (void)mouseMoved:(NSEvent *)event { } - (void)rightMouseDown:(NSEvent *)event { - _mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, true); } - (void)rightMouseDragged:(NSEvent *)event { @@ -954,16 +954,16 @@ - (void)rightMouseDragged:(NSEvent *)event { } - (void)rightMouseUp:(NSEvent *)event { - _mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, false); } - (void)otherMouseDown:(NSEvent *)event { if ((int)[event buttonNumber] == 2) { - _mouseDownEvent(window_id, event, BUTTON_MIDDLE, BUTTON_MASK_MIDDLE, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_MASK_MIDDLE, true); } else if ((int)[event buttonNumber] == 3) { - _mouseDownEvent(window_id, event, BUTTON_XBUTTON1, BUTTON_MASK_XBUTTON1, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_MASK_XBUTTON1, true); } else if ((int)[event buttonNumber] == 4) { - _mouseDownEvent(window_id, event, BUTTON_XBUTTON2, BUTTON_MASK_XBUTTON2, true); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON2, MOUSE_BUTTON_MASK_XBUTTON2, true); } else { return; } @@ -975,11 +975,11 @@ - (void)otherMouseDragged:(NSEvent *)event { - (void)otherMouseUp:(NSEvent *)event { if ((int)[event buttonNumber] == 2) { - _mouseDownEvent(window_id, event, BUTTON_MIDDLE, BUTTON_MASK_MIDDLE, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_MASK_MIDDLE, false); } else if ((int)[event buttonNumber] == 3) { - _mouseDownEvent(window_id, event, BUTTON_XBUTTON1, BUTTON_MASK_XBUTTON1, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_MASK_XBUTTON1, false); } else if ((int)[event buttonNumber] == 4) { - _mouseDownEvent(window_id, event, BUTTON_XBUTTON2, BUTTON_MASK_XBUTTON2, false); + _mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON2, MOUSE_BUTTON_MASK_XBUTTON2, false); } else { return; } @@ -1558,10 +1558,10 @@ - (void)scrollWheel:(NSEvent *)event { sendPanEvent(window_id, deltaX, deltaY, [event modifierFlags]); } else { if (fabs(deltaX)) { - sendScrollEvent(window_id, 0 > deltaX ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT, fabs(deltaX * 0.3), [event modifierFlags]); + sendScrollEvent(window_id, 0 > deltaX ? MOUSE_BUTTON_WHEEL_RIGHT : MOUSE_BUTTON_WHEEL_LEFT, fabs(deltaX * 0.3), [event modifierFlags]); } if (fabs(deltaY)) { - sendScrollEvent(window_id, 0 < deltaY ? BUTTON_WHEEL_UP : BUTTON_WHEEL_DOWN, fabs(deltaY * 0.3), [event modifierFlags]); + sendScrollEvent(window_id, 0 < deltaY ? MOUSE_BUTTON_WHEEL_UP : MOUSE_BUTTON_WHEEL_DOWN, fabs(deltaY * 0.3), [event modifierFlags]); } } } diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index dc4238bdd467..b7e4361831d0 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -149,28 +149,28 @@ static int _get_button(Windows::UI::Input::PointerPoint ^ pt) { using namespace Windows::UI::Input; #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - return BUTTON_LEFT; + return MOUSE_BUTTON_LEFT; #else switch (pt->Properties->PointerUpdateKind) { case PointerUpdateKind::LeftButtonPressed: case PointerUpdateKind::LeftButtonReleased: - return BUTTON_LEFT; + return MOUSE_BUTTON_LEFT; case PointerUpdateKind::RightButtonPressed: case PointerUpdateKind::RightButtonReleased: - return BUTTON_RIGHT; + return MOUSE_BUTTON_RIGHT; case PointerUpdateKind::MiddleButtonPressed: case PointerUpdateKind::MiddleButtonReleased: - return BUTTON_MIDDLE; + return MOUSE_BUTTON_MIDDLE; case PointerUpdateKind::XButton1Pressed: case PointerUpdateKind::XButton1Released: - return BUTTON_WHEEL_UP; + return MOUSE_BUTTON_WHEEL_UP; case PointerUpdateKind::XButton2Pressed: case PointerUpdateKind::XButton2Released: - return BUTTON_WHEEL_DOWN; + return MOUSE_BUTTON_WHEEL_DOWN; default: break; @@ -265,9 +265,9 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor if (p_is_wheel) { if (point->Properties->MouseWheelDelta > 0) { - mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP); + mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? MOUSE_BUTTON_WHEEL_RIGHT : MOUSE_BUTTON_WHEEL_UP); } else if (point->Properties->MouseWheelDelta < 0) { - mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN); + mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? MOUSE_BUTTON_WHEEL_LEFT : MOUSE_BUTTON_WHEEL_DOWN); } } diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index e29faf4f3c76..4d81afc5dde7 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2431,9 +2431,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA return 0; if (motion > 0) - mb->set_button_index(BUTTON_WHEEL_UP); + mb->set_button_index(MOUSE_BUTTON_WHEEL_UP); else - mb->set_button_index(BUTTON_WHEEL_DOWN); + mb->set_button_index(MOUSE_BUTTON_WHEEL_DOWN); } break; case WM_MOUSEHWHEEL: { @@ -2443,33 +2443,33 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA return 0; if (motion < 0) { - mb->set_button_index(BUTTON_WHEEL_LEFT); + mb->set_button_index(MOUSE_BUTTON_WHEEL_LEFT); mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA)); } else { - mb->set_button_index(BUTTON_WHEEL_RIGHT); + mb->set_button_index(MOUSE_BUTTON_WHEEL_RIGHT); mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA)); } } break; case WM_XBUTTONDOWN: { mb->set_pressed(true); if (HIWORD(wParam) == XBUTTON1) - mb->set_button_index(BUTTON_XBUTTON1); + mb->set_button_index(MOUSE_BUTTON_XBUTTON1); else - mb->set_button_index(BUTTON_XBUTTON2); + mb->set_button_index(MOUSE_BUTTON_XBUTTON2); } break; case WM_XBUTTONUP: { mb->set_pressed(false); if (HIWORD(wParam) == XBUTTON1) - mb->set_button_index(BUTTON_XBUTTON1); + mb->set_button_index(MOUSE_BUTTON_XBUTTON1); else - mb->set_button_index(BUTTON_XBUTTON2); + mb->set_button_index(MOUSE_BUTTON_XBUTTON2); } break; case WM_XBUTTONDBLCLK: { mb->set_pressed(true); if (HIWORD(wParam) == XBUTTON1) - mb->set_button_index(BUTTON_XBUTTON1); + mb->set_button_index(MOUSE_BUTTON_XBUTTON1); else - mb->set_button_index(BUTTON_XBUTTON2); + mb->set_button_index(MOUSE_BUTTON_XBUTTON2); mb->set_doubleclick(true); } break; default: { diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index d54d63cc399d..6c7a8f343394 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -45,7 +45,7 @@ class BaseButton : public Control { }; private: - int button_mask = BUTTON_MASK_LEFT; + int button_mask = MOUSE_BUTTON_MASK_LEFT; bool toggle_mode = false; bool shortcut_in_tooltip = true; bool keep_pressed_outside = false; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index bddbe30f531f..5822119b46bb 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -544,7 +544,7 @@ void ColorPicker::_uv_input(const Ref &p_event) { Ref bev = p_event; if (bev.is_valid()) { - if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { + if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) { changing_color = true; float x = CLAMP((float)bev->get_position().x, 0, uv_edit->get_size().width); float y = CLAMP((float)bev->get_position().y, 0, uv_edit->get_size().height); @@ -557,7 +557,7 @@ void ColorPicker::_uv_input(const Ref &p_event) { if (!deferred_mode_enabled) { emit_signal("color_changed", color); } - } else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { + } else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) { emit_signal("color_changed", color); changing_color = false; } else { @@ -589,7 +589,7 @@ void ColorPicker::_w_input(const Ref &p_event) { Ref bev = p_event; if (bev.is_valid()) { - if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { + if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) { changing_color = true; float y = CLAMP((float)bev->get_position().y, 0, w_edit->get_size().height); h = y / w_edit->get_size().height; @@ -602,7 +602,7 @@ void ColorPicker::_w_input(const Ref &p_event) { _update_color(); if (!deferred_mode_enabled) { emit_signal("color_changed", color); - } else if (!bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { + } else if (!bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) { emit_signal("color_changed", color); } } @@ -630,7 +630,7 @@ void ColorPicker::_preset_input(const Ref &p_event) { if (bev.is_valid()) { int index = 0; - if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { + if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) { for (int i = 0; i < presets.size(); i++) { int x = (i % presets_per_row) * bt_add_preset->get_size().x; int y = (Math::floor((float)i / presets_per_row)) * bt_add_preset->get_size().y; @@ -641,7 +641,7 @@ void ColorPicker::_preset_input(const Ref &p_event) { set_pick_color(presets[index]); _update_color(); emit_signal("color_changed", color); - } else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT && presets_enabled) { + } else if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_RIGHT && presets_enabled) { index = bev->get_position().x / (preset->get_size().x / presets.size()); Color clicked_preset = presets[index]; erase_preset(clicked_preset); @@ -670,7 +670,7 @@ void ColorPicker::_screen_input(const Ref &p_event) { } Ref bev = p_event; - if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) { + if (bev.is_valid() && bev->get_button_index() == MOUSE_BUTTON_LEFT && !bev->is_pressed()) { emit_signal("color_changed", color); screen->hide(); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 71d31434d462..315bef38e8e6 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -161,7 +161,7 @@ void GraphEditMinimap::_gui_input(const Ref &p_ev) { Ref mb = p_ev; Ref mm = p_ev; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { is_pressing = true; @@ -553,7 +553,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) { void GraphEdit::_top_layer_input(const Ref &p_ev) { Ref mb = p_ev; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { connecting_valid = false; Ref port = get_theme_icon("port", "GraphNode"); click_pos = mb->get_position() / zoom; @@ -696,7 +696,7 @@ void GraphEdit::_top_layer_input(const Ref &p_ev) { } } - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) { if (connecting_valid) { if (connecting && connecting_target) { String from = connecting_from; @@ -1067,7 +1067,7 @@ void GraphEdit::set_selected(Node *p_child) { void GraphEdit::_gui_input(const Ref &p_ev) { Ref mm = p_ev; - if (mm.is_valid() && (mm->get_button_mask() & BUTTON_MASK_MIDDLE || (mm->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { + if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y); } @@ -1139,7 +1139,7 @@ void GraphEdit::_gui_input(const Ref &p_ev) { Ref b = p_ev; if (b.is_valid()) { - if (b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) { + if (b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) { if (box_selecting) { box_selecting = false; for (int i = get_child_count() - 1; i >= 0; i--) { @@ -1169,7 +1169,7 @@ void GraphEdit::_gui_input(const Ref &p_ev) { } } - if (b->get_button_index() == BUTTON_LEFT && !b->is_pressed() && dragging) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed() && dragging) { if (!just_selected && drag_accum == Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { //deselect current node for (int i = get_child_count() - 1; i >= 0; i--) { @@ -1208,7 +1208,7 @@ void GraphEdit::_gui_input(const Ref &p_ev) { connections_layer->update(); } - if (b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { GraphNode *gn = nullptr; for (int i = get_child_count() - 1; i >= 0; i--) { @@ -1310,24 +1310,24 @@ void GraphEdit::_gui_input(const Ref &p_ev) { } } - if (b->get_button_index() == BUTTON_LEFT && !b->is_pressed() && box_selecting) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed() && box_selecting) { box_selecting = false; previus_selected.clear(); top_layer->update(); minimap->update(); } - if (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { set_zoom(zoom * ZOOM_SCALE); - } else if (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { set_zoom(zoom / ZOOM_SCALE); - } else if (b->get_button_index() == BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { + } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); - } else if (b->get_button_index() == BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { + } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8); - } else if (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { + } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8); - } else if (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { + } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8); } } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index c80fc516e83a..8eba473d57fd 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -808,7 +808,7 @@ void GraphNode::_gui_input(const Ref &p_ev) { if (mb.is_valid()) { ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node."); - if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y); if (close_rect.size != Size2() && close_rect.has_point(mpos)) { //send focus to parent @@ -831,7 +831,7 @@ void GraphNode::_gui_input(const Ref &p_ev) { emit_signal("raise_request"); } - if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { resizing = false; } } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index fa72599fb387..482560d29d06 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -540,7 +540,7 @@ void ItemList::_gui_input(const Ref &p_event) { Ref mb = p_event; - if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) { + if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) { select(defer_select_single, true); emit_signal("multi_selected", defer_select_single, true); @@ -548,7 +548,7 @@ void ItemList::_gui_input(const Ref &p_event) { return; } - if (mb.is_valid() && (mb->get_button_index() == BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == BUTTON_RIGHT)) && mb->is_pressed()) { + if (mb.is_valid() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == MOUSE_BUTTON_RIGHT)) && mb->is_pressed()) { search_string = ""; //any mousepress cancels Vector2 pos = mb->get_position(); Ref bg = get_theme_stylebox("bg"); @@ -594,16 +594,16 @@ void ItemList::_gui_input(const Ref &p_event) { } } - if (mb->get_button_index() == BUTTON_RIGHT) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", i, get_local_mouse_position()); } } else { - if (!mb->is_doubleclick() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == BUTTON_LEFT) { + if (!mb->is_doubleclick() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) { defer_select_single = i; return; } - if (items[i].selected && mb->get_button_index() == BUTTON_RIGHT) { + if (items[i].selected && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", i, get_local_mouse_position()); } else { bool selected = items[i].selected; @@ -618,7 +618,7 @@ void ItemList::_gui_input(const Ref &p_event) { } } - if (mb->get_button_index() == BUTTON_RIGHT) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", i, get_local_mouse_position()); } else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) { emit_signal("item_activated", i); @@ -628,7 +628,7 @@ void ItemList::_gui_input(const Ref &p_event) { return; } - if (mb->get_button_index() == BUTTON_RIGHT) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { emit_signal("rmb_clicked", mb->get_position()); return; @@ -637,10 +637,10 @@ void ItemList::_gui_input(const Ref &p_event) { // Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting. emit_signal("nothing_selected"); } - if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) { scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8); } - if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) { scroll_bar->set_value(scroll_bar->get_value() + scroll_bar->get_page() * mb->get_factor() / 8); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index ce371e3b5684..d1cd73c803ed 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -222,7 +222,7 @@ void LineEdit::_gui_input(Ref p_event) { // Ignore mouse clicks in IME input mode. return; } - if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && context_menu_enabled) { + if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && context_menu_enabled) { menu->set_position(get_screen_transform().xform(get_local_mouse_position())); menu->set_size(Vector2(1, 1)); _generate_context_menu(); @@ -232,7 +232,7 @@ void LineEdit::_gui_input(Ref p_event) { return; } - if (b->get_button_index() != BUTTON_LEFT) { + if (b->get_button_index() != MOUSE_BUTTON_LEFT) { return; } @@ -327,7 +327,7 @@ void LineEdit::_gui_input(Ref p_event) { } } - if (m->get_button_mask() & BUTTON_LEFT) { + if (m->get_button_mask() & MOUSE_BUTTON_LEFT) { if (selection.creating) { set_cursor_at_pixel_pos(m->get_position().x); selection_fill_at_cursor(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index fb9e2647ee7f..bfbd46a9f0ee 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -359,7 +359,7 @@ void PopupMenu::_gui_input(const Ref &p_event) { if (b->is_pressed() || (!b->is_pressed() && during_grabbed_click)) { // Allow activating item by releasing the LMB or any that was down when the popup appeared. // However, if button was not held when opening menu, do not allow release to activate item. - if (button_idx == BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) { + if (button_idx == MOUSE_BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) { bool was_during_grabbed_click = during_grabbed_click; during_grabbed_click = false; initial_button_mask = 0; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index bce30e7cd359..13b57ece6c01 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1479,7 +1479,7 @@ void RichTextLabel::_gui_input(Ref p_event) { return; } - if (b->get_button_index() == BUTTON_LEFT) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT) { if (b->is_pressed() && !b->is_doubleclick()) { scroll_updated = false; ItemFrame *c_frame = nullptr; @@ -1564,12 +1564,12 @@ void RichTextLabel::_gui_input(Ref p_event) { } } - if (b->get_button_index() == BUTTON_WHEEL_UP) { + if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { if (scroll_active) { vscroll->set_value(vscroll->get_value() - vscroll->get_page() * b->get_factor() * 0.5 / 8); } } - if (b->get_button_index() == BUTTON_WHEEL_DOWN) { + if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { if (scroll_active) { vscroll->set_value(vscroll->get_value() + vscroll->get_page() * b->get_factor() * 0.5 / 8); } diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index f2516e76a559..a56bf15507a5 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -52,17 +52,17 @@ void ScrollBar::_gui_input(Ref p_event) { if (b.is_valid()) { accept_event(); - if (b->get_button_index() == BUTTON_WHEEL_DOWN && b->is_pressed()) { + if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && b->is_pressed()) { set_value(get_value() + get_page() / 4.0); accept_event(); } - if (b->get_button_index() == BUTTON_WHEEL_UP && b->is_pressed()) { + if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && b->is_pressed()) { set_value(get_value() - get_page() / 4.0); accept_event(); } - if (b->get_button_index() != BUTTON_LEFT) { + if (b->get_button_index() != MOUSE_BUTTON_LEFT) { return; } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 411891ece866..90a528482f83 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -94,7 +94,7 @@ void ScrollContainer::_gui_input(const Ref &p_gui_input) { Ref mb = p_gui_input; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) { // only horizontal is enabled, scroll horizontally if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) { h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() / 8 * mb->get_factor()); @@ -103,7 +103,7 @@ void ScrollContainer::_gui_input(const Ref &p_gui_input) { } } - if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) { // only horizontal is enabled, scroll horizontally if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) { h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() / 8 * mb->get_factor()); @@ -112,13 +112,13 @@ void ScrollContainer::_gui_input(const Ref &p_gui_input) { } } - if (mb->get_button_index() == BUTTON_WHEEL_LEFT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT && mb->is_pressed()) { if (h_scroll->is_visible_in_tree()) { h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb->get_factor() / 8); } } - if (mb->get_button_index() == BUTTON_WHEEL_RIGHT && mb->is_pressed()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT && mb->is_pressed()) { if (h_scroll->is_visible_in_tree()) { h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * mb->get_factor() / 8); } @@ -132,7 +132,7 @@ void ScrollContainer::_gui_input(const Ref &p_gui_input) { return; } - if (mb->get_button_index() != BUTTON_LEFT) { + if (mb->get_button_index() != MOUSE_BUTTON_LEFT) { return; } diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 2239226c7852..7f1d19a87aea 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -53,7 +53,7 @@ void Slider::_gui_input(Ref p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { Ref grabber = get_theme_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber"); grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x; @@ -72,10 +72,10 @@ void Slider::_gui_input(Ref p_event) { grab.active = false; } } else if (scrollable) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { grab_focus(); set_value(get_value() + get_step()); - } else if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + } else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { grab_focus(); set_value(get_value() - get_step()); } diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index d82cc98e0119..50b25fa7b422 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -76,7 +76,7 @@ void SpinBox::_line_edit_input(const Ref &p_event) { } void SpinBox::_range_click_timeout() { - if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { + if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) { bool up = get_local_mouse_position().y < (get_size().height / 2); set_value(get_value() + (up ? get_step() : -get_step())); @@ -110,7 +110,7 @@ void SpinBox::_gui_input(const Ref &p_event) { bool up = mb->get_position().y < (get_size().height / 2); switch (mb->get_button_index()) { - case BUTTON_LEFT: { + case MOUSE_BUTTON_LEFT: { line_edit->grab_focus(); set_value(get_value() + (up ? get_step() : -get_step())); @@ -122,17 +122,17 @@ void SpinBox::_gui_input(const Ref &p_event) { drag.allowed = true; drag.capture_pos = mb->get_position(); } break; - case BUTTON_RIGHT: { + case MOUSE_BUTTON_RIGHT: { line_edit->grab_focus(); set_value((up ? get_max() : get_min())); } break; - case BUTTON_WHEEL_UP: { + case MOUSE_BUTTON_WHEEL_UP: { if (line_edit->has_focus()) { set_value(get_value() + get_step() * mb->get_factor()); accept_event(); } } break; - case BUTTON_WHEEL_DOWN: { + case MOUSE_BUTTON_WHEEL_DOWN: { if (line_edit->has_focus()) { set_value(get_value() - get_step() * mb->get_factor()); accept_event(); @@ -141,7 +141,7 @@ void SpinBox::_gui_input(const Ref &p_event) { } } - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { //set_default_cursor_shape(CURSOR_ARROW); range_click_timer->stop(); _release_mouse(); @@ -150,7 +150,7 @@ void SpinBox::_gui_input(const Ref &p_event) { Ref mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { if (drag.enabled) { drag.diff_y += mm->get_relative().y; float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y); diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index d43e195df132..c80120f87d9f 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -214,7 +214,7 @@ void SplitContainer::_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { int sep = get_theme_constant("separation"); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 3bf163f67053..1e31f9e20606 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -76,7 +76,7 @@ void TabContainer::_gui_input(const Ref &p_event) { Popup *popup = get_popup(); - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Point2 pos(mb->get_position().x, mb->get_position().y); Size2 size = get_size(); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index da1a9698d027..4a7285a15420 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -122,7 +122,7 @@ void Tabs::_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !mb->get_command()) { if (scrolling_enabled && buttons_visible) { if (offset > 0) { offset--; @@ -131,7 +131,7 @@ void Tabs::_gui_input(const Ref &p_event) { } } - if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !mb->get_command()) { if (scrolling_enabled && buttons_visible) { if (missing_right) { offset++; @@ -140,7 +140,7 @@ void Tabs::_gui_input(const Ref &p_event) { } } - if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (rb_hover != -1) { //pressed emit_signal("right_button_pressed", rb_hover); @@ -150,7 +150,7 @@ void Tabs::_gui_input(const Ref &p_event) { update(); } - if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (cb_hover != -1) { //pressed emit_signal("tab_closed", cb_hover); @@ -160,7 +160,7 @@ void Tabs::_gui_input(const Ref &p_event) { update(); } - if (mb->is_pressed() && (mb->get_button_index() == BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == BUTTON_RIGHT))) { + if (mb->is_pressed() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == MOUSE_BUTTON_RIGHT))) { // clicks Point2 pos(mb->get_position().x, mb->get_position().y); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cf3978ca41f3..74c530f1b006 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -357,10 +357,10 @@ void TextEdit::_update_scrollbars() { } void TextEdit::_click_selection_held() { - // Warning: is_mouse_button_pressed(BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD + // Warning: is_mouse_button_pressed(MOUSE_BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD // and MODE_LINE. However, moving the mouse triggers _gui_input, which calls these functions too, so that's not a huge problem. // I'm unsure if there's an actual fix that doesn't have a ton of side effects. - if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != SelectionMode::SELECTION_MODE_NONE) { + if (Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT) && selection.selecting_mode != SelectionMode::SELECTION_MODE_NONE) { switch (selection.selecting_mode) { case SelectionMode::SELECTION_MODE_POINTER: { _update_selection_mode_pointer(); @@ -2873,14 +2873,14 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { return; } - if (mb->get_button_index() == BUTTON_WHEEL_UP) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { if (completion_index > 0) { completion_index--; completion_current = completion_options[completion_index]; update(); } } - if (mb->get_button_index() == BUTTON_WHEEL_DOWN) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { if (completion_index < completion_options.size() - 1) { completion_index++; completion_current = completion_options[completion_index]; @@ -2888,7 +2888,7 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { } } - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { completion_index = CLAMP(completion_line_ofs + (mpos.y - completion_rect.position.y) / get_row_height(), 0, completion_options.size() - 1); completion_current = completion_options[completion_index]; @@ -2904,27 +2904,27 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { } if (mb->is_pressed()) { - if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); } else if (v_scroll->is_visible()) { _scroll_up(3 * mb->get_factor()); } } - if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); } else if (v_scroll->is_visible()) { _scroll_down(3 * mb->get_factor()); } } - if (mb->get_button_index() == BUTTON_WHEEL_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); } - if (mb->get_button_index() == BUTTON_WHEEL_RIGHT) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT) { h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); } - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { _reset_caret_blink_timer(); int row, col; @@ -3031,7 +3031,7 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { update(); } - if (mb->get_button_index() == BUTTON_RIGHT && context_menu_enabled) { + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && context_menu_enabled) { _reset_caret_blink_timer(); int row, col; @@ -3062,7 +3062,7 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { grab_focus(); } } else { - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->get_command() && highlighted_word != String()) { int row, col; _get_mouse_pos(Point2i(mpos.x, mpos.y), row, col); @@ -3118,7 +3118,7 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { } } - if (mm->get_button_mask() & BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data() == Variant()) { // Ignore if dragging. + if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data() == Variant()) { // Ignore if dragging. _reset_caret_blink_timer(); if (draw_minimap && !dragging_selection) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0445e5f3451d..abfea241f346 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1588,7 +1588,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (p_item->cells[i].custom_button) { if (cache.hover_item == p_item && cache.hover_cell == i) { - if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { + if (Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) { draw_style_box(cache.custom_button_pressed, ir); } else { draw_style_box(cache.custom_button_hover, ir); @@ -1825,7 +1825,7 @@ Rect2 Tree::search_item_rect(TreeItem *p_from, TreeItem *p_item) { } void Tree::_range_click_timeout() { - if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { + if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) { Point2 pos = get_local_mouse_position() - cache.bg->get_offset(); if (show_column_titles) { pos.y -= _get_title_button_height(); @@ -1843,7 +1843,7 @@ void Tree::_range_click_timeout() { propagate_mouse_activated = false; // done from outside, so signal handler can't clear the tree in the middle of emit (which is a common case) blocked++; - propagate_mouse_event(pos + cache.offset, 0, 0, false, root, BUTTON_LEFT, mb); + propagate_mouse_event(pos + cache.offset, 0, 0, false, root, MOUSE_BUTTON_LEFT, mb); blocked--; if (range_click_timer->is_one_shot()) { @@ -1960,7 +1960,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool col_width -= w + cache.button_margin; } - if (p_button == BUTTON_LEFT || (p_button == BUTTON_RIGHT && allow_rmb_select)) { + if (p_button == MOUSE_BUTTON_LEFT || (p_button == MOUSE_BUTTON_RIGHT && allow_rmb_select)) { /* process selection */ if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check @@ -1972,10 +1972,10 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } if (select_mode == SELECT_MULTI && p_mod->get_command() && c.selectable) { - if (!c.selected || p_button == BUTTON_RIGHT) { + if (!c.selected || p_button == MOUSE_BUTTON_RIGHT) { p_item->select(col); emit_signal("multi_selected", p_item, col, true); - if (p_button == BUTTON_RIGHT) { + if (p_button == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", get_local_mouse_position()); } @@ -1992,21 +1992,21 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool bool inrange = false; select_single_item(p_item, root, col, selected_item, &inrange); - if (p_button == BUTTON_RIGHT) { + if (p_button == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", get_local_mouse_position()); } } else { int icount = _count_selected_items(root); - if (select_mode == SELECT_MULTI && icount > 1 && p_button != BUTTON_RIGHT) { + if (select_mode == SELECT_MULTI && icount > 1 && p_button != MOUSE_BUTTON_RIGHT) { single_select_defer = p_item; single_select_defer_column = col; } else { - if (p_button != BUTTON_RIGHT || !c.selected) { + if (p_button != MOUSE_BUTTON_RIGHT || !c.selected) { select_single_item(p_item, root, col); } - if (p_button == BUTTON_RIGHT) { + if (p_button == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", get_local_mouse_position()); } } @@ -2076,7 +2076,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool /* touching the combo */ bool up = p_pos.y < (item_h / 2); - if (p_button == BUTTON_LEFT) { + if (p_button == MOUSE_BUTTON_LEFT) { if (range_click_timer->get_time_left() == 0) { range_item_last = p_item; range_up_last = up; @@ -2093,13 +2093,13 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool item_edited(col, p_item); - } else if (p_button == BUTTON_RIGHT) { + } else if (p_button == MOUSE_BUTTON_RIGHT) { p_item->set_range(col, (up ? c.max : c.min)); item_edited(col, p_item); - } else if (p_button == BUTTON_WHEEL_UP) { + } else if (p_button == MOUSE_BUTTON_WHEEL_UP) { p_item->set_range(col, c.val + c.step); item_edited(col, p_item); - } else if (p_button == BUTTON_WHEEL_DOWN) { + } else if (p_button == MOUSE_BUTTON_WHEEL_DOWN) { p_item->set_range(col, c.val - c.step); item_edited(col, p_item); } @@ -2132,14 +2132,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } if (!p_item->cells[col].custom_button || !on_arrow) { - item_edited(col, p_item, p_button == BUTTON_LEFT); + item_edited(col, p_item, p_button == MOUSE_BUTTON_LEFT); } click_handled = true; return -1; } break; }; - if (!bring_up_editor || p_button != BUTTON_LEFT) { + if (!bring_up_editor || p_button != MOUSE_BUTTON_LEFT) { return -1; } @@ -2179,7 +2179,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool item_h += child_h; } } - if (p_item == root && p_button == BUTTON_RIGHT) { + if (p_item == root && p_button == MOUSE_BUTTON_RIGHT) { emit_signal("empty_rmb", get_local_mouse_position()); } } @@ -2720,7 +2720,7 @@ void Tree::_gui_input(Ref p_event) { bool rtl = is_layout_rtl(); if (!b->is_pressed()) { - if (b->get_button_index() == BUTTON_LEFT) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT) { Point2 pos = b->get_position(); if (rtl) { pos.x = get_size().width - pos.x; @@ -2801,8 +2801,8 @@ void Tree::_gui_input(Ref p_event) { } switch (b->get_button_index()) { - case BUTTON_RIGHT: - case BUTTON_LEFT: { + case MOUSE_BUTTON_RIGHT: + case MOUSE_BUTTON_LEFT: { Ref bg = cache.bg; Point2 pos = b->get_position(); @@ -2815,7 +2815,7 @@ void Tree::_gui_input(Ref p_event) { pos.y -= _get_title_button_height(); if (pos.y < 0) { - if (b->get_button_index() == BUTTON_LEFT) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT) { pos.x += cache.offset.x; int len = 0; for (int i = 0; i < columns.size(); i++) { @@ -2833,7 +2833,7 @@ void Tree::_gui_input(Ref p_event) { } } if (!root || (!root->get_children() && hide_root)) { - if (b->get_button_index() == BUTTON_RIGHT && allow_rmb_select) { + if (b->get_button_index() == MOUSE_BUTTON_RIGHT && allow_rmb_select) { emit_signal("empty_tree_rmb_selected", get_local_mouse_position()); } break; @@ -2854,7 +2854,7 @@ void Tree::_gui_input(Ref p_event) { } } - if (b->get_button_index() == BUTTON_RIGHT) { + if (b->get_button_index() == MOUSE_BUTTON_RIGHT) { break; } @@ -2877,7 +2877,7 @@ void Tree::_gui_input(Ref p_event) { set_physics_process_internal(true); } - if (b->get_button_index() == BUTTON_LEFT) { + if (b->get_button_index() == MOUSE_BUTTON_LEFT) { if (get_item_at_position(b->get_position()) == nullptr && !b->get_shift() && !b->get_control() && !b->get_command()) { emit_signal("nothing_selected"); } @@ -2890,7 +2890,7 @@ void Tree::_gui_input(Ref p_event) { } } break; - case BUTTON_WHEEL_UP: { + case MOUSE_BUTTON_WHEEL_UP: { double prev_value = v_scroll->get_value(); v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); if (v_scroll->get_value() != prev_value) { @@ -2898,7 +2898,7 @@ void Tree::_gui_input(Ref p_event) { } } break; - case BUTTON_WHEEL_DOWN: { + case MOUSE_BUTTON_WHEEL_DOWN: { double prev_value = v_scroll->get_value(); v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8); if (v_scroll->get_value() != prev_value) { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e4cda4b96f23..c6fe1117d105 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1621,10 +1621,10 @@ void Viewport::_gui_call_input(Control *p_control, const Ref &p_inpu Ref mb = p_input; bool cant_stop_me_now = (mb.is_valid() && - (mb->get_button_index() == BUTTON_WHEEL_DOWN || - mb->get_button_index() == BUTTON_WHEEL_UP || - mb->get_button_index() == BUTTON_WHEEL_LEFT || - mb->get_button_index() == BUTTON_WHEEL_RIGHT)); + (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN || + mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP || + mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || + mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT)); Ref pn = p_input; cant_stop_me_now = pn.is_valid() || cant_stop_me_now; @@ -1860,7 +1860,7 @@ void Viewport::_gui_input_event(Ref p_event) { gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1); - if (mb->get_button_index() == BUTTON_LEFT) { + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { gui.drag_accum = Vector2(); gui.drag_attempted = false; } @@ -1883,7 +1883,7 @@ void Viewport::_gui_input_event(Ref p_event) { } #endif - if (mb->get_button_index() == BUTTON_LEFT) { //assign focus + if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { //assign focus CanvasItem *ci = gui.mouse_focus; while (ci) { Control *control = Object::cast_to(ci); @@ -1914,7 +1914,7 @@ void Viewport::_gui_input_event(Ref p_event) { set_input_as_handled(); - if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == BUTTON_LEFT) { + if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == MOUSE_BUTTON_LEFT) { //alternate drop use (when using force_drag(), as proposed by #5342 if (gui.mouse_focus) { _gui_drop(gui.mouse_focus, pos, false); @@ -1934,7 +1934,7 @@ void Viewport::_gui_input_event(Ref p_event) { _gui_cancel_tooltip(); } else { - if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == BUTTON_LEFT) { + if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (gui.drag_mouse_over) { _gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, false); } @@ -1978,7 +1978,7 @@ void Viewport::_gui_input_event(Ref p_event) { _gui_call_input(mouse_focus, mb); } - /*if (gui.drag_data.get_type()!=Variant::NIL && mb->get_button_index()==BUTTON_LEFT) { + /*if (gui.drag_data.get_type()!=Variant::NIL && mb->get_button_index()==MOUSE_BUTTON_LEFT) { _propagate_viewport_notification(this,NOTIFICATION_DRAG_END); gui.drag_data=Variant(); //always clear }*/ @@ -2022,7 +2022,7 @@ void Viewport::_gui_input_event(Ref p_event) { Control *over = nullptr; // D&D - if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { gui.drag_accum += mm->get_relative(); float len = gui.drag_accum.length(); if (len > 10) { @@ -2266,7 +2266,7 @@ void Viewport::_gui_input_event(Ref p_event) { Transform2D localizer = gui.drag_mouse_over->get_global_transform_with_canvas().affine_inverse(); gui.drag_mouse_over_pos = localizer.xform(viewport_pos); - if (mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { bool can_drop = _gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, true); if (!can_drop) { @@ -2783,7 +2783,7 @@ bool Viewport::_sub_windows_forward_input(const Ref &p_event) { ERR_FAIL_COND_V(gui.subwindow_focused == nullptr, false); Ref mb = p_event; - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) { if (gui.subwindow_drag_close_rect.has_point(mb->get_position())) { //close window @@ -2908,7 +2908,7 @@ bool Viewport::_sub_windows_forward_input(const Ref &p_event) { Ref mb = p_event; //if the event is a mouse button, we need to check whether another window was clicked - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { bool click_on_window = false; for (int i = gui.sub_windows.size() - 1; i >= 0; i--) { SubWindow &sw = gui.sub_windows.write[i]; diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp index 570e1897d638..047697e31432 100644 --- a/tests/test_physics_2d.cpp +++ b/tests/test_physics_2d.cpp @@ -216,10 +216,10 @@ class TestPhysics2DMainLoop : public MainLoop { if (mm.is_valid()) { Point2 p = mm->get_position(); - if (mm->get_button_mask() & BUTTON_MASK_LEFT) { + if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { ray_to = p; _do_ray_query(); - } else if (mm->get_button_mask() & BUTTON_MASK_RIGHT) { + } else if (mm->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) { ray_from = p; _do_ray_query(); } From a5324787c80ebc55b123ab19db2b23404b1241ec Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 13 May 2020 18:27:34 -0400 Subject: [PATCH 2/2] Rename some more global enums (Key, Joy, MIDI) --- core/core_constants.cpp | 8 +- core/input/input.cpp | 22 +- core/input/input.h | 12 +- core/input/input_event.h | 6 +- core/os/keyboard.h | 2 +- doc/classes/@GlobalScope.xml | 592 +++++++++--------- doc/classes/Input.xml | 8 +- doc/classes/InputEventJoypadButton.xml | 2 +- doc/classes/InputEventJoypadMotion.xml | 2 +- doc/classes/InputEventKey.xml | 4 +- doc/classes/InputEventMouse.xml | 2 +- doc/classes/InputEventMouseButton.xml | 2 +- doc/classes/XRController3D.xml | 2 +- doc/translations/classes.pot | 14 +- doc/translations/fr.po | 14 +- modules/gdnative/xr/xr_interface_gdnative.cpp | 2 +- modules/webxr/webxr_interface_js.cpp | 2 +- platform/android/display_server_android.cpp | 2 +- platform/iphone/joypad_iphone.mm | 2 +- .../javascript/display_server_javascript.cpp | 4 +- platform/linuxbsd/joypad_linux.cpp | 8 +- platform/linuxbsd/joypad_linux.h | 4 +- platform/osx/joypad_osx.cpp | 4 +- platform/uwp/joypad_uwp.cpp | 4 +- platform/uwp/joypad_uwp.h | 2 +- platform/windows/joypad_windows.cpp | 4 +- platform/windows/joypad_windows.h | 2 +- 27 files changed, 366 insertions(+), 366 deletions(-) diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 4f2faf417269..f40928350a17 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -104,12 +104,12 @@ static Vector<_CoreConstant> _global_constants; #endif -VARIANT_ENUM_CAST(KeyList); +VARIANT_ENUM_CAST(Key); VARIANT_ENUM_CAST(KeyModifierMask); VARIANT_ENUM_CAST(MouseButton); -VARIANT_ENUM_CAST(JoyButtonList); -VARIANT_ENUM_CAST(JoyAxisList); -VARIANT_ENUM_CAST(MidiMessageList); +VARIANT_ENUM_CAST(JoyButton); +VARIANT_ENUM_CAST(JoyAxis); +VARIANT_ENUM_CAST(MIDIMessage); void register_global_constants() { BIND_CORE_ENUM_CONSTANT(SIDE_LEFT); diff --git a/core/input/input.cpp b/core/input/input.cpp index 09a5c5ef320a..627944210ff1 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -907,7 +907,7 @@ void Input::joy_button(int p_device, int p_button, bool p_pressed) { // no event? } -void Input::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) { +void Input::joy_axis(int p_device, int p_axis, const JoyAxisValue &p_value) { _THREAD_SAFE_METHOD_; ERR_FAIL_INDEX(p_axis, JOY_AXIS_MAX); @@ -921,12 +921,12 @@ void Input::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) { //when changing direction quickly, insert fake event to release pending inputmap actions float last = joy.last_axis[p_axis]; if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) { - JoyAxis jx; + JoyAxisValue jx; jx.min = p_value.min; jx.value = p_value.value < 0.5 ? 0.6 : 0.4; joy_axis(p_device, p_axis, jx); } else if (ABS(last) > 0.5 && last * p_value.value <= 0) { - JoyAxis jx; + JoyAxisValue jx; jx.min = p_value.min; jx.value = last > 0 ? 0.1 : -0.1; joy_axis(p_device, p_axis, jx); @@ -1206,22 +1206,22 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, J } } -JoyButtonList Input::_get_output_button(String output) { +JoyButton Input::_get_output_button(String output) { for (int i = 0; i < JOY_BUTTON_SDL_MAX; i++) { if (output == _joy_buttons[i]) { - return JoyButtonList(i); + return JoyButton(i); } } - return JoyButtonList::JOY_BUTTON_INVALID; + return JoyButton::JOY_BUTTON_INVALID; } -JoyAxisList Input::_get_output_axis(String output) { +JoyAxis Input::_get_output_axis(String output) { for (int i = 0; i < JOY_AXIS_SDL_MAX; i++) { if (output == _joy_axes[i]) { - return JoyAxisList(i); + return JoyAxis(i); } } - return JoyAxisList::JOY_AXIS_INVALID; + return JoyAxis::JOY_AXIS_INVALID; } void Input::parse_mapping(String p_mapping) { @@ -1279,8 +1279,8 @@ void Input::parse_mapping(String p_mapping) { input = input.left(input.length() - 1); } - JoyButtonList output_button = _get_output_button(output); - JoyAxisList output_axis = _get_output_axis(output); + JoyButton output_button = _get_output_button(output); + JoyAxis output_axis = _get_output_axis(output); ERR_CONTINUE_MSG(output_button == JOY_BUTTON_INVALID && output_axis == JOY_AXIS_INVALID, String(entry[idx] + "\nUnrecognised output string: " + output)); ERR_CONTINUE_MSG(output_button != JOY_BUTTON_INVALID && output_axis != JOY_AXIS_INVALID, diff --git a/core/input/input.h b/core/input/input.h index 0e3af4238142..99b45db325e5 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -91,7 +91,7 @@ class Input : public Object { JOYPADS_MAX = 16, }; - struct JoyAxis { + struct JoyAxisValue { int min; float value; }; @@ -199,10 +199,10 @@ class Input : public Object { JoyType outputType; union { - JoyButtonList button; + JoyButton button; struct { - JoyAxisList axis; + JoyAxis axis; JoyAxisRange range; } axis; @@ -220,8 +220,8 @@ class Input : public Object { JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, int p_button); JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, int p_axis, float p_value); void _get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[HAT_MAX]); - JoyButtonList _get_output_button(String output); - JoyAxisList _get_output_axis(String output); + JoyButton _get_output_button(String output); + JoyAxis _get_output_axis(String output); void _button_event(int p_device, int p_index, bool p_pressed); void _axis_event(int p_device, int p_axis, float p_value); @@ -325,7 +325,7 @@ class Input : public Object { void parse_mapping(String p_mapping); void joy_button(int p_device, int p_button, bool p_pressed); - void joy_axis(int p_device, int p_axis, const JoyAxis &p_value); + void joy_axis(int p_device, int p_axis, const JoyAxisValue &p_value); void joy_hat(int p_device, int p_val); void add_joy_mapping(String p_mapping, bool p_update_existing = false); diff --git a/core/input/input_event.h b/core/input/input_event.h index 42bfdd340ee9..a1e7df59690f 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -59,7 +59,7 @@ enum MouseButton { MOUSE_BUTTON_MASK_XBUTTON2 = (1 << (MOUSE_BUTTON_XBUTTON2 - 1)) }; -enum JoyButtonList { +enum JoyButton { JOY_BUTTON_INVALID = -1, JOY_BUTTON_A = 0, JOY_BUTTON_B = 1, @@ -86,7 +86,7 @@ enum JoyButtonList { JOY_BUTTON_MAX = 36, // Android supports up to 36 buttons. }; -enum JoyAxisList { +enum JoyAxis { JOY_AXIS_INVALID = -1, JOY_AXIS_LEFT_X = 0, JOY_AXIS_LEFT_Y = 1, @@ -98,7 +98,7 @@ enum JoyAxisList { JOY_AXIS_MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes. }; -enum MidiMessageList { +enum MIDIMessage { MIDI_MESSAGE_NOTE_OFF = 0x8, MIDI_MESSAGE_NOTE_ON = 0x9, MIDI_MESSAGE_AFTERTOUCH = 0xA, diff --git a/core/os/keyboard.h b/core/os/keyboard.h index 3ef70e786f21..f6fe5fc070d0 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -45,7 +45,7 @@ enum { SPKEY = (1 << 24) }; -enum KeyList { +enum Key { /* CURSOR/FUNCTION/BROWSER/MULTIMEDIA/MISC KEYS */ KEY_ESCAPE = SPKEY | 0x01, KEY_TAB = SPKEY | 0x02, diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index cc6cd8a6621a..25f8f22d440d 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1308,730 +1308,730 @@ Keycodes with this bit applied are non-printable. - + Escape key. - + Tab key. - + Shift + Tab key. - + Backspace key. - + Return key (on the main keyboard). - + Enter key on the numeric keypad. - + Insert key. - + Delete key. - + Pause key. - + Print Screen key. - + System Request key. - + Clear key. - + Home key. - + End key. - + Left arrow key. - + Up arrow key. - + Right arrow key. - + Down arrow key. - + Page Up key. - + Page Down key. - + Shift key. - + Control key. - + Meta key. - + Alt key. - + Caps Lock key. - + Num Lock key. - + Scroll Lock key. - + F1 key. - + F2 key. - + F3 key. - + F4 key. - + F5 key. - + F6 key. - + F7 key. - + F8 key. - + F9 key. - + F10 key. - + F11 key. - + F12 key. - + F13 key. - + F14 key. - + F15 key. - + F16 key. - + Multiply (*) key on the numeric keypad. - + Divide (/) key on the numeric keypad. - + Subtract (-) key on the numeric keypad. - + Period (.) key on the numeric keypad. - + Add (+) key on the numeric keypad. - + Number 0 on the numeric keypad. - + Number 1 on the numeric keypad. - + Number 2 on the numeric keypad. - + Number 3 on the numeric keypad. - + Number 4 on the numeric keypad. - + Number 5 on the numeric keypad. - + Number 6 on the numeric keypad. - + Number 7 on the numeric keypad. - + Number 8 on the numeric keypad. - + Number 9 on the numeric keypad. - + Left Super key (Windows key). - + Right Super key (Windows key). - + Context menu key. - + Left Hyper key. - + Right Hyper key. - + Help key. - + Left Direction key. - + Right Direction key. - + Media back key. Not to be confused with the Back button on an Android device. - + Media forward key. - + Media stop key. - + Media refresh key. - + Volume down key. - + Mute volume key. - + Volume up key. - + Bass Boost key. - + Bass up key. - + Bass down key. - + Treble up key. - + Treble down key. - + Media play key. - + Media stop key. - + Previous song key. - + Next song key. - + Media record key. - + Home page key. - + Favorites key. - + Search key. - + Standby key. - + Open URL / Launch Browser key. - + Launch Mail key. - + Launch Media key. - + Launch Shortcut 0 key. - + Launch Shortcut 1 key. - + Launch Shortcut 2 key. - + Launch Shortcut 3 key. - + Launch Shortcut 4 key. - + Launch Shortcut 5 key. - + Launch Shortcut 6 key. - + Launch Shortcut 7 key. - + Launch Shortcut 8 key. - + Launch Shortcut 9 key. - + Launch Shortcut A key. - + Launch Shortcut B key. - + Launch Shortcut C key. - + Launch Shortcut D key. - + Launch Shortcut E key. - + Launch Shortcut F key. - + Unknown key. - + Space key. - + ! key. - + " key. - + # key. - + $ key. - + % key. - + & key. - + ' key. - + ( key. - + ) key. - + * key. - + + key. - + , key. - + - key. - + . key. - + / key. - + Number 0. - + Number 1. - + Number 2. - + Number 3. - + Number 4. - + Number 5. - + Number 6. - + Number 7. - + Number 8. - + Number 9. - + : key. - + ; key. - + < key. - + = key. - + > key. - + ? key. - + @ key. - + A key. - + B key. - + C key. - + D key. - + E key. - + F key. - + G key. - + H key. - + I key. - + J key. - + K key. - + L key. - + M key. - + N key. - + O key. - + P key. - + Q key. - + R key. - + S key. - + T key. - + U key. - + V key. - + W key. - + X key. - + Y key. - + Z key. - + [ key. - + \ key. - + ] key. - + ^ key. - + _ key. - + ` key. - + { key. - + | key. - + } key. - + ~ key. - + Non-breakable space key. - + ¡ key. - + ¢ key. - + £ key. - + ¤ key. - + ¥ key. - + ¦ key. - + § key. - + ¨ key. - + © key. - + ª key. - + « key. - + ¬ key. - + Soft hyphen key. - + ® key. - + ¯ key. - + ° key. - + ± key. - + ² key. - + ³ key. - + ´ key. - + µ key. - + ¶ key. - + · key. - + ¸ key. - + ¹ key. - + º key. - + » key. - + ¼ key. - + ½ key. - + ¾ key. - + ¿ key. - + À key. - + Á key. - + Â key. - + Ã key. - + Ä key. - + Å key. - + Æ key. - + Ç key. - + È key. - + É key. - + Ê key. - + Ë key. - + Ì key. - + Í key. - + Î key. - + Ï key. - + Ð key. - + Ñ key. - + Ò key. - + Ó key. - + Ô key. - + Õ key. - + Ö key. - + × key. - + Ø key. - + Ù key. - + Ú key. - + Û key. - + Ü key. - + Ý key. - + Þ key. - + ß key. - + ÷ key. - + ÿ key. @@ -2061,166 +2061,166 @@ Group Switch key mask. - + Left mouse button. - + Right mouse button. - + Middle mouse button. - + Extra mouse button 1 (only present on some mice). - + Extra mouse button 2 (only present on some mice). - + Mouse wheel up. - + Mouse wheel down. - + Mouse wheel left button (only present on some mice). - + Mouse wheel right button (only present on some mice). - + Left mouse button mask. - + Right mouse button mask. - + Middle mouse button mask. - + Extra mouse button 1 mask. - + Extra mouse button 2 mask. - + An invalid game controller button. - + Game controller SDL button A. Corresponds to the bottom action button: Sony Cross, Xbox A, Nintendo B. - + Game controller SDL button B. Corresponds to the right action button: Sony Circle, Xbox B, Nintendo A. - + Game controller SDL button X. Corresponds to the left action button: Sony Square, Xbox X, Nintendo Y. - + Game controller SDL button Y. Corresponds to the top action button: Sony Triangle, Xbox Y, Nintendo X. - + Game controller SDL back button. Corresponds to the Sony Select, Xbox Back, Nintendo - button. - + Game controller SDL guide button. Corresponds to the Sony PS, Xbox Home button. - + Game controller SDL start button. Corresponds to the Nintendo + button. - + Game controller SDL left stick button. Corresponds to the Sony L3, Xbox L/LS button. - + Game controller SDL right stick button. Corresponds to the Sony R3, Xbox R/RS button. - + Game controller SDL left shoulder button. Corresponds to the Sony L1, Xbox LB button. - + Game controller SDL right shoulder button. Corresponds to the Sony R1, Xbox RB button. - + Game controller D-pad up button. - + Game controller D-pad down button. - + Game controller D-pad left button. - + Game controller D-pad right button. - + Game controller SDL miscellaneous button. Corresponds to Xbox share button, PS5 microphone button, Nintendo capture button. - + Game controller SDL paddle 1 button. - + Game controller SDL paddle 2 button. - + Game controller SDL paddle 3 button. - + Game controller SDL paddle 4 button. - + Game controller SDL touchpad button. - + The number of SDL game controller buttons. - + The maximum number of game controller buttons: Android supports up to 36 buttons. - + An invalid game controller axis. - + Game controller left joystick x-axis. - + Game controller left joystick y-axis. - + Game controller right joystick x-axis. - + Game controller right joystick y-axis. - + Game controller left trigger axis. - + Game controller right trigger axis. - + The number of SDL game controller axes. - + The maximum number of game controller axes: OpenVR supports up to 5 Joysticks making a total of 10 axes. - + MIDI note OFF message. - + MIDI note ON message. - + MIDI aftertouch message. - + MIDI control change message. - + MIDI program change message. - + MIDI channel pressure message. - + MIDI pitch bend message. diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 659d791ccf64..d7408cd0ff3a 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -126,7 +126,7 @@ - Returns the current value of the joypad axis at given index (see [enum JoyAxisList]). + Returns the current value of the joypad axis at given index (see [enum JoyAxis]). @@ -255,7 +255,7 @@ - Returns [code]true[/code] if you are pressing the joypad button (see [enum JoyButtonList]). + Returns [code]true[/code] if you are pressing the joypad button (see [enum JoyButton]). @@ -273,7 +273,7 @@ - Returns [code]true[/code] if you are pressing the key in the current keyboard layout. You can pass a [enum KeyList] constant. + Returns [code]true[/code] if you are pressing the key in the current keyboard layout. You can pass a [enum Key] constant. @@ -282,7 +282,7 @@ - Returns [code]true[/code] if you are pressing the mouse button specified with [enum ButtonList]. + Returns [code]true[/code] if you are pressing the mouse button specified with [enum MouseButton]. diff --git a/doc/classes/InputEventJoypadButton.xml b/doc/classes/InputEventJoypadButton.xml index 6ab4942f8568..b1f4836f6e1c 100644 --- a/doc/classes/InputEventJoypadButton.xml +++ b/doc/classes/InputEventJoypadButton.xml @@ -13,7 +13,7 @@ - Button identifier. One of the [enum JoyButtonList] button constants. + Button identifier. One of the [enum JoyButton] button constants. If [code]true[/code], the button's state is pressed. If [code]false[/code], the button's state is released. diff --git a/doc/classes/InputEventJoypadMotion.xml b/doc/classes/InputEventJoypadMotion.xml index 2d7787b56836..39fdb14016c8 100644 --- a/doc/classes/InputEventJoypadMotion.xml +++ b/doc/classes/InputEventJoypadMotion.xml @@ -13,7 +13,7 @@ - Axis identifier. Use one of the [enum JoyAxisList] axis constants. + Axis identifier. Use one of the [enum JoyAxis] axis constants. Current position of the joystick on the given axis. The value ranges from [code]-1.0[/code] to [code]1.0[/code]. A value of [code]0[/code] means the axis is in its resting position. diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml index fe91b9c13e48..9f2b8298230e 100644 --- a/doc/classes/InputEventKey.xml +++ b/doc/classes/InputEventKey.xml @@ -32,11 +32,11 @@ If [code]true[/code], the key was already pressed before this event. It means the user is holding the key down. - The key keycode, which corresponds to one of the [enum KeyList] constants. Represent key in the current keyboard layout. + The key keycode, which corresponds to one of the [enum Key] constants. Represent key in the current keyboard layout. To get a human-readable representation of the [InputEventKey], use [code]OS.get_keycode_string(event.keycode)[/code] where [code]event[/code] is the [InputEventKey]. - Key physical keycode, which corresponds to one of the [enum KeyList] constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard. + Key physical keycode, which corresponds to one of the [enum Key] constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard. To get a human-readable representation of the [InputEventKey], use [code]OS.get_keycode_string(event.keycode)[/code] where [code]event[/code] is the [InputEventKey]. diff --git a/doc/classes/InputEventMouse.xml b/doc/classes/InputEventMouse.xml index 31e82bbaeddd..e54c3224da06 100644 --- a/doc/classes/InputEventMouse.xml +++ b/doc/classes/InputEventMouse.xml @@ -13,7 +13,7 @@ - The mouse button mask identifier, one of or a bitwise combination of the [enum ButtonList] button masks. + The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks. The global mouse position relative to the current [Viewport] when used in [method Control._gui_input], otherwise is at 0,0. diff --git a/doc/classes/InputEventMouseButton.xml b/doc/classes/InputEventMouseButton.xml index d7b64a9a2da0..d7e92f8bca66 100644 --- a/doc/classes/InputEventMouseButton.xml +++ b/doc/classes/InputEventMouseButton.xml @@ -13,7 +13,7 @@ - The mouse button identifier, one of the [enum ButtonList] button or button wheel constants. + The mouse button identifier, one of the [enum MouseButton] button or button wheel constants. If [code]true[/code], the mouse button's state is a double-click. diff --git a/doc/classes/XRController3D.xml b/doc/classes/XRController3D.xml index a4a86cc22a23..5d8c23bd6f7a 100644 --- a/doc/classes/XRController3D.xml +++ b/doc/classes/XRController3D.xml @@ -62,7 +62,7 @@ - Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoyButtonList]. + Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoyButton]. diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index 4cd89924ee3e..d14b0d9b1f6b 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -25583,7 +25583,7 @@ msgstr "" #: doc/classes/Input.xml:99 msgid "" "Returns the current value of the joypad axis at given index (see [enum " -"JoyAxisList])." +"JoyAxis])." msgstr "" #: doc/classes/Input.xml:108 @@ -25592,7 +25592,7 @@ msgstr "" #: doc/classes/Input.xml:117 msgid "" -"Receives a [enum JoyAxisList] axis and returns its equivalent name as a " +"Receives a [enum JoyAxis] axis and returns its equivalent name as a " "string." msgstr "" @@ -25602,7 +25602,7 @@ msgstr "" #: doc/classes/Input.xml:135 msgid "" -"Receives a gamepad button from [enum JoyButtonList] and returns its " +"Receives a gamepad button from [enum JoyButton] and returns its " "equivalent name as a string." msgstr "" @@ -25677,7 +25677,7 @@ msgstr "" #: doc/classes/Input.xml:238 msgid "" "Returns [code]true[/code] if you are pressing the joypad button (see [enum " -"JoyButtonList])." +"JoyButton])." msgstr "" #: doc/classes/Input.xml:247 @@ -26077,7 +26077,7 @@ msgid "" msgstr "" #: doc/classes/InputEventJoypadButton.xml:16 -msgid "Button identifier. One of the [enum JoyButtonList] button constants." +msgid "Button identifier. One of the [enum JoyButton] button constants." msgstr "" #: doc/classes/InputEventJoypadButton.xml:19 @@ -26105,7 +26105,7 @@ msgid "" msgstr "" #: doc/classes/InputEventJoypadMotion.xml:16 -msgid "Axis identifier. Use one of the [enum JoyAxisList] axis constants." +msgid "Axis identifier. Use one of the [enum JoyAxis] axis constants." msgstr "" #: doc/classes/InputEventJoypadMotion.xml:19 @@ -60259,7 +60259,7 @@ msgstr "" #: doc/classes/XRController3D.xml:65 msgid "" "Returns [code]true[/code] if the button at index [code]button[/code] is " -"pressed. See [enum JoyButtonList]." +"pressed. See [enum JoyButton]." msgstr "" #: doc/classes/XRController3D.xml:71 diff --git a/doc/translations/fr.po b/doc/translations/fr.po index c4fe08e67ba5..f3e26ebc612f 100644 --- a/doc/translations/fr.po +++ b/doc/translations/fr.po @@ -25946,7 +25946,7 @@ msgstr "" #: doc/classes/Input.xml:99 msgid "" "Returns the current value of the joypad axis at given index (see [enum " -"JoyAxisList])." +"JoyAxis])." msgstr "" #: doc/classes/Input.xml:108 @@ -25955,7 +25955,7 @@ msgstr "" #: doc/classes/Input.xml:117 msgid "" -"Receives a [enum JoyAxisList] axis and returns its equivalent name as a " +"Receives a [enum JoyAxis] axis and returns its equivalent name as a " "string." msgstr "" @@ -25965,7 +25965,7 @@ msgstr "" #: doc/classes/Input.xml:135 msgid "" -"Receives a gamepad button from [enum JoyButtonList] and returns its " +"Receives a gamepad button from [enum JoyButton] and returns its " "equivalent name as a string." msgstr "" @@ -26041,7 +26041,7 @@ msgstr "" #, fuzzy msgid "" "Returns [code]true[/code] if you are pressing the joypad button (see [enum " -"JoyButtonList])." +"JoyButton])." msgstr "" "Retourne [code]true[/code] (vrai) si la chaîne de caractères finit par la " "chaîne de caractères donnée." @@ -26443,7 +26443,7 @@ msgid "" msgstr "" #: doc/classes/InputEventJoypadButton.xml:16 -msgid "Button identifier. One of the [enum JoyButtonList] button constants." +msgid "Button identifier. One of the [enum JoyButton] button constants." msgstr "" #: doc/classes/InputEventJoypadButton.xml:19 @@ -26471,7 +26471,7 @@ msgid "" msgstr "" #: doc/classes/InputEventJoypadMotion.xml:16 -msgid "Axis identifier. Use one of the [enum JoyAxisList] axis constants." +msgid "Axis identifier. Use one of the [enum JoyAxis] axis constants." msgstr "" #: doc/classes/InputEventJoypadMotion.xml:19 @@ -60738,7 +60738,7 @@ msgstr "" #, fuzzy msgid "" "Returns [code]true[/code] if the button at index [code]button[/code] is " -"pressed. See [enum JoyButtonList]." +"pressed. See [enum JoyButton]." msgstr "" "Renvoie [code]true[/code] (vrai) si [code]s[/code] vaut zéro ou quasiment " "zéro." diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp index 5bbf70174c69..1d5a9d98f8e9 100644 --- a/modules/gdnative/xr/xr_interface_gdnative.cpp +++ b/modules/gdnative/xr/xr_interface_gdnative.cpp @@ -398,7 +398,7 @@ void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_a if (tracker != nullptr) { int joyid = tracker->get_joy_id(); if (joyid != -1) { - Input::JoyAxis jx; + Input::JoyAxisValue jx; jx.min = p_can_be_negative ? -1 : 0; jx.value = p_value; input->joy_axis(joyid, p_axis, jx); diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 74789fc98e60..10076327e2c0 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -416,7 +416,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) { int *axes = godot_webxr_get_controller_axes(p_controller_id); if (axes) { for (int i = 0; i < axes[0]; i++) { - Input::JoyAxis joy_axis; + Input::JoyAxisValue joy_axis; joy_axis.min = -1; joy_axis.value = *((float *)axes + (i + 1)); input->joy_axis(p_controller_id + 100, i, joy_axis); diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index ab28afe95063..dd001baba980 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -477,7 +477,7 @@ void DisplayServerAndroid::process_joy_event(DisplayServerAndroid::JoypadEvent p Input::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed); break; case JOY_EVENT_AXIS: - Input::JoyAxis value; + Input::JoyAxisValue value; value.min = -1; value.value = p_event.value; Input::get_singleton()->joy_axis(p_event.device, p_event.index, value); diff --git a/platform/iphone/joypad_iphone.mm b/platform/iphone/joypad_iphone.mm index a0f0eee5d386..45842b38aac7 100644 --- a/platform/iphone/joypad_iphone.mm +++ b/platform/iphone/joypad_iphone.mm @@ -287,7 +287,7 @@ - (void)setControllerInputHandler:(GCController *)controller { gamepad.dpad.right.isPressed); }; - Input::JoyAxis jx; + Input::JoyAxisValue jx; jx.min = -1; if (element == gamepad.leftThumbstick) { jx.value = gamepad.leftThumbstick.xAxis.value; diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index ff8ac825386f..c10fb40ecbcc 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -601,7 +601,7 @@ void DisplayServerJavaScript::process_joypads() { // Buttons 6 and 7 in the standard mapping need to be // axis to be handled as JOY_AXIS_TRIGGER by Godot. if (s_standard && (b == 6 || b == 7)) { - Input::JoyAxis joy_axis; + Input::JoyAxisValue joy_axis; joy_axis.min = 0; joy_axis.value = value; int a = b == 6 ? JOY_AXIS_TRIGGER_LEFT : JOY_AXIS_TRIGGER_RIGHT; @@ -611,7 +611,7 @@ void DisplayServerJavaScript::process_joypads() { } } for (int a = 0; a < s_axes_num; a++) { - Input::JoyAxis joy_axis; + Input::JoyAxisValue joy_axis; joy_axis.min = -1; joy_axis.value = s_axes[a]; input->joy_axis(idx, a, joy_axis); diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 471259e50f26..8ea0f6c2465e 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -62,7 +62,7 @@ void JoypadLinux::Joypad::reset() { dpad = 0; fd = -1; - Input::JoyAxis jx; + Input::JoyAxisValue jx; jx.min = -1; jx.value = 0.0f; for (int i = 0; i < MAX_ABS; i++) { @@ -428,10 +428,10 @@ void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp) { joy.ff_effect_timestamp = p_timestamp; } -Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const { +Input::JoyAxisValue JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const { int min = p_abs->minimum; int max = p_abs->maximum; - Input::JoyAxis jx; + Input::JoyAxisValue jx; if (min < 0) { jx.min = -1; @@ -513,7 +513,7 @@ void JoypadLinux::process_joypads() { return; } if (joy->abs_map[ev.code] != -1 && joy->abs_info[ev.code]) { - Input::JoyAxis value = axis_correct(joy->abs_info[ev.code], ev.value); + Input::JoyAxisValue value = axis_correct(joy->abs_info[ev.code], ev.value); joy->curr_axis[joy->abs_map[ev.code]] = value; } break; diff --git a/platform/linuxbsd/joypad_linux.h b/platform/linuxbsd/joypad_linux.h index b0d0db047b21..177d7a51ce79 100644 --- a/platform/linuxbsd/joypad_linux.h +++ b/platform/linuxbsd/joypad_linux.h @@ -53,7 +53,7 @@ class JoypadLinux { }; struct Joypad { - Input::JoyAxis curr_axis[MAX_ABS]; + Input::JoyAxisValue curr_axis[MAX_ABS]; int key_map[MAX_KEY]; int abs_map[MAX_ABS]; int dpad = 0; @@ -97,7 +97,7 @@ class JoypadLinux { void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop(int p_id, uint64_t p_timestamp); - Input::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const; + Input::JoyAxisValue axis_correct(const input_absinfo *p_abs, int p_value) const; }; #endif diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 0b6a0e20a60c..b12526915f8e 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -433,8 +433,8 @@ void JoypadOSX::poll_joypads() const { } } -static const Input::JoyAxis axis_correct(int p_value, int p_min, int p_max) { - Input::JoyAxis jx; +static const Input::JoyAxisValue axis_correct(int p_value, int p_min, int p_max) { + Input::JoyAxisValue jx; if (p_min < 0) { jx.min = -1; if (p_value < 0) { diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index 5da90db49d02..b419fb4faebc 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -134,8 +134,8 @@ void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Inp input->joy_connection_changed(idx, false, "Xbox Controller"); } -InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const { - InputDefault::JoyAxis jx; +InputDefault::JoyAxisValue JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const { + InputDefault::JoyAxisValue jx; jx.min = p_trigger ? 0 : -1; jx.value = (float)(p_negate ? -p_val : p_val); diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 5df4a211ac88..d760d9e2fec2 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -73,7 +73,7 @@ ref class JoypadUWP sealed { void OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value); void OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value); - InputDefault::JoyAxis axis_correct(double p_val, bool p_negate = false, bool p_trigger = false) const; + InputDefault::JoyAxisValue axis_correct(double p_val, bool p_negate = false, bool p_trigger = false) const; void joypad_vibration_start(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop(int p_device, uint64_t p_timestamp); }; diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index b8679a87feb7..da36dc1f2b92 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -446,8 +446,8 @@ void JoypadWindows::post_hat(int p_device, DWORD p_dpad) { input->joy_hat(p_device, dpad_val); }; -Input::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const { - Input::JoyAxis jx; +Input::JoyAxisValue JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const { + Input::JoyAxisValue jx; if (Math::abs(p_val) < MIN_JOY_AXIS) { jx.min = p_trigger ? 0 : -1; jx.value = 0.0f; diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h index 4727b4a14c4b..757fb54fb3f7 100644 --- a/platform/windows/joypad_windows.h +++ b/platform/windows/joypad_windows.h @@ -132,7 +132,7 @@ class JoypadWindows { void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp); - Input::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const; + Input::JoyAxisValue axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const; XInputGetState_t xinput_get_state; XInputSetState_t xinput_set_state; };