Godot Engine – Multi-platform 2D and 3D game engine
Clean and simplify `3D` toolbar
Jayden Sipef754d91d74d1
diff --git a/editor/scene/3d/node_3d_editor_plugin.cpp b/editor/scene/3d/node_3d_editor_plugin.cppindex f2a65f023e2..6bf710e4f43 100644--- a/editor/scene/3d/node_3d_editor_plugin.cpp+++ b/editor/scene/3d/node_3d_editor_plugin.cpp@@ -46,7 +46,9 @@#include "editor/editor_node.h"#include "editor/editor_string_names.h"#include "editor/editor_undo_redo_manager.h"+#include "editor/gui/editor_icon_manager.h"#include "editor/gui/editor_spin_slider.h"+#include "editor/gui/editor_toolbar_group.h"#include "editor/plugins/editor_plugin_list.h"#include "editor/run/editor_run_bar.h"#include "editor/scene/3d/gizmos/audio_listener_3d_gizmo_plugin.h"@@ -786,13 +788,13 @@ void Node3DEditor::_menu_gizmo_toggled(int p_option) {const int state = gizmos_menu->get_item_state(idx);switch (state) {case EditorNode3DGizmoPlugin::VISIBLE:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityVisible")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityVisible")));break;case EditorNode3DGizmoPlugin::ON_TOP:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityXray")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityXray")));break;case EditorNode3DGizmoPlugin::HIDDEN:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityHidden")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityHidden")));break;}@@ -1730,13 +1732,13 @@ void Node3DEditor::_update_gizmos_menu() {TTR("Click to toggle between visibility states.\n\nOpen eye: Gizmo is visible.\nClosed eye: Gizmo is hidden.\nHalf-open eye: Gizmo is also visible through opaque surfaces (\"x-ray\")."));switch (plugin_state) {case EditorNode3DGizmoPlugin::VISIBLE:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityVisible")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityVisible")));break;case EditorNode3DGizmoPlugin::ON_TOP:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityXray")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityXray")));break;case EditorNode3DGizmoPlugin::HIDDEN:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityHidden")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityHidden")));break;}}@@ -1751,13 +1753,13 @@ void Node3DEditor::_update_gizmos_menu_theme() {const int idx = gizmos_menu->get_item_index(i);switch (plugin_state) {case EditorNode3DGizmoPlugin::VISIBLE:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityVisible")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityVisible")));break;case EditorNode3DGizmoPlugin::ON_TOP:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityXray")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityXray")));break;case EditorNode3DGizmoPlugin::HIDDEN:- gizmos_menu->set_item_icon(idx, get_editor_theme_icon(SNAME("GuiVisibilityHidden")));+ gizmos_menu->set_item_icon(idx, EditorIconManager::get_icon(SNAME("GuiVisibilityHidden")));break;}}@@ -2543,34 +2545,6 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {}void Node3DEditor::_update_theme() {- tool_button[TOOL_MODE_TRANSFORM]->set_button_icon(get_editor_theme_icon(SNAME("ToolTransform")));- tool_button[TOOL_MODE_MOVE]->set_button_icon(get_editor_theme_icon(SNAME("ToolMove")));- tool_button[TOOL_MODE_ROTATE]->set_button_icon(get_editor_theme_icon(SNAME("ToolRotate")));- tool_button[TOOL_MODE_SCALE]->set_button_icon(get_editor_theme_icon(SNAME("ToolScale")));- tool_button[TOOL_MODE_SELECT]->set_button_icon(get_editor_theme_icon(SNAME("ToolSelect")));- tool_button[TOOL_MODE_LIST_SELECT]->set_button_icon(get_editor_theme_icon(SNAME("ListSelect")));- tool_button[TOOL_LOCK_SELECTED]->set_button_icon(get_editor_theme_icon(SNAME("Lock")));- tool_button[TOOL_UNLOCK_SELECTED]->set_button_icon(get_editor_theme_icon(SNAME("Unlock")));- tool_button[TOOL_GROUP_SELECTED]->set_button_icon(get_editor_theme_icon(SNAME("Group")));- tool_button[TOOL_UNGROUP_SELECTED]->set_button_icon(get_editor_theme_icon(SNAME("Ungroup")));- tool_button[TOOL_RULER]->set_button_icon(get_editor_theme_icon(SNAME("Ruler")));-- tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_button_icon(get_editor_theme_icon(SNAME("Object")));- tool_option_button[TOOL_OPT_USE_SNAP]->set_button_icon(get_editor_theme_icon(SNAME("Snap")));- tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_button_icon(get_editor_theme_icon(SNAME("Trackball")));- tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_button_icon(get_editor_theme_icon(SNAME("Pin")));-- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_editor_theme_icon(SNAME("Panels1")));- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_editor_theme_icon(SNAME("Panels2")));- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_editor_theme_icon(SNAME("Panels2Alt")));- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_editor_theme_icon(SNAME("Panels3")));- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_editor_theme_icon(SNAME("Panels3Alt")));- view_layout_menu->get_popup()->set_item_icon(view_layout_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_editor_theme_icon(SNAME("Panels4")));-- sun_button->set_button_icon(get_editor_theme_icon(SNAME("PreviewSun")));- environ_button->set_button_icon(get_editor_theme_icon(SNAME("PreviewEnvironment")));- sun_environ_settings->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));-sun_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));environ_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));@@ -3439,8 +3413,7 @@ Node3DEditor::Node3DEditor() {// Main toolbars.// Split into separate `HBoxContainer` so they can wrap onto multiple lines as the window width decreases (the parent is a `FlowContainer`).// These are not grouped by any particular criteria. Only some of the end children are grouped separately, based on their separators.- HBoxContainer *tool_button_hbox = memnew(HBoxContainer);- main_flow->add_child(tool_button_hbox);+ HBoxContainer *tool_button_hbox = EditorToolbarGroup::create(main_flow);tool_button[TOOL_MODE_TRANSFORM] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_TRANSFORM]);@@ -3451,6 +3424,7 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_TRANSFORM]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_transform", TTRC("Transform Mode"), Key::Q, true));tool_button[TOOL_MODE_TRANSFORM]->set_shortcut_context(this);tool_button[TOOL_MODE_TRANSFORM]->set_accessibility_name(TTRC("Transform Mode"));+ tool_button[TOOL_MODE_TRANSFORM]->set_button_icon(EditorIconManager::get_icon(SNAME("ToolTransform")));tool_button[TOOL_MODE_MOVE] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_MOVE]);@@ -3462,6 +3436,7 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTRC("Move Mode"), Key::W, true));tool_button[TOOL_MODE_MOVE]->set_shortcut_context(this);tool_button[TOOL_MODE_MOVE]->set_accessibility_name(TTRC("Move Mode"));+ tool_button[TOOL_MODE_MOVE]->set_button_icon(EditorIconManager::get_icon(SNAME("ToolMove")));tool_button[TOOL_MODE_ROTATE] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_ROTATE]);@@ -3472,6 +3447,7 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTRC("Rotate Mode"), Key::E, true));tool_button[TOOL_MODE_ROTATE]->set_shortcut_context(this);tool_button[TOOL_MODE_ROTATE]->set_accessibility_name(TTRC("Rotate Mode"));+ tool_button[TOOL_MODE_ROTATE]->set_button_icon(EditorIconManager::get_icon(SNAME("ToolRotate")));tool_button[TOOL_MODE_SCALE] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_SCALE]);@@ -3482,6 +3458,7 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTRC("Scale Mode"), Key::R, true));tool_button[TOOL_MODE_SCALE]->set_shortcut_context(this);tool_button[TOOL_MODE_SCALE]->set_accessibility_name(TTRC("Scale Mode"));+ tool_button[TOOL_MODE_SCALE]->set_button_icon(EditorIconManager::get_icon(SNAME("ToolScale")));tool_button[TOOL_MODE_SELECT] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_SELECT]);@@ -3492,8 +3469,11 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTRC("Select Mode"), Key::V, true));tool_button[TOOL_MODE_SELECT]->set_shortcut_context(this);tool_button[TOOL_MODE_SELECT]->set_accessibility_name(TTRC("Select Mode"));+ tool_button[TOOL_MODE_SELECT]->set_button_icon(EditorIconManager::get_icon(SNAME("ToolSelect")));- tool_button_hbox->add_child(memnew(VSeparator));+ VSeparator *vsep = memnew(VSeparator);+ vsep->set_theme_type_variation("VSeparatorButtonGroup");+ tool_button_hbox->add_child(vsep);tool_button[TOOL_MODE_LIST_SELECT] = memnew(Button);tool_button_hbox->add_child(tool_button[TOOL_MODE_LIST_SELECT]);@@ -3502,83 +3482,90 @@ Node3DEditor::Node3DEditor() {tool_button[TOOL_MODE_LIST_SELECT]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_LIST_SELECT));tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.") + "\n" + vformat(TTR("%s+RMB: Show list of all nodes at position clicked, including locked."), keycode_get_string((Key)KeyModifierMask::ALT)));tool_button[TOOL_MODE_LIST_SELECT]->set_accessibility_name(TTRC("Show List of Selectable Nodes"));+ tool_button[TOOL_MODE_LIST_SELECT]->set_button_icon(EditorIconManager::get_icon(SNAME("ListSelect")));++ tool_button[TOOL_RULER] = memnew(Button);+ tool_button_hbox->add_child(tool_button[TOOL_RULER]);+ tool_button[TOOL_RULER]->set_toggle_mode(true);+ tool_button[TOOL_RULER]->set_theme_type_variation(SceneStringName(FlatButton));+ tool_button[TOOL_RULER]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_RULER));+ // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.+ tool_button[TOOL_RULER]->set_shortcut(ED_SHORTCUT("spatial_editor/measure", TTRC("Ruler Mode"), Key::M));+ tool_button[TOOL_RULER]->set_accessibility_name(TTRC("Ruler Mode"));+ tool_button[TOOL_RULER]->set_button_icon(EditorIconManager::get_icon(SNAME("Ruler")));++ main_flow->add_child(memnew(VSeparator));++ HBoxContainer *lock_group_hbox = memnew(HBoxContainer);+ main_flow->add_child(lock_group_hbox);tool_button[TOOL_LOCK_SELECTED] = memnew(Button);- tool_button_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]);+ lock_group_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]);tool_button[TOOL_LOCK_SELECTED]->set_theme_type_variation(SceneStringName(FlatButton));tool_button[TOOL_LOCK_SELECTED]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_LOCK_SELECTED));tool_button[TOOL_LOCK_SELECTED]->set_tooltip_text(TTRC("Lock selected node, preventing selection and movement."));// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_GET_SHORTCUT("editor/lock_selected_nodes"));tool_button[TOOL_LOCK_SELECTED]->set_accessibility_name(TTRC("Lock"));+ tool_button[TOOL_LOCK_SELECTED]->set_button_icon(EditorIconManager::get_icon(SNAME("Lock")));tool_button[TOOL_UNLOCK_SELECTED] = memnew(Button);- tool_button_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]);+ lock_group_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]);tool_button[TOOL_UNLOCK_SELECTED]->set_theme_type_variation(SceneStringName(FlatButton));tool_button[TOOL_UNLOCK_SELECTED]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNLOCK_SELECTED));tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip_text(TTRC("Unlock selected node, allowing selection and movement."));// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_GET_SHORTCUT("editor/unlock_selected_nodes"));tool_button[TOOL_UNLOCK_SELECTED]->set_accessibility_name(TTRC("Unlock"));+ tool_button[TOOL_UNLOCK_SELECTED]->set_button_icon(EditorIconManager::get_icon(SNAME("Unlock")));tool_button[TOOL_GROUP_SELECTED] = memnew(Button);- tool_button_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]);+ lock_group_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]);tool_button[TOOL_GROUP_SELECTED]->set_theme_type_variation(SceneStringName(FlatButton));tool_button[TOOL_GROUP_SELECTED]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_GROUP_SELECTED));tool_button[TOOL_GROUP_SELECTED]->set_tooltip_text(TTRC("Groups the selected node with its children. This selects the parent when any child node is clicked in 2D and 3D view."));// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_GET_SHORTCUT("editor/group_selected_nodes"));tool_button[TOOL_GROUP_SELECTED]->set_accessibility_name(TTRC("Group"));+ tool_button[TOOL_GROUP_SELECTED]->set_button_icon(EditorIconManager::get_icon(SNAME("Group")));tool_button[TOOL_UNGROUP_SELECTED] = memnew(Button);- tool_button_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]);+ lock_group_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]);tool_button[TOOL_UNGROUP_SELECTED]->set_theme_type_variation(SceneStringName(FlatButton));tool_button[TOOL_UNGROUP_SELECTED]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNGROUP_SELECTED));tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip_text(TTRC("Ungroups the selected node from its children. Child nodes will be individual items in 2D and 3D view."));// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_GET_SHORTCUT("editor/ungroup_selected_nodes"));tool_button[TOOL_UNGROUP_SELECTED]->set_accessibility_name(TTRC("Ungroup"));+ tool_button[TOOL_UNGROUP_SELECTED]->set_button_icon(EditorIconManager::get_icon(SNAME("Ungroup")));- tool_button[TOOL_RULER] = memnew(Button);- tool_button_hbox->add_child(tool_button[TOOL_RULER]);- tool_button[TOOL_RULER]->set_toggle_mode(true);- tool_button[TOOL_RULER]->set_theme_type_variation("FlatButton");- tool_button[TOOL_RULER]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_RULER));- // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.- tool_button[TOOL_RULER]->set_shortcut(ED_SHORTCUT("spatial_editor/measure", TTRC("Ruler Mode"), Key::M));- tool_button[TOOL_RULER]->set_accessibility_name(TTRC("Ruler Mode"));+ main_flow->add_child(memnew(VSeparator));- tool_button_hbox->add_child(memnew(VSeparator));+ HBoxContainer *misc_hbox = memnew(HBoxContainer);+ main_flow->add_child(misc_hbox);tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(Button);- tool_button_hbox->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);+ misc_hbox->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true);tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_theme_type_variation(SceneStringName(FlatButton));tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_LOCAL_COORDS));tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTRC("Use Local Space"), Key::T));tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this);tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_accessibility_name(TTRC("Use Local Space"));-- tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);- tool_button_hbox->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);- tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);- tool_option_button[TOOL_OPT_USE_SNAP]->set_theme_type_variation(SceneStringName(FlatButton));- tool_option_button[TOOL_OPT_USE_SNAP]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_SNAP));- tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTRC("Use Snap"), Key::Y));- tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);- tool_option_button[TOOL_OPT_USE_SNAP]->set_accessibility_name(TTRC("Use Snap"));+ tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_button_icon(EditorIconManager::get_icon(SNAME("Object")));tool_option_button[TOOL_OPT_USE_TRACKBALL] = memnew(Button);- tool_button_hbox->add_child(tool_option_button[TOOL_OPT_USE_TRACKBALL]);+ misc_hbox->add_child(tool_option_button[TOOL_OPT_USE_TRACKBALL]);tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_toggle_mode(true);tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_theme_type_variation(SceneStringName(FlatButton));tool_option_button[TOOL_OPT_USE_TRACKBALL]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_TRACKBALL));tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_shortcut(ED_SHORTCUT("spatial_editor/trackball", TTRC("Use Trackball"), Key::U));tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_shortcut_context(this);tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_accessibility_name(TTRC("Use Trackball"));+ tool_option_button[TOOL_OPT_USE_TRACKBALL]->set_button_icon(EditorIconManager::get_icon(SNAME("Trackball")));tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM] = memnew(Button);- tool_button_hbox->add_child(tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]);+ misc_hbox->add_child(tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]);tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_toggle_mode(true);tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_theme_type_variation(SceneStringName(FlatButton));tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_PRESERVE_CHILDREN_TRANSFORM));@@ -3586,11 +3573,47 @@ Node3DEditor::Node3DEditor() {tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_shortcut_context(this);tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_accessibility_name(TTRC("Preserve Children Transform"));tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_tooltip_text(TTRC("When enabled, transforming a node will preserve the global transform of its children.\nThis also applies when editing transform properties in the Inspector."));+ tool_option_button[TOOL_OPT_PRESERVE_CHILDREN_TRANSFORM]->set_button_icon(EditorIconManager::get_icon(SNAME("Pin")));- tool_button_hbox->add_child(memnew(VSeparator));+ main_flow->add_child(memnew(VSeparator));- HBoxContainer *environment_hbox = memnew(HBoxContainer);- main_flow->add_child(environment_hbox);+ HBoxContainer *snap_hbox = EditorToolbarGroup::create(main_flow);++ tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);+ snap_hbox->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);+ tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);+ tool_option_button[TOOL_OPT_USE_SNAP]->set_theme_type_variation(SceneStringName(FlatButton));+ tool_option_button[TOOL_OPT_USE_SNAP]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_SNAP));+ tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTRC("Use Snap"), Key::Y));+ tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);+ tool_option_button[TOOL_OPT_USE_SNAP]->set_accessibility_name(TTRC("Use Snap"));+ tool_option_button[TOOL_OPT_USE_SNAP]->set_button_icon(EditorIconManager::get_icon(SNAME("Snap")));++ snap_menu = memnew(MenuButton);+ snap_hbox->add_child(snap_menu);+ snap_menu->set_flat(false);+ snap_menu->set_theme_type_variation("FlatMenuButtonNoIconTint");+ snap_menu->set_h_size_flags(SIZE_SHRINK_END);+ snap_menu->set_tooltip_text(TTRC("Selection options."));+ snap_menu->set_button_icon(EditorIconManager::get_icon(SNAME("GuiDropdown")));++ PopupMenu *snap_p = snap_menu->get_popup();+ snap_p->add_radio_check_item(TTRC("Snap Vertex to Vertex"), MENU_VERTEX_SNAP_BASE_VERTEX);+ snap_p->set_item_checked(snap_p->get_item_index(MENU_VERTEX_SNAP_BASE_VERTEX), true);+ snap_p->add_radio_check_item(TTRC("Snap Origin to Vertex"), MENU_VERTEX_SNAP_BASE_ORIGIN);++ snap_p->add_separator();+ snap_p->add_radio_check_item(TTRC("Snap to Mesh Vertices"), MENU_VERTEX_SNAP_SOURCE_MESH);+ snap_p->set_item_checked(snap_p->get_item_index(MENU_VERTEX_SNAP_SOURCE_MESH), true);+ snap_p->add_radio_check_item(TTRC("Snap to Collision Vertices"), MENU_VERTEX_SNAP_SOURCE_COLLISION);++ snap_p->add_separator();+ snap_p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTRC("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);+ snap_p->connect(SceneStringName(id_pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed));++ main_flow->add_child(memnew(VSeparator));++ HBoxContainer *environment_hbox = EditorToolbarGroup::create(main_flow);sun_button = memnew(Button);sun_button->set_tooltip_text(TTRC("Toggle preview sunlight.\nIf a DirectionalLight3D node is added to the scene, preview sunlight is disabled."));@@ -3600,6 +3623,7 @@ Node3DEditor::Node3DEditor() {sun_button->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED);// Preview is enabled by default - ensure this applies on editor startup when there is no state yet.sun_button->set_pressed(true);+ sun_button->set_button_icon(EditorIconManager::get_icon(SNAME("PreviewSun")));environment_hbox->add_child(sun_button);@@ -3611,6 +3635,7 @@ Node3DEditor::Node3DEditor() {environ_button->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED);// Preview is enabled by default - ensure this applies on editor startup when there is no state yet.environ_button->set_pressed(true);+ environ_button->set_button_icon(EditorIconManager::get_icon(SNAME("PreviewEnvironment")));environment_hbox->add_child(environ_button);@@ -3618,10 +3643,11 @@ Node3DEditor::Node3DEditor() {sun_environ_settings->set_tooltip_text(TTRC("Edit Sun and Environment settings."));sun_environ_settings->set_theme_type_variation(SceneStringName(FlatButton));sun_environ_settings->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_sun_environ_settings_pressed));+ sun_environ_settings->set_button_icon(EditorIconManager::get_icon(SNAME("GuiDropdown")));environment_hbox->add_child(sun_environ_settings);- environment_hbox->add_child(memnew(VSeparator));+ main_flow->add_child(memnew(VSeparator));HBoxContainer *transform_view_hbox = memnew(HBoxContainer);main_flow->add_child(transform_view_hbox);@@ -3671,22 +3697,9 @@ Node3DEditor::Node3DEditor() {p = transform_menu->get_popup();p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTRC("Snap Object to Floor"), Key::PAGEDOWN), MENU_SNAP_TO_FLOOR);p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTRC("Transform Dialog...")), MENU_TRANSFORM_DIALOG);-- p->add_separator();ED_SHORTCUT("spatial_editor/vertex_snap", TTRC("Vertex Snap"), Key::B);- p->add_radio_check_item(TTRC("Snap Vertex to Vertex"), MENU_VERTEX_SNAP_BASE_VERTEX);- p->set_item_checked(p->get_item_index(MENU_VERTEX_SNAP_BASE_VERTEX), true);- p->add_radio_check_item(TTRC("Snap Origin to Vertex"), MENU_VERTEX_SNAP_BASE_ORIGIN);-- p->add_separator();- p->add_radio_check_item(TTRC("Snap to Mesh Vertices"), MENU_VERTEX_SNAP_SOURCE_MESH);- p->set_item_checked(p->get_item_index(MENU_VERTEX_SNAP_SOURCE_MESH), true);- p->add_radio_check_item(TTRC("Snap to Collision Vertices"), MENU_VERTEX_SNAP_SOURCE_COLLISION);_update_vertex_snap_tooltips();- p->add_separator();- p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTRC("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);-p->connect(SceneStringName(id_pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed));view_layout_menu = memnew(MenuButton);@@ -3728,6 +3741,12 @@ Node3DEditor::Node3DEditor() {p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTRC("3 Viewports"), KeyModifierMask::CMD_OR_CTRL + Key::KEY_3, true), MENU_VIEW_USE_3_VIEWPORTS);p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTRC("3 Viewports (Alt)"), KeyModifierMask::ALT + KeyModifierMask::CMD_OR_CTRL + Key::KEY_3, true), MENU_VIEW_USE_3_VIEWPORTS_ALT);p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTRC("4 Viewports"), KeyModifierMask::CMD_OR_CTRL + Key::KEY_4, true), MENU_VIEW_USE_4_VIEWPORTS);+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_1_VIEWPORT), EditorIconManager::get_icon(SNAME("Panels1")));+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), EditorIconManager::get_icon(SNAME("Panels2")));+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), EditorIconManager::get_icon(SNAME("Panels2Alt")));+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), EditorIconManager::get_icon(SNAME("Panels3")));+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), EditorIconManager::get_icon(SNAME("Panels3Alt")));+ p->set_item_icon(p->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), EditorIconManager::get_icon(SNAME("Panels4")));p->add_separator();gizmos_menu = memnew(PopupMenu);diff --git a/editor/scene/3d/node_3d_editor_plugin.h b/editor/scene/3d/node_3d_editor_plugin.hindex 7d4eb858349..775eadaabc9 100644--- a/editor/scene/3d/node_3d_editor_plugin.h+++ b/editor/scene/3d/node_3d_editor_plugin.h@@ -220,6 +220,7 @@ private:Button *tool_button[TOOL_MAX];Button *tool_option_button[TOOL_OPT_MAX];+ MenuButton *snap_menu = nullptr;MenuButton *transform_menu = nullptr;PopupMenu *gizmos_menu = nullptr;MenuButton *view_layout_menu = nullptr;