Add button to clear rotation in the GridMap editor

This commit is contained in:
Michael Alexsander
2026-02-23 17:02:35 -03:00
parent 2327a82357
commit 0c83b58b36
2 changed files with 12 additions and 1 deletions
@@ -1227,6 +1227,7 @@ void GridMapEditor::_update_theme() {
rotate_x_button->set_button_icon(get_theme_icon(SNAME("RotateLeft"), EditorStringName(EditorIcons)));
rotate_y_button->set_button_icon(get_theme_icon(SNAME("ToolRotate"), EditorStringName(EditorIcons)));
rotate_z_button->set_button_icon(get_theme_icon(SNAME("RotateRight"), EditorStringName(EditorIcons)));
clear_rotation_button->set_button_icon(get_theme_icon(SNAME("UndoRedo"), EditorStringName(EditorIcons)));
mode_thumbnail->set_button_icon(get_theme_icon(SNAME("FileThumbnail"), EditorStringName(EditorIcons)));
mode_list->set_button_icon(get_theme_icon(SNAME("FileList"), EditorStringName(EditorIcons)));
options->set_button_icon(get_theme_icon(SNAME("Tools"), EditorStringName(EditorIcons)));
@@ -1408,7 +1409,7 @@ GridMapEditor::GridMapEditor() {
ED_SHORTCUT("grid_map/edit_y_axis", TTRC("Edit Y Axis"), KeyModifierMask::SHIFT + Key::X, true);
ED_SHORTCUT("grid_map/edit_z_axis", TTRC("Edit Z Axis"), KeyModifierMask::SHIFT + Key::C, true);
ED_SHORTCUT("grid_map/keep_selected", TTRC("Keep Selection"));
ED_SHORTCUT("grid_map/clear_rotation", TTRC("Clear Rotation"));
ED_SHORTCUT("grid_map/clear_rotation", TTRC("Clear Rotation"), KeyModifierMask::ALT | Key::G, true);
options = memnew(MenuButton);
options->set_theme_type_variation(SceneStringName(FlatButton));
@@ -1587,6 +1588,15 @@ GridMapEditor::GridMapEditor() {
rotation_buttons->add_child(rotate_z_button);
viewport_shortcut_buttons.push_back(rotate_z_button);
clear_rotation_button = memnew(Button);
clear_rotation_button->set_theme_type_variation(SceneStringName(FlatButton));
clear_rotation_button->set_shortcut(ED_GET_SHORTCUT("grid_map/clear_rotation"));
clear_rotation_button->set_accessibility_name(TTRC("Cursor Reset Rotation"));
clear_rotation_button->connect(SceneStringName(pressed),
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_CURSOR_CLEAR_ROTATION));
rotation_buttons->add_child(clear_rotation_button);
viewport_shortcut_buttons.push_back(clear_rotation_button);
// Wide empty separation control. (like BoxContainer::add_spacer())
Control *c = memnew(Control);
c->set_mouse_filter(MOUSE_FILTER_PASS);