Skip to content

Commit d805f38

Browse files
committed
Use SNAME for ui actions in Viewport
1 parent 6681f25 commit d805f38

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scene/main/viewport.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,13 +2185,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
21852185
}
21862186

21872187
if (mm.is_null() && mb.is_null() && p_event->is_action_type()) {
2188-
if (gui.dragging && p_event->is_action_pressed("ui_cancel") && Input::get_singleton()->is_action_just_pressed("ui_cancel")) {
2188+
if (gui.dragging && p_event->is_action_pressed(SNAME("ui_cancel")) && Input::get_singleton()->is_action_just_pressed(SNAME("ui_cancel"))) {
21892189
_perform_drop();
21902190
set_input_as_handled();
21912191
return;
21922192
}
21932193

2194-
if (p_event->is_action_pressed("ui_cancel")) {
2194+
if (p_event->is_action_pressed(SNAME("ui_cancel"))) {
21952195
// Cancel tooltip timer or hide tooltip when pressing Escape (this is standard behavior in most applications).
21962196
_gui_cancel_tooltip();
21972197
if (gui.tooltip_popup) {
@@ -2228,51 +2228,51 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
22282228
if (joypadmotion_event.is_valid()) {
22292229
Input *input = Input::get_singleton();
22302230

2231-
if (p_event->is_action_pressed("ui_focus_next") && input->is_action_just_pressed("ui_focus_next")) {
2231+
if (p_event->is_action_pressed(SNAME("ui_focus_next")) && input->is_action_just_pressed(SNAME("ui_focus_next"))) {
22322232
next = from->find_next_valid_focus();
22332233
}
22342234

2235-
if (p_event->is_action_pressed("ui_focus_prev") && input->is_action_just_pressed("ui_focus_prev")) {
2235+
if (p_event->is_action_pressed(SNAME("ui_focus_prev")) && input->is_action_just_pressed(SNAME("ui_focus_prev"))) {
22362236
next = from->find_prev_valid_focus();
22372237
}
22382238

2239-
if (p_event->is_action_pressed("ui_up") && input->is_action_just_pressed("ui_up")) {
2239+
if (p_event->is_action_pressed(SNAME("ui_up")) && input->is_action_just_pressed(SNAME("ui_up"))) {
22402240
next = from->_get_focus_neighbor(SIDE_TOP);
22412241
}
22422242

2243-
if (p_event->is_action_pressed("ui_left") && input->is_action_just_pressed("ui_left")) {
2243+
if (p_event->is_action_pressed(SNAME("ui_left")) && input->is_action_just_pressed(SNAME("ui_left"))) {
22442244
next = from->_get_focus_neighbor(SIDE_LEFT);
22452245
}
22462246

2247-
if (p_event->is_action_pressed("ui_right") && input->is_action_just_pressed("ui_right")) {
2247+
if (p_event->is_action_pressed(SNAME("ui_right")) && input->is_action_just_pressed(SNAME("ui_right"))) {
22482248
next = from->_get_focus_neighbor(SIDE_RIGHT);
22492249
}
22502250

2251-
if (p_event->is_action_pressed("ui_down") && input->is_action_just_pressed("ui_down")) {
2251+
if (p_event->is_action_pressed(SNAME("ui_down")) && input->is_action_just_pressed(SNAME("ui_down"))) {
22522252
next = from->_get_focus_neighbor(SIDE_BOTTOM);
22532253
}
22542254
} else {
2255-
if (p_event->is_action_pressed("ui_focus_next", true, true)) {
2255+
if (p_event->is_action_pressed(SNAME("ui_focus_next"), true, true)) {
22562256
next = from->find_next_valid_focus();
22572257
}
22582258

2259-
if (p_event->is_action_pressed("ui_focus_prev", true, true)) {
2259+
if (p_event->is_action_pressed(SNAME("ui_focus_prev"), true, true)) {
22602260
next = from->find_prev_valid_focus();
22612261
}
22622262

2263-
if (p_event->is_action_pressed("ui_up", true, true)) {
2263+
if (p_event->is_action_pressed(SNAME("ui_up"), true, true)) {
22642264
next = from->_get_focus_neighbor(SIDE_TOP);
22652265
}
22662266

2267-
if (p_event->is_action_pressed("ui_left", true, true)) {
2267+
if (p_event->is_action_pressed(SNAME("ui_left"), true, true)) {
22682268
next = from->_get_focus_neighbor(SIDE_LEFT);
22692269
}
22702270

2271-
if (p_event->is_action_pressed("ui_right", true, true)) {
2271+
if (p_event->is_action_pressed(SNAME("ui_right"), true, true)) {
22722272
next = from->_get_focus_neighbor(SIDE_RIGHT);
22732273
}
22742274

2275-
if (p_event->is_action_pressed("ui_down", true, true)) {
2275+
if (p_event->is_action_pressed(SNAME("ui_down"), true, true)) {
22762276
next = from->_get_focus_neighbor(SIDE_BOTTOM);
22772277
}
22782278
}

0 commit comments

Comments
 (0)