diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-16 15:25:47 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-16 15:25:47 +0200 |
commit | ab55a40f0c6617f0233a761588ae04cd19dd7aa4 (patch) | |
tree | 9fe7795b7947e9a8b44d851a2eeb9d111ddac2f1 | |
parent | 964a9ec03ba1507806a2d271e2fc2af8b9983ab1 (diff) | |
parent | d805f38dba16808475fe827f0babec9a9cc4d601 (diff) | |
download | redot-engine-ab55a40f0c6617f0233a761588ae04cd19dd7aa4.tar.gz |
Merge pull request #97070 from KoBeWi/snaming_ur_inputs
Use `SNAME` for `ui` actions in Viewport
-rw-r--r-- | scene/main/viewport.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f6e9ceb0cc..a4e27a3d16 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2086,13 +2086,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } if (mm.is_null() && mb.is_null() && p_event->is_action_type()) { - if (gui.dragging && p_event->is_action_pressed("ui_cancel") && Input::get_singleton()->is_action_just_pressed("ui_cancel")) { + if (gui.dragging && p_event->is_action_pressed(SNAME("ui_cancel")) && Input::get_singleton()->is_action_just_pressed(SNAME("ui_cancel"))) { _perform_drop(); set_input_as_handled(); return; } - if (p_event->is_action_pressed("ui_cancel")) { + if (p_event->is_action_pressed(SNAME("ui_cancel"))) { // Cancel tooltip timer or hide tooltip when pressing Escape (this is standard behavior in most applications). _gui_cancel_tooltip(); if (gui.tooltip_popup) { @@ -2127,51 +2127,51 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (joypadmotion_event.is_valid()) { Input *input = Input::get_singleton(); - if (p_event->is_action_pressed("ui_focus_next") && input->is_action_just_pressed("ui_focus_next")) { + if (p_event->is_action_pressed(SNAME("ui_focus_next")) && input->is_action_just_pressed(SNAME("ui_focus_next"))) { next = from->find_next_valid_focus(); } - if (p_event->is_action_pressed("ui_focus_prev") && input->is_action_just_pressed("ui_focus_prev")) { + if (p_event->is_action_pressed(SNAME("ui_focus_prev")) && input->is_action_just_pressed(SNAME("ui_focus_prev"))) { next = from->find_prev_valid_focus(); } - if (p_event->is_action_pressed("ui_up") && input->is_action_just_pressed("ui_up")) { + if (p_event->is_action_pressed(SNAME("ui_up")) && input->is_action_just_pressed(SNAME("ui_up"))) { next = from->_get_focus_neighbor(SIDE_TOP); } - if (p_event->is_action_pressed("ui_left") && input->is_action_just_pressed("ui_left")) { + if (p_event->is_action_pressed(SNAME("ui_left")) && input->is_action_just_pressed(SNAME("ui_left"))) { next = from->_get_focus_neighbor(SIDE_LEFT); } - if (p_event->is_action_pressed("ui_right") && input->is_action_just_pressed("ui_right")) { + if (p_event->is_action_pressed(SNAME("ui_right")) && input->is_action_just_pressed(SNAME("ui_right"))) { next = from->_get_focus_neighbor(SIDE_RIGHT); } - if (p_event->is_action_pressed("ui_down") && input->is_action_just_pressed("ui_down")) { + if (p_event->is_action_pressed(SNAME("ui_down")) && input->is_action_just_pressed(SNAME("ui_down"))) { next = from->_get_focus_neighbor(SIDE_BOTTOM); } } else { - if (p_event->is_action_pressed("ui_focus_next", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_focus_next"), true, true)) { next = from->find_next_valid_focus(); } - if (p_event->is_action_pressed("ui_focus_prev", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_focus_prev"), true, true)) { next = from->find_prev_valid_focus(); } - if (p_event->is_action_pressed("ui_up", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_up"), true, true)) { next = from->_get_focus_neighbor(SIDE_TOP); } - if (p_event->is_action_pressed("ui_left", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_left"), true, true)) { next = from->_get_focus_neighbor(SIDE_LEFT); } - if (p_event->is_action_pressed("ui_right", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_right"), true, true)) { next = from->_get_focus_neighbor(SIDE_RIGHT); } - if (p_event->is_action_pressed("ui_down", true, true)) { + if (p_event->is_action_pressed(SNAME("ui_down"), true, true)) { next = from->_get_focus_neighbor(SIDE_BOTTOM); } } |