mirror of
https://github.com/godotengine/godot.git
synced 2025-10-30 05:01:10 +00:00
Merge pull request #81939 from YuriSizov/gui-flat-and-depressed
Replace flat buttons with flat-styled buttons with a visible pressed state
This commit is contained in:
commit
8ddf73c74d
40 changed files with 291 additions and 212 deletions
|
|
@ -8225,7 +8225,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_button[TOOL_MODE_SELECT] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_MODE_SELECT]);
|
||||
tool_button[TOOL_MODE_SELECT]->set_toggle_mode(true);
|
||||
tool_button[TOOL_MODE_SELECT]->set_flat(true);
|
||||
tool_button[TOOL_MODE_SELECT]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_MODE_SELECT]->set_pressed(true);
|
||||
tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_SELECT));
|
||||
tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), Key::Q));
|
||||
|
|
@ -8236,7 +8236,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_button[TOOL_MODE_MOVE] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_MODE_MOVE]);
|
||||
tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
|
||||
tool_button[TOOL_MODE_MOVE]->set_flat(true);
|
||||
tool_button[TOOL_MODE_MOVE]->set_theme_type_variation("FlatButton");
|
||||
|
||||
tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_MOVE));
|
||||
tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), Key::W));
|
||||
|
|
@ -8245,7 +8245,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_button[TOOL_MODE_ROTATE] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_MODE_ROTATE]);
|
||||
tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true);
|
||||
tool_button[TOOL_MODE_ROTATE]->set_flat(true);
|
||||
tool_button[TOOL_MODE_ROTATE]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_ROTATE));
|
||||
tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), Key::E));
|
||||
tool_button[TOOL_MODE_ROTATE]->set_shortcut_context(this);
|
||||
|
|
@ -8253,7 +8253,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_button[TOOL_MODE_SCALE] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_MODE_SCALE]);
|
||||
tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true);
|
||||
tool_button[TOOL_MODE_SCALE]->set_flat(true);
|
||||
tool_button[TOOL_MODE_SCALE]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_MODE_SCALE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_SCALE));
|
||||
tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), Key::R));
|
||||
tool_button[TOOL_MODE_SCALE]->set_shortcut_context(this);
|
||||
|
|
@ -8263,13 +8263,13 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_button[TOOL_MODE_LIST_SELECT] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
|
||||
tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
|
||||
tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true);
|
||||
tool_button[TOOL_MODE_LIST_SELECT]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_MODE_LIST_SELECT]->connect("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."));
|
||||
|
||||
tool_button[TOOL_LOCK_SELECTED] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]);
|
||||
tool_button[TOOL_LOCK_SELECTED]->set_flat(true);
|
||||
tool_button[TOOL_LOCK_SELECTED]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_LOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_LOCK_SELECTED));
|
||||
tool_button[TOOL_LOCK_SELECTED]->set_tooltip_text(TTR("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.
|
||||
|
|
@ -8277,7 +8277,7 @@ Node3DEditor::Node3DEditor() {
|
|||
|
||||
tool_button[TOOL_UNLOCK_SELECTED] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]);
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->set_flat(true);
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNLOCK_SELECTED));
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip_text(TTR("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.
|
||||
|
|
@ -8285,7 +8285,7 @@ Node3DEditor::Node3DEditor() {
|
|||
|
||||
tool_button[TOOL_GROUP_SELECTED] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]);
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_flat(true);
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_GROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_GROUP_SELECTED));
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_tooltip_text(TTR("Make selected node's children not selectable."));
|
||||
// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
|
||||
|
|
@ -8293,7 +8293,7 @@ Node3DEditor::Node3DEditor() {
|
|||
|
||||
tool_button[TOOL_UNGROUP_SELECTED] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_flat(true);
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_theme_type_variation("FlatButton");
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNGROUP_SELECTED));
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip_text(TTR("Make selected node's children selectable."));
|
||||
// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
|
||||
|
|
@ -8304,7 +8304,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(Button);
|
||||
main_menu_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_flat(true);
|
||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_theme_type_variation("FlatButton");
|
||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("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", TTR("Use Local Space"), Key::T));
|
||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this);
|
||||
|
|
@ -8312,7 +8312,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);
|
||||
main_menu_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_flat(true);
|
||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_theme_type_variation("FlatButton");
|
||||
tool_option_button[TOOL_OPT_USE_SNAP]->connect("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", TTR("Use Snap"), Key::Y));
|
||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);
|
||||
|
|
@ -8322,7 +8322,7 @@ Node3DEditor::Node3DEditor() {
|
|||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA] = memnew(Button);
|
||||
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]);
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_toggle_mode(true);
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true);
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_theme_type_variation("FlatButton");
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true);
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_OVERRIDE_CAMERA));
|
||||
_update_camera_override_button(false);
|
||||
|
|
@ -8331,7 +8331,7 @@ Node3DEditor::Node3DEditor() {
|
|||
sun_button = memnew(Button);
|
||||
sun_button->set_tooltip_text(TTR("Toggle preview sunlight.\nIf a DirectionalLight3D node is added to the scene, preview sunlight is disabled."));
|
||||
sun_button->set_toggle_mode(true);
|
||||
sun_button->set_flat(true);
|
||||
sun_button->set_theme_type_variation("FlatButton");
|
||||
sun_button->connect("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);
|
||||
|
|
@ -8341,7 +8341,7 @@ Node3DEditor::Node3DEditor() {
|
|||
environ_button = memnew(Button);
|
||||
environ_button->set_tooltip_text(TTR("Toggle preview environment.\nIf a WorldEnvironment node is added to the scene, preview environment is disabled."));
|
||||
environ_button->set_toggle_mode(true);
|
||||
environ_button->set_flat(true);
|
||||
environ_button->set_theme_type_variation("FlatButton");
|
||||
environ_button->connect("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);
|
||||
|
|
@ -8350,7 +8350,7 @@ Node3DEditor::Node3DEditor() {
|
|||
|
||||
sun_environ_settings = memnew(Button);
|
||||
sun_environ_settings->set_tooltip_text(TTR("Edit Sun and Environment settings."));
|
||||
sun_environ_settings->set_flat(true);
|
||||
sun_environ_settings->set_theme_type_variation("FlatButton");
|
||||
sun_environ_settings->connect("pressed", callable_mp(this, &Node3DEditor::_sun_environ_settings_pressed));
|
||||
|
||||
main_menu_hbox->add_child(sun_environ_settings);
|
||||
|
|
@ -8386,6 +8386,8 @@ Node3DEditor::Node3DEditor() {
|
|||
PopupMenu *p;
|
||||
|
||||
transform_menu = memnew(MenuButton);
|
||||
transform_menu->set_flat(false);
|
||||
transform_menu->set_theme_type_variation("FlatMenuButton");
|
||||
transform_menu->set_text(TTR("Transform"));
|
||||
transform_menu->set_switch_on_hover(true);
|
||||
transform_menu->set_shortcut_context(this);
|
||||
|
|
@ -8401,6 +8403,8 @@ Node3DEditor::Node3DEditor() {
|
|||
p->connect("id_pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed));
|
||||
|
||||
view_menu = memnew(MenuButton);
|
||||
view_menu->set_flat(false);
|
||||
view_menu->set_theme_type_variation("FlatMenuButton");
|
||||
// TRANSLATORS: Noun, name of the 2D/3D View menus.
|
||||
view_menu->set_text(TTR("View"));
|
||||
view_menu->set_switch_on_hover(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue