@@ -646,6 +646,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
646646
647647 Ref<InputEventKey> k = p_event;
648648 if (k.is_valid () && k->is_pressed () && !k->is_echo ()) {
649+ // Transform mode (toggle button):
649650 // If we are in Transform mode we pass the events to the 3D editor,
650651 // but if the Transform mode shortcut is pressed again, we go back to Selection mode.
651652 if (mode_buttons_group->get_pressed_button () == transform_mode_button) {
@@ -656,7 +657,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
656657 }
657658 return EditorPlugin::AFTER_GUI_INPUT_PASS;
658659 }
659-
660+ // Tool modes and tool actions:
660661 for (BaseButton *b : viewport_shortcut_buttons) {
661662 if (b->is_disabled ()) {
662663 continue ;
@@ -673,9 +674,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
673674 return EditorPlugin::AFTER_GUI_INPUT_STOP;
674675 }
675676 }
676- }
677-
678- if (k.is_valid () && k->is_pressed () && !k->is_echo ()) {
677+ // Hard key actions:
679678 if (k->get_keycode () == Key::ESCAPE) {
680679 if (input_action == INPUT_PASTE) {
681680 _clear_clipboard_data ();
@@ -692,7 +691,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
692691 return EditorPlugin::AFTER_GUI_INPUT_STOP;
693692 }
694693 }
695-
694+ // Options menu shortcuts:
696695 Ref<Shortcut> ed_shortcut = ED_GET_SHORTCUT (" grid_map/previous_floor" );
697696 if (ed_shortcut.is_valid () && ed_shortcut->matches_event (p_event)) {
698697 accept_event ();
@@ -1396,27 +1395,31 @@ GridMapEditor::GridMapEditor() {
13961395 fill_action_button->connect (SceneStringName (pressed),
13971396 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_SELECTION_FILL));
13981397 action_buttons->add_child (fill_action_button);
1398+ viewport_shortcut_buttons.push_back (fill_action_button);
13991399
14001400 move_action_button = memnew (Button);
14011401 move_action_button->set_theme_type_variation (" FlatButton" );
14021402 move_action_button->set_shortcut (ED_SHORTCUT (" grid_map/move_tool" , TTR (" Move" ), Key::X, true ));
14031403 move_action_button->connect (SceneStringName (pressed),
14041404 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_SELECTION_CUT));
14051405 action_buttons->add_child (move_action_button);
1406+ viewport_shortcut_buttons.push_back (move_action_button);
14061407
14071408 duplicate_action_button = memnew (Button);
14081409 duplicate_action_button->set_theme_type_variation (" FlatButton" );
14091410 duplicate_action_button->set_shortcut (ED_SHORTCUT (" grid_map/duplicate_tool" , TTR (" Duplicate" ), Key::C, true ));
14101411 duplicate_action_button->connect (SceneStringName (pressed),
14111412 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_SELECTION_DUPLICATE));
14121413 action_buttons->add_child (duplicate_action_button);
1414+ viewport_shortcut_buttons.push_back (duplicate_action_button);
14131415
14141416 delete_action_button = memnew (Button);
14151417 delete_action_button->set_theme_type_variation (" FlatButton" );
14161418 delete_action_button->set_shortcut (ED_SHORTCUT (" grid_map/delete_tool" , TTR (" Delete" ), Key::V, true ));
14171419 delete_action_button->connect (SceneStringName (pressed),
14181420 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_SELECTION_CLEAR));
14191421 action_buttons->add_child (delete_action_button);
1422+ viewport_shortcut_buttons.push_back (delete_action_button);
14201423
14211424 vsep = memnew (VSeparator);
14221425 toolbar->add_child (vsep);
@@ -1430,20 +1433,23 @@ GridMapEditor::GridMapEditor() {
14301433 rotate_x_button->connect (SceneStringName (pressed),
14311434 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_CURSOR_ROTATE_X));
14321435 rotation_buttons->add_child (rotate_x_button);
1436+ viewport_shortcut_buttons.push_back (rotate_x_button);
14331437
14341438 rotate_y_button = memnew (Button);
14351439 rotate_y_button->set_theme_type_variation (" FlatButton" );
14361440 rotate_y_button->set_shortcut (ED_SHORTCUT (" grid_map/cursor_rotate_y" , TTR (" Cursor Rotate Y" ), Key::S, true ));
14371441 rotate_y_button->connect (SceneStringName (pressed),
14381442 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_CURSOR_ROTATE_Y));
14391443 rotation_buttons->add_child (rotate_y_button);
1444+ viewport_shortcut_buttons.push_back (rotate_y_button);
14401445
14411446 rotate_z_button = memnew (Button);
14421447 rotate_z_button->set_theme_type_variation (" FlatButton" );
14431448 rotate_z_button->set_shortcut (ED_SHORTCUT (" grid_map/cursor_rotate_z" , TTR (" Cursor Rotate Z" ), Key::D, true ));
14441449 rotate_z_button->connect (SceneStringName (pressed),
14451450 callable_mp (this , &GridMapEditor::_menu_option).bind (MENU_OPTION_CURSOR_ROTATE_Z));
14461451 rotation_buttons->add_child (rotate_z_button);
1452+ viewport_shortcut_buttons.push_back (rotate_z_button);
14471453
14481454 // Wide empty separation control. (like BoxContainer::add_spacer())
14491455 Control *c = memnew (Control);
0 commit comments