diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index c55942acef8..6cdcf1a6d0c 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1814,7 +1814,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { hbc->add_child(memnew(VSeparator)); skip_breakpoints = memnew(Button); - skip_breakpoints->set_flat(true); + skip_breakpoints->set_theme_type_variation("FlatButton"); hbc->add_child(skip_breakpoints); skip_breakpoints->set_tooltip_text(TTR("Skip Breakpoints")); skip_breakpoints->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints)); @@ -1822,7 +1822,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { hbc->add_child(memnew(VSeparator)); copy = memnew(Button); - copy->set_flat(true); + copy->set_theme_type_variation("FlatButton"); hbc->add_child(copy); copy->set_tooltip_text(TTR("Copy Error")); copy->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_copy)); @@ -1830,14 +1830,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() { hbc->add_child(memnew(VSeparator)); step = memnew(Button); - step->set_flat(true); + step->set_theme_type_variation("FlatButton"); hbc->add_child(step); step->set_tooltip_text(TTR("Step Into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); step->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_step)); next = memnew(Button); - next->set_flat(true); + next->set_theme_type_variation("FlatButton"); hbc->add_child(next); next->set_tooltip_text(TTR("Step Over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); @@ -1846,14 +1846,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() { hbc->add_child(memnew(VSeparator)); dobreak = memnew(Button); - dobreak->set_flat(true); + dobreak->set_theme_type_variation("FlatButton"); hbc->add_child(dobreak); dobreak->set_tooltip_text(TTR("Break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); dobreak->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_break)); docontinue = memnew(Button); - docontinue->set_flat(true); + docontinue->set_theme_type_variation("FlatButton"); hbc->add_child(docontinue); docontinue->set_tooltip_text(TTR("Continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); @@ -2028,10 +2028,10 @@ ScriptEditorDebugger::ScriptEditorDebugger() { vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE); vmem_hb->add_child(vmem_total); vmem_refresh = memnew(Button); - vmem_refresh->set_flat(true); + vmem_refresh->set_theme_type_variation("FlatButton"); vmem_hb->add_child(vmem_refresh); vmem_export = memnew(Button); - vmem_export->set_flat(true); + vmem_export->set_theme_type_variation("FlatButton"); vmem_export->set_tooltip_text(TTR("Export list to a CSV file")); vmem_hb->add_child(vmem_export); vmem_vb->add_child(vmem_hb); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 109a10750fb..1e1352016f3 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -803,21 +803,21 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { HBoxContainer *hbc = memnew(HBoxContainer); vb->add_child(hbc); solo = memnew(Button); - solo->set_flat(true); + solo->set_theme_type_variation("FlatButton"); solo->set_toggle_mode(true); solo->set_tooltip_text(TTR("Solo")); solo->set_focus_mode(FOCUS_NONE); solo->connect("pressed", callable_mp(this, &EditorAudioBus::_solo_toggled)); hbc->add_child(solo); mute = memnew(Button); - mute->set_flat(true); + mute->set_theme_type_variation("FlatButton"); mute->set_toggle_mode(true); mute->set_tooltip_text(TTR("Mute")); mute->set_focus_mode(FOCUS_NONE); mute->connect("pressed", callable_mp(this, &EditorAudioBus::_mute_toggled)); hbc->add_child(mute); bypass = memnew(Button); - bypass->set_flat(true); + bypass->set_theme_type_variation("FlatButton"); bypass->set_toggle_mode(true); bypass->set_tooltip_text(TTR("Bypass")); bypass->set_focus_mode(FOCUS_NONE); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index c0459e94962..1029cfcf0ef 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -210,7 +210,7 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(search_box); case_sensitive_button = memnew(Button); - case_sensitive_button->set_flat(true); + case_sensitive_button->set_theme_type_variation("FlatButton"); case_sensitive_button->set_tooltip_text(TTR("Case Sensitive")); case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); case_sensitive_button->set_toggle_mode(true); @@ -218,7 +218,7 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(case_sensitive_button); hierarchy_button = memnew(Button); - hierarchy_button->set_flat(true); + hierarchy_button->set_theme_type_variation("FlatButton"); hierarchy_button->set_tooltip_text(TTR("Show Hierarchy")); hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); hierarchy_button->set_toggle_mode(true); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 3cd5bbfad6b..41f91d8d32e 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -426,7 +426,7 @@ EditorLog::EditorLog() { // Clear. clear_button = memnew(Button); - clear_button->set_flat(true); + clear_button->set_theme_type_variation("FlatButton"); clear_button->set_focus_mode(FOCUS_NONE); clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::K)); clear_button->set_shortcut_context(this); @@ -435,7 +435,7 @@ EditorLog::EditorLog() { // Copy. copy_button = memnew(Button); - copy_button->set_flat(true); + copy_button->set_theme_type_variation("FlatButton"); copy_button->set_focus_mode(FOCUS_NONE); copy_button->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KeyModifierMask::CMD_OR_CTRL | Key::C)); copy_button->set_shortcut_context(this); @@ -449,7 +449,7 @@ EditorLog::EditorLog() { // Collapse. collapse_button = memnew(Button); - collapse_button->set_flat(true); + collapse_button->set_theme_type_variation("FlatButton"); collapse_button->set_focus_mode(FOCUS_NONE); collapse_button->set_tooltip_text(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); collapse_button->set_toggle_mode(true); @@ -459,7 +459,7 @@ EditorLog::EditorLog() { // Show Search. show_search_button = memnew(Button); - show_search_button->set_flat(true); + show_search_button->set_theme_type_variation("FlatButton"); show_search_button->set_focus_mode(FOCUS_NONE); show_search_button->set_toggle_mode(true); show_search_button->set_pressed(true); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 4b88c7c1032..ca2a2ff1d62 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -951,7 +951,7 @@ Ref create_editor_theme(const Ref p_theme) { toolbar_stylebox->set_border_color(accent_color); toolbar_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); toolbar_stylebox->set_content_margin(SIDE_BOTTOM, 0); - toolbar_stylebox->set_expand_margin_all(2 * EDSCALE); + toolbar_stylebox->set_expand_margin_individual(4 * EDSCALE, 2 * EDSCALE, 4 * EDSCALE, 4 * EDSCALE); theme->set_stylebox("ContextualToolbar", EditorStringName(EditorStyles), toolbar_stylebox); // Script Editor @@ -1022,6 +1022,30 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("h_separation", "Button", 4 * EDSCALE); theme->set_constant("outline_size", "Button", 0); + // Flat button variations. + + Ref style_flat_button = make_empty_stylebox(); + for (int i = 0; i < 4; i++) { + style_flat_button->set_content_margin((Side)i, style_widget->get_margin((Side)i) + style_widget->get_border_width((Side)i)); + } + + Ref style_flat_button_pressed = style_widget_pressed->duplicate(); + Color flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.8, 0.8, 0.8, 0.85); + if (dark_theme) { + flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.6, 0.6, 0.6, 0.85); + } + style_flat_button_pressed->set_bg_color(flat_pressed_color); + + theme->set_stylebox("normal", "FlatButton", style_flat_button); + theme->set_stylebox("hover", "FlatButton", style_flat_button); + theme->set_stylebox("pressed", "FlatButton", style_flat_button_pressed); + theme->set_stylebox("disabled", "FlatButton", style_flat_button); + + theme->set_stylebox("normal", "FlatMenuButton", style_flat_button); + theme->set_stylebox("hover", "FlatMenuButton", style_flat_button); + theme->set_stylebox("pressed", "FlatMenuButton", style_flat_button_pressed); + theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button); + const float ACTION_BUTTON_EXTRA_MARGIN = 32 * EDSCALE; theme->set_type_variation("InspectorActionButton", "Button"); diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index fd1e63b9047..8fb0c14e80b 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -1741,13 +1741,13 @@ EditorFileDialog::EditorFileDialog() { HBoxContainer *pathhb = memnew(HBoxContainer); dir_prev = memnew(Button); - dir_prev->set_flat(true); + dir_prev->set_theme_type_variation("FlatButton"); dir_prev->set_tooltip_text(TTR("Go to previous folder.")); dir_next = memnew(Button); - dir_next->set_flat(true); + dir_next->set_theme_type_variation("FlatButton"); dir_next->set_tooltip_text(TTR("Go to next folder.")); dir_up = memnew(Button); - dir_up->set_flat(true); + dir_up->set_theme_type_variation("FlatButton"); dir_up->set_tooltip_text(TTR("Go to parent folder.")); pathhb->add_child(dir_prev); @@ -1771,20 +1771,20 @@ EditorFileDialog::EditorFileDialog() { dir->set_h_size_flags(Control::SIZE_EXPAND_FILL); refresh = memnew(Button); - refresh->set_flat(true); + refresh->set_theme_type_variation("FlatButton"); refresh->set_tooltip_text(TTR("Refresh files.")); refresh->connect("pressed", callable_mp(this, &EditorFileDialog::update_file_list)); pathhb->add_child(refresh); favorite = memnew(Button); - favorite->set_flat(true); + favorite->set_theme_type_variation("FlatButton"); favorite->set_toggle_mode(true); favorite->set_tooltip_text(TTR("(Un)favorite current folder.")); favorite->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_pressed)); pathhb->add_child(favorite); show_hidden = memnew(Button); - show_hidden->set_flat(true); + show_hidden->set_theme_type_variation("FlatButton"); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip_text(TTR("Toggle the visibility of hidden files.")); @@ -1797,7 +1797,7 @@ EditorFileDialog::EditorFileDialog() { view_mode_group.instantiate(); mode_thumbnails = memnew(Button); - mode_thumbnails->set_flat(true); + mode_thumbnails->set_theme_type_variation("FlatButton"); mode_thumbnails->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode).bind(DISPLAY_THUMBNAILS)); mode_thumbnails->set_toggle_mode(true); mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS); @@ -1806,7 +1806,7 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(mode_thumbnails); mode_list = memnew(Button); - mode_list->set_flat(true); + mode_list->set_theme_type_variation("FlatButton"); mode_list->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode).bind(DISPLAY_LIST)); mode_list->set_toggle_mode(true); mode_list->set_pressed(display_mode == DISPLAY_LIST); @@ -1848,11 +1848,11 @@ EditorFileDialog::EditorFileDialog() { fav_hb->add_spacer(); fav_up = memnew(Button); - fav_up->set_flat(true); + fav_up->set_theme_type_variation("FlatButton"); fav_hb->add_child(fav_up); fav_up->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_up)); fav_down = memnew(Button); - fav_down->set_flat(true); + fav_down->set_theme_type_variation("FlatButton"); fav_hb->add_child(fav_down); fav_down->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_down)); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index fd5ebc423ea..bc8c8f6f79a 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -726,19 +726,19 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) { edge_point = PosVertex(); button_create = memnew(Button); - button_create->set_flat(true); + button_create->set_theme_type_variation("FlatButton"); add_child(button_create); button_create->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(Button); - button_edit->set_flat(true); + button_edit->set_theme_type_variation("FlatButton"); add_child(button_edit); button_edit->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_EDIT)); button_edit->set_toggle_mode(true); button_delete = memnew(Button); - button_delete->set_flat(true); + button_delete->set_theme_type_variation("FlatButton"); add_child(button_delete); button_delete->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_DELETE)); button_delete->set_toggle_mode(true); diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 58eec1fa1e4..135c79f5216 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -663,7 +663,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { bg.instantiate(); tool_blend = memnew(Button); - tool_blend->set_flat(true); + tool_blend->set_theme_type_variation("FlatButton"); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); @@ -672,7 +672,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); - tool_select->set_flat(true); + tool_select->set_theme_type_variation("FlatButton"); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); @@ -680,7 +680,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); - tool_create->set_flat(true); + tool_create->set_theme_type_variation("FlatButton"); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); @@ -690,7 +690,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(Button); - tool_erase->set_flat(true); + tool_erase->set_theme_type_variation("FlatButton"); top_hb->add_child(tool_erase); tool_erase->set_tooltip_text(TTR("Erase points.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected)); @@ -698,7 +698,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(memnew(VSeparator)); snap = memnew(Button); - snap->set_flat(true); + snap->set_theme_type_variation("FlatButton"); snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 7971fbf6d6a..9707c9ee054 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -883,7 +883,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { bg.instantiate(); tool_blend = memnew(Button); - tool_blend->set_flat(true); + tool_blend->set_theme_type_variation("FlatButton"); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); @@ -892,7 +892,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); - tool_select->set_flat(true); + tool_select->set_theme_type_variation("FlatButton"); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); @@ -900,7 +900,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); - tool_create->set_flat(true); + tool_create->set_theme_type_variation("FlatButton"); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); @@ -908,7 +908,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(1)); tool_triangle = memnew(Button); - tool_triangle->set_flat(true); + tool_triangle->set_theme_type_variation("FlatButton"); tool_triangle->set_toggle_mode(true); tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); @@ -918,7 +918,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(Button); - tool_erase->set_flat(true); + tool_erase->set_theme_type_variation("FlatButton"); top_hb->add_child(tool_erase); tool_erase->set_tooltip_text(TTR("Erase points and triangles.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected)); @@ -927,7 +927,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(VSeparator)); auto_triangles = memnew(Button); - auto_triangles->set_flat(true); + auto_triangles->set_theme_type_variation("FlatButton"); top_hb->add_child(auto_triangles); auto_triangles->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled)); auto_triangles->set_toggle_mode(true); @@ -936,7 +936,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(VSeparator)); snap = memnew(Button); - snap->set_flat(true); + snap->set_theme_type_variation("FlatButton"); snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 05e189290de..51d195e0e1b 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1682,27 +1682,27 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug add_child(hb); play_bw_from = memnew(Button); - play_bw_from->set_flat(true); + play_bw_from->set_theme_type_variation("FlatButton"); play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)")); hb->add_child(play_bw_from); play_bw = memnew(Button); - play_bw->set_flat(true); + play_bw->set_theme_type_variation("FlatButton"); play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)")); hb->add_child(play_bw); stop = memnew(Button); - stop->set_flat(true); + stop->set_theme_type_variation("FlatButton"); hb->add_child(stop); stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)")); play = memnew(Button); - play->set_flat(true); + play->set_theme_type_variation("FlatButton"); play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)")); hb->add_child(play); play_from = memnew(Button); - play_from->set_flat(true); + play_from->set_theme_type_variation("FlatButton"); play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); hb->add_child(play_from); @@ -1753,7 +1753,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug animation->set_auto_translate(false); autoplay = memnew(Button); - autoplay->set_flat(true); + autoplay->set_theme_type_variation("FlatButton"); hb->add_child(autoplay); autoplay->set_tooltip_text(TTR("Autoplay on Load")); @@ -1766,7 +1766,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug hb->add_child(memnew(VSeparator)); onion_toggle = memnew(Button); - onion_toggle->set_flat(true); + onion_toggle->set_theme_type_variation("FlatButton"); onion_toggle->set_toggle_mode(true); onion_toggle->set_tooltip_text(TTR("Enable Onion Skinning")); onion_toggle->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu).bind(ONION_SKINNING_ENABLE)); @@ -1804,7 +1804,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug hb->add_child(memnew(VSeparator)); pin = memnew(Button); - pin->set_flat(true); + pin->set_theme_type_variation("FlatButton"); pin->set_toggle_mode(true); pin->set_tooltip_text(TTR("Pin AnimationPlayer")); hb->add_child(pin); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 8a1c4ec61e7..998276329b9 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1676,7 +1676,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { bg.instantiate(); tool_select = memnew(Button); - tool_select->set_flat(true); + tool_select->set_theme_type_variation("FlatButton"); top_hb->add_child(tool_select); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); @@ -1685,7 +1685,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_create = memnew(Button); - tool_create->set_flat(true); + tool_create->set_theme_type_variation("FlatButton"); top_hb->add_child(tool_create); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); @@ -1693,7 +1693,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_create->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_connect = memnew(Button); - tool_connect->set_flat(true); + tool_connect->set_theme_type_variation("FlatButton"); top_hb->add_child(tool_connect); tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); @@ -1706,7 +1706,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { selection_tools_hb->add_child(memnew(VSeparator)); tool_erase = memnew(Button); - tool_erase->set_flat(true); + tool_erase->set_theme_type_variation("FlatButton"); tool_erase->set_tooltip_text(TTR("Remove selected node or transition.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected).bind(false)); tool_erase->set_disabled(true); @@ -1721,7 +1721,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { transition_tools_hb->add_child(switch_mode); auto_advance = memnew(Button); - auto_advance->set_flat(true); + auto_advance->set_theme_type_variation("FlatButton"); auto_advance->set_tooltip_text(TTR("New Transitions Should Auto Advance")); auto_advance->set_toggle_mode(true); auto_advance->set_pressed(true); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 1396f16dd26..6806deff676 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5175,7 +5175,7 @@ CanvasItemEditor::CanvasItemEditor() { viewport->add_child(controls_vb); select_button = memnew(Button); - select_button->set_flat(true); + select_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(select_button); select_button->set_toggle_mode(true); select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_SELECT)); @@ -5187,7 +5187,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); move_button = memnew(Button); - move_button->set_flat(true); + move_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(move_button); move_button->set_toggle_mode(true); move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_MOVE)); @@ -5196,7 +5196,7 @@ CanvasItemEditor::CanvasItemEditor() { move_button->set_tooltip_text(TTR("Move Mode")); rotate_button = memnew(Button); - rotate_button->set_flat(true); + rotate_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(rotate_button); rotate_button->set_toggle_mode(true); rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_ROTATE)); @@ -5205,7 +5205,7 @@ CanvasItemEditor::CanvasItemEditor() { rotate_button->set_tooltip_text(TTR("Rotate Mode")); scale_button = memnew(Button); - scale_button->set_flat(true); + scale_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(scale_button); scale_button->set_toggle_mode(true); scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_SCALE)); @@ -5216,21 +5216,21 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); list_select_button = memnew(Button); - list_select_button->set_flat(true); + list_select_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(list_select_button); list_select_button->set_toggle_mode(true); list_select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_LIST_SELECT)); list_select_button->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.")); pivot_button = memnew(Button); - pivot_button->set_flat(true); + pivot_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(pivot_button); pivot_button->set_toggle_mode(true); pivot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_EDIT_PIVOT)); pivot_button->set_tooltip_text(TTR("Click to change object's rotation pivot.")); pan_button = memnew(Button); - pan_button->set_flat(true); + pan_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(pan_button); pan_button->set_toggle_mode(true); pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_PAN)); @@ -5239,7 +5239,7 @@ CanvasItemEditor::CanvasItemEditor() { pan_button->set_tooltip_text(TTR("You can also use Pan View shortcut (Space by default) to pan in any mode.")); ruler_button = memnew(Button); - ruler_button->set_flat(true); + ruler_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(ruler_button); ruler_button->set_toggle_mode(true); ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_RULER)); @@ -5250,7 +5250,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); smart_snap_button = memnew(Button); - smart_snap_button->set_flat(true); + smart_snap_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(smart_snap_button); smart_snap_button->set_toggle_mode(true); smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap)); @@ -5259,7 +5259,7 @@ CanvasItemEditor::CanvasItemEditor() { smart_snap_button->set_shortcut_context(this); grid_snap_button = memnew(Button); - grid_snap_button->set_flat(true); + grid_snap_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(grid_snap_button); grid_snap_button->set_toggle_mode(true); grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap)); @@ -5268,6 +5268,8 @@ CanvasItemEditor::CanvasItemEditor() { grid_snap_button->set_shortcut_context(this); snap_config_menu = memnew(MenuButton); + snap_config_menu->set_flat(false); + snap_config_menu->set_theme_type_variation("FlatMenuButton"); snap_config_menu->set_shortcut_context(this); main_menu_hbox->add_child(snap_config_menu); snap_config_menu->set_h_size_flags(SIZE_SHRINK_END); @@ -5301,7 +5303,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); lock_button = memnew(Button); - lock_button->set_flat(true); + lock_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(lock_button); lock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(LOCK_SELECTED)); @@ -5310,7 +5312,7 @@ CanvasItemEditor::CanvasItemEditor() { lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | Key::L)); unlock_button = memnew(Button); - unlock_button->set_flat(true); + unlock_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(unlock_button); unlock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNLOCK_SELECTED)); unlock_button->set_tooltip_text(TTR("Unlock selected node, allowing selection and movement.")); @@ -5318,7 +5320,7 @@ CanvasItemEditor::CanvasItemEditor() { unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::L)); group_button = memnew(Button); - group_button->set_flat(true); + group_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(group_button); group_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(GROUP_SELECTED)); group_button->set_tooltip_text(TTR("Make selected node's children not selectable.")); @@ -5326,7 +5328,7 @@ CanvasItemEditor::CanvasItemEditor() { group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | Key::G)); ungroup_button = memnew(Button); - ungroup_button->set_flat(true); + ungroup_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(ungroup_button); ungroup_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNGROUP_SELECTED)); ungroup_button->set_tooltip_text(TTR("Make selected node's children selectable.")); @@ -5336,6 +5338,8 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); skeleton_menu = memnew(MenuButton); + skeleton_menu->set_flat(false); + skeleton_menu->set_theme_type_variation("FlatMenuButton"); skeleton_menu->set_shortcut_context(this); main_menu_hbox->add_child(skeleton_menu); skeleton_menu->set_tooltip_text(TTR("Skeleton Options")); @@ -5351,7 +5355,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); override_camera_button = memnew(Button); - override_camera_button->set_flat(true); + override_camera_button->set_theme_type_variation("FlatButton"); main_menu_hbox->add_child(override_camera_button); override_camera_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_override_camera)); override_camera_button->set_toggle_mode(true); @@ -5361,6 +5365,8 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(memnew(VSeparator)); 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); @@ -5426,7 +5432,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->hide(); key_loc_button = memnew(Button); - key_loc_button->set_flat(true); + key_loc_button->set_theme_type_variation("FlatButton"); key_loc_button->set_toggle_mode(true); key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); @@ -5435,7 +5441,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); - key_rot_button->set_flat(true); + key_rot_button->set_theme_type_variation("FlatButton"); key_rot_button->set_toggle_mode(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); @@ -5444,7 +5450,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); - key_scale_button->set_flat(true); + key_scale_button->set_theme_type_variation("FlatButton"); key_scale_button->set_toggle_mode(true); key_scale_button->set_focus_mode(FOCUS_NONE); key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_SCALE)); @@ -5452,7 +5458,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); - key_insert_button->set_flat(true); + key_insert_button->set_theme_type_variation("FlatButton"); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_KEY)); key_insert_button->set_tooltip_text(TTR("Insert keys (based on mask).")); @@ -5461,7 +5467,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->add_child(key_insert_button); key_auto_insert_button = memnew(Button); - key_auto_insert_button->set_flat(true); + key_auto_insert_button->set_theme_type_variation("FlatButton"); key_auto_insert_button->set_toggle_mode(true); key_auto_insert_button->set_focus_mode(FOCUS_NONE); key_auto_insert_button->set_tooltip_text(TTR("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time.")); @@ -5470,6 +5476,8 @@ CanvasItemEditor::CanvasItemEditor() { animation_hb->add_child(key_auto_insert_button); animation_menu = memnew(MenuButton); + animation_menu->set_flat(false); + animation_menu->set_theme_type_variation("FlatMenuButton"); animation_menu->set_shortcut_context(this); animation_menu->set_tooltip_text(TTR("Animation Key and Pose Options")); animation_hb->add_child(animation_menu); diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index 8401f6c0b66..a0539c401de 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -520,7 +520,7 @@ void ControlEditorPopupButton::_notification(int p_what) { } ControlEditorPopupButton::ControlEditorPopupButton() { - set_flat(true); + set_theme_type_variation("FlatButton"); set_toggle_mode(true); set_focus_mode(FOCUS_NONE); @@ -1000,7 +1000,7 @@ ControlEditorToolbar::ControlEditorToolbar() { keep_ratio_button->connect("pressed", callable_mp(this, &ControlEditorToolbar::_anchors_to_current_ratio)); anchor_mode_button = memnew(Button); - anchor_mode_button->set_flat(true); + anchor_mode_button->set_theme_type_variation("FlatButton"); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->set_tooltip_text(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); add_child(anchor_mode_button); diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp index c7d7cc79187..99a702f3a4b 100644 --- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp @@ -183,7 +183,7 @@ GPUParticlesCollisionSDF3DEditorPlugin::GPUParticlesCollisionSDF3DEditorPlugin() bake_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); bake_hb->hide(); bake = memnew(Button); - bake->set_flat(true); + bake->set_theme_type_variation("FlatButton"); bake->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons))); bake->set_text(TTR("Bake SDF")); bake->connect("pressed", callable_mp(this, &GPUParticlesCollisionSDF3DEditorPlugin::_bake)); diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp index 76647394805..11f60a166c9 100644 --- a/editor/plugins/lightmap_gi_editor_plugin.cpp +++ b/editor/plugins/lightmap_gi_editor_plugin.cpp @@ -168,7 +168,7 @@ void LightmapGIEditorPlugin::_bind_methods() { LightmapGIEditorPlugin::LightmapGIEditorPlugin() { bake = memnew(Button); - bake->set_flat(true); + bake->set_theme_type_variation("FlatButton"); // TODO: Rework this as a dedicated toolbar control so we can hook into theme changes and update it // when the editor theme updates. bake->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons))); diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp index bbbde52935a..4f5bc67c1bb 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp @@ -523,13 +523,13 @@ NavigationObstacle3DEditor::NavigationObstacle3DEditor() { obstacle_node = nullptr; button_create = memnew(Button); - button_create->set_flat(true); + button_create->set_theme_type_variation("FlatButton"); add_child(button_create); button_create->connect("pressed", callable_mp(this, &NavigationObstacle3DEditor::_menu_option).bind(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(Button); - button_edit->set_flat(true); + button_edit->set_theme_type_variation("FlatButton"); add_child(button_edit); button_edit->connect("pressed", callable_mp(this, &NavigationObstacle3DEditor::_menu_option).bind(MODE_EDIT)); button_edit->set_toggle_mode(true); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6b5ae0eeffb..2eae48da97b 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -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); diff --git a/editor/plugins/occluder_instance_3d_editor_plugin.cpp b/editor/plugins/occluder_instance_3d_editor_plugin.cpp index 321c3308161..b0bd6f78175 100644 --- a/editor/plugins/occluder_instance_3d_editor_plugin.cpp +++ b/editor/plugins/occluder_instance_3d_editor_plugin.cpp @@ -104,7 +104,7 @@ void OccluderInstance3DEditorPlugin::_bind_methods() { OccluderInstance3DEditorPlugin::OccluderInstance3DEditorPlugin() { bake = memnew(Button); - bake->set_flat(true); + bake->set_theme_type_variation("FlatButton"); bake->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons))); bake->set_text(TTR("Bake Occluders")); bake->hide(); diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 61617bfd4f1..0d6086bb4de 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -533,7 +533,7 @@ Path2DEditor::Path2DEditor() { action = ACTION_NONE; curve_edit = memnew(Button); - curve_edit->set_flat(true); + curve_edit->set_theme_type_variation("FlatButton"); curve_edit->set_toggle_mode(true); curve_edit->set_pressed(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); @@ -542,7 +542,7 @@ Path2DEditor::Path2DEditor() { add_child(curve_edit); curve_edit_curve = memnew(Button); - curve_edit_curve->set_flat(true); + curve_edit_curve->set_theme_type_variation("FlatButton"); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip_text(TTR("Select Control Points (Shift+Drag)")); @@ -550,7 +550,7 @@ Path2DEditor::Path2DEditor() { add_child(curve_edit_curve); curve_create = memnew(Button); - curve_create->set_flat(true); + curve_create->set_theme_type_variation("FlatButton"); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip_text(TTR("Add Point (in empty space)")); @@ -558,7 +558,7 @@ Path2DEditor::Path2DEditor() { add_child(curve_create); curve_del = memnew(Button); - curve_del->set_flat(true); + curve_del->set_theme_type_variation("FlatButton"); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip_text(TTR("Delete Point")); @@ -566,7 +566,7 @@ Path2DEditor::Path2DEditor() { add_child(curve_del); curve_close = memnew(Button); - curve_close->set_flat(true); + curve_close->set_theme_type_variation("FlatButton"); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip_text(TTR("Close Curve")); curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(ACTION_CLOSE)); @@ -575,6 +575,8 @@ Path2DEditor::Path2DEditor() { PopupMenu *menu; handle_menu = memnew(MenuButton); + handle_menu->set_flat(false); + handle_menu->set_theme_type_variation("FlatMenuButton"); handle_menu->set_text(TTR("Options")); add_child(handle_menu); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index e1b402475a1..41854601261 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -730,35 +730,35 @@ Path3DEditorPlugin::Path3DEditorPlugin() { Node3DEditor::get_singleton()->add_control_to_menu_panel(topmenu_bar); curve_edit = memnew(Button); - curve_edit->set_flat(true); + curve_edit->set_theme_type_variation("FlatButton"); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); topmenu_bar->add_child(curve_edit); curve_edit_curve = memnew(Button); - curve_edit_curve->set_flat(true); + curve_edit_curve->set_theme_type_variation("FlatButton"); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip_text(TTR("Select Control Points (Shift+Drag)")); topmenu_bar->add_child(curve_edit_curve); curve_create = memnew(Button); - curve_create->set_flat(true); + curve_create->set_theme_type_variation("FlatButton"); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip_text(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); topmenu_bar->add_child(curve_create); curve_del = memnew(Button); - curve_del->set_flat(true); + curve_del->set_theme_type_variation("FlatButton"); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip_text(TTR("Delete Point")); topmenu_bar->add_child(curve_del); curve_close = memnew(Button); - curve_close->set_flat(true); + curve_close->set_theme_type_variation("FlatButton"); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip_text(TTR("Close Curve")); topmenu_bar->add_child(curve_close); @@ -766,6 +766,8 @@ Path3DEditorPlugin::Path3DEditorPlugin() { PopupMenu *menu; handle_menu = memnew(MenuButton); + handle_menu->set_flat(false); + handle_menu->set_theme_type_variation("FlatMenuButton"); handle_menu->set_text(TTR("Options")); topmenu_bar->add_child(handle_menu); diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index d01725fc420..37092f924e6 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -56,7 +56,7 @@ PhysicalBone3DEditor::PhysicalBone3DEditor() { Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); button_transform_joint = memnew(Button); - button_transform_joint->set_flat(true); + button_transform_joint->set_theme_type_variation("FlatButton"); spatial_editor_hb->add_child(button_transform_joint); button_transform_joint->set_text(TTR("Move Joint")); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index e700d28afb4..7a62f2ef762 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1243,7 +1243,7 @@ Polygon2DEditor::Polygon2DEditor() { snap_show_grid = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "show_grid", false); button_uv = memnew(Button); - button_uv->set_flat(true); + button_uv->set_theme_type_variation("FlatButton"); add_child(button_uv); button_uv->set_tooltip_text(TTR("Open Polygon 2D UV editor.")); button_uv->connect("pressed", callable_mp(this, &Polygon2DEditor::_menu_option).bind(MODE_EDIT_UV)); @@ -1294,7 +1294,7 @@ Polygon2DEditor::Polygon2DEditor() { uv_main_vb->add_child(uv_mode_hb); for (int i = 0; i < UV_MODE_MAX; i++) { uv_button[i] = memnew(Button); - uv_button[i]->set_flat(true); + uv_button[i]->set_theme_type_variation("FlatButton"); uv_button[i]->set_toggle_mode(true); uv_mode_hb->add_child(uv_button[i]); uv_button[i]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_mode).bind(i)); @@ -1359,6 +1359,8 @@ Polygon2DEditor::Polygon2DEditor() { uv_menu = memnew(MenuButton); uv_mode_hb->add_child(uv_menu); + uv_menu->set_flat(false); + uv_menu->set_theme_type_variation("FlatMenuButton"); uv_menu->set_text(TTR("Edit")); uv_menu->get_popup()->add_item(TTR("Copy Polygon to UV"), UVEDIT_POLYGON_TO_UV); uv_menu->get_popup()->add_item(TTR("Copy UV to Polygon"), UVEDIT_UV_TO_POLYGON); @@ -1371,7 +1373,7 @@ Polygon2DEditor::Polygon2DEditor() { uv_mode_hb->add_child(memnew(VSeparator)); b_snap_enable = memnew(Button); - b_snap_enable->set_flat(true); + b_snap_enable->set_theme_type_variation("FlatButton"); uv_mode_hb->add_child(b_snap_enable); b_snap_enable->set_text(TTR("Snap")); b_snap_enable->set_focus_mode(FOCUS_NONE); @@ -1381,7 +1383,7 @@ Polygon2DEditor::Polygon2DEditor() { b_snap_enable->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_use_snap)); b_snap_grid = memnew(Button); - b_snap_grid->set_flat(true); + b_snap_grid->set_theme_type_variation("FlatButton"); uv_mode_hb->add_child(b_snap_grid); b_snap_grid->set_text(TTR("Grid")); b_snap_grid->set_focus_mode(FOCUS_NONE); diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index fa5413787c2..c1b12407088 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -538,13 +538,13 @@ Polygon3DEditor::Polygon3DEditor() { node = nullptr; button_create = memnew(Button); - button_create->set_flat(true); + button_create->set_theme_type_variation("FlatButton"); add_child(button_create); button_create->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option).bind(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(Button); - button_edit->set_flat(true); + button_edit->set_theme_type_variation("FlatButton"); add_child(button_edit); button_edit->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option).bind(MODE_EDIT)); button_edit->set_toggle_mode(true); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 983ddcb52fd..c5fb8a0d8de 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -717,6 +717,8 @@ void Skeleton3DEditor::create_editors() { // Create Skeleton Option in Top Menu Bar. skeleton_options = memnew(MenuButton); + skeleton_options->set_flat(false); + skeleton_options->set_theme_type_variation("FlatMenuButton"); topmenu_bar->add_child(skeleton_options); skeleton_options->set_text(TTR("Skeleton3D")); @@ -738,7 +740,7 @@ void Skeleton3DEditor::create_editors() { edit_mode_button = memnew(Button); topmenu_bar->add_child(edit_mode_button); - edit_mode_button->set_flat(true); + edit_mode_button->set_theme_type_variation("FlatButton"); edit_mode_button->set_toggle_mode(true); edit_mode_button->set_focus_mode(FOCUS_NONE); edit_mode_button->set_tooltip_text(TTR("Edit Mode\nShow buttons on joints.")); @@ -758,7 +760,7 @@ void Skeleton3DEditor::create_editors() { animation_hb->hide(); key_loc_button = memnew(Button); - key_loc_button->set_flat(true); + key_loc_button->set_theme_type_variation("FlatButton"); key_loc_button->set_toggle_mode(true); key_loc_button->set_pressed(false); key_loc_button->set_focus_mode(FOCUS_NONE); @@ -766,7 +768,7 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); - key_rot_button->set_flat(true); + key_rot_button->set_theme_type_variation("FlatButton"); key_rot_button->set_toggle_mode(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); @@ -774,7 +776,7 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); - key_scale_button->set_flat(true); + key_scale_button->set_theme_type_variation("FlatButton"); key_scale_button->set_toggle_mode(true); key_scale_button->set_pressed(false); key_scale_button->set_focus_mode(FOCUS_NONE); @@ -782,7 +784,7 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); - key_insert_button->set_flat(true); + key_insert_button->set_theme_type_variation("FlatButton"); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys).bind(false)); key_insert_button->set_tooltip_text(TTR("Insert key of bone poses already exist track.")); @@ -790,7 +792,7 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_insert_button); key_insert_all_button = memnew(Button); - key_insert_all_button->set_flat(true); + key_insert_all_button->set_theme_type_variation("FlatButton"); key_insert_all_button->set_focus_mode(FOCUS_NONE); key_insert_all_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys).bind(true)); key_insert_all_button->set_tooltip_text(TTR("Insert key of all bone poses.")); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 18443580693..ed8984c8416 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1657,12 +1657,12 @@ SpriteFramesEditor::SpriteFramesEditor() { sub_vb->add_child(hbc_animlist); add_anim = memnew(Button); - add_anim->set_flat(true); + add_anim->set_theme_type_variation("FlatButton"); hbc_animlist->add_child(add_anim); add_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add)); delete_anim = memnew(Button); - delete_anim->set_flat(true); + delete_anim->set_theme_type_variation("FlatButton"); hbc_animlist->add_child(delete_anim); delete_anim->set_disabled(true); delete_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove)); @@ -1673,7 +1673,7 @@ SpriteFramesEditor::SpriteFramesEditor() { autoplay_container->add_child(memnew(VSeparator)); autoplay = memnew(Button); - autoplay->set_flat(true); + autoplay->set_theme_type_variation("FlatButton"); autoplay->set_tooltip_text(TTR("Autoplay on Load")); autoplay_container->add_child(autoplay); @@ -1681,7 +1681,7 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_loop = memnew(Button); anim_loop->set_toggle_mode(true); - anim_loop->set_flat(true); + anim_loop->set_theme_type_variation("FlatButton"); anim_loop->set_tooltip_text(TTR("Animation Looping")); anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed)); hbc_animlist->add_child(anim_loop); @@ -1740,27 +1740,27 @@ SpriteFramesEditor::SpriteFramesEditor() { hfc->add_child(playback_container); play_bw_from = memnew(Button); - play_bw_from->set_flat(true); + play_bw_from->set_theme_type_variation("FlatButton"); play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)")); playback_container->add_child(play_bw_from); play_bw = memnew(Button); - play_bw->set_flat(true); + play_bw->set_theme_type_variation("FlatButton"); play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)")); playback_container->add_child(play_bw); stop = memnew(Button); - stop->set_flat(true); + stop->set_theme_type_variation("FlatButton"); stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)")); playback_container->add_child(stop); play = memnew(Button); - play->set_flat(true); + play->set_theme_type_variation("FlatButton"); play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)")); playback_container->add_child(play); play_from = memnew(Button); - play_from->set_flat(true); + play_from->set_theme_type_variation("FlatButton"); play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); playback_container->add_child(play_from); @@ -1778,45 +1778,45 @@ SpriteFramesEditor::SpriteFramesEditor() { hfc->add_child(hbc_actions); load = memnew(Button); - load->set_flat(true); + load->set_theme_type_variation("FlatButton"); hbc_actions->add_child(load); load_sheet = memnew(Button); - load_sheet->set_flat(true); + load_sheet->set_theme_type_variation("FlatButton"); hbc_actions->add_child(load_sheet); hbc_actions->add_child(memnew(VSeparator)); copy = memnew(Button); - copy->set_flat(true); + copy->set_theme_type_variation("FlatButton"); hbc_actions->add_child(copy); paste = memnew(Button); - paste->set_flat(true); + paste->set_theme_type_variation("FlatButton"); hbc_actions->add_child(paste); hbc_actions->add_child(memnew(VSeparator)); empty_before = memnew(Button); - empty_before->set_flat(true); + empty_before->set_theme_type_variation("FlatButton"); hbc_actions->add_child(empty_before); empty_after = memnew(Button); - empty_after->set_flat(true); + empty_after->set_theme_type_variation("FlatButton"); hbc_actions->add_child(empty_after); hbc_actions->add_child(memnew(VSeparator)); move_up = memnew(Button); - move_up->set_flat(true); + move_up->set_theme_type_variation("FlatButton"); hbc_actions->add_child(move_up); move_down = memnew(Button); - move_down->set_flat(true); + move_down->set_theme_type_variation("FlatButton"); hbc_actions->add_child(move_down); delete_frame = memnew(Button); - delete_frame->set_flat(true); + delete_frame->set_theme_type_variation("FlatButton"); hbc_actions->add_child(delete_frame); hbc_actions->add_child(memnew(VSeparator)); @@ -1982,7 +1982,7 @@ SpriteFramesEditor::SpriteFramesEditor() { toggle_settings_button = memnew(Button); toggle_settings_button->set_h_size_flags(SIZE_SHRINK_END); - toggle_settings_button->set_flat(true); + toggle_settings_button->set_theme_type_variation("FlatButton"); toggle_settings_button->connect("pressed", callable_mp(this, &SpriteFramesEditor::_toggle_show_settings)); toggle_settings_button->set_tooltip_text(TTR("Toggle Settings Panel")); split_sheet_menu_hb->add_child(toggle_settings_button); @@ -2020,21 +2020,21 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_zoom_margin->add_child(split_sheet_zoom_hb); split_sheet_zoom_out = memnew(Button); - split_sheet_zoom_out->set_flat(true); + split_sheet_zoom_out->set_theme_type_variation("FlatButton"); split_sheet_zoom_out->set_focus_mode(FOCUS_NONE); split_sheet_zoom_out->set_tooltip_text(TTR("Zoom Out")); split_sheet_zoom_out->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_out)); split_sheet_zoom_hb->add_child(split_sheet_zoom_out); split_sheet_zoom_reset = memnew(Button); - split_sheet_zoom_reset->set_flat(true); + split_sheet_zoom_reset->set_theme_type_variation("FlatButton"); split_sheet_zoom_reset->set_focus_mode(FOCUS_NONE); split_sheet_zoom_reset->set_tooltip_text(TTR("Zoom Reset")); split_sheet_zoom_reset->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_reset)); split_sheet_zoom_hb->add_child(split_sheet_zoom_reset); split_sheet_zoom_in = memnew(Button); - split_sheet_zoom_in->set_flat(true); + split_sheet_zoom_in->set_theme_type_variation("FlatButton"); split_sheet_zoom_in->set_focus_mode(FOCUS_NONE); split_sheet_zoom_in->set_tooltip_text(TTR("Zoom In")); split_sheet_zoom_in->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_in)); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 14a25e4e29b..c157277a353 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -240,7 +240,7 @@ ThemeEditorPreview::ThemeEditorPreview() { picker_button = memnew(Button); preview_toolbar->add_child(picker_button); - picker_button->set_flat(true); + picker_button->set_theme_type_variation("FlatButton"); picker_button->set_toggle_mode(true); picker_button->set_tooltip_text(TTR("Toggle the control picker, allowing to visually select control types for edit.")); picker_button->connect("pressed", callable_mp(this, &ThemeEditorPreview::_picker_button_cbk)); diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 19dd2d51c09..aefad2ec628 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -846,7 +846,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { tools_button_group.instantiate(); button_expand = memnew(Button); - button_expand->set_flat(true); + button_expand->set_theme_type_variation("FlatButton"); button_expand->set_toggle_mode(true); button_expand->set_pressed(false); button_expand->set_tooltip_text(TTR("Expand editor")); @@ -856,7 +856,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { toolbar->add_child(memnew(VSeparator)); button_create = memnew(Button); - button_create->set_flat(true); + button_create->set_theme_type_variation("FlatButton"); button_create->set_toggle_mode(true); button_create->set_button_group(tools_button_group); button_create->set_pressed(true); @@ -864,21 +864,22 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { toolbar->add_child(button_create); button_edit = memnew(Button); - button_edit->set_flat(true); + button_edit->set_theme_type_variation("FlatButton"); button_edit->set_toggle_mode(true); button_edit->set_button_group(tools_button_group); button_edit->set_tooltip_text(TTR("Edit points tool")); toolbar->add_child(button_edit); button_delete = memnew(Button); - button_delete->set_flat(true); + button_delete->set_theme_type_variation("FlatButton"); button_delete->set_toggle_mode(true); button_delete->set_button_group(tools_button_group); button_delete->set_tooltip_text(TTR("Delete points tool")); toolbar->add_child(button_delete); button_advanced_menu = memnew(MenuButton); - button_advanced_menu->set_flat(true); + button_advanced_menu->set_flat(false); + button_advanced_menu->set_theme_type_variation("FlatMenuButton"); button_advanced_menu->set_toggle_mode(true); button_advanced_menu->get_popup()->add_item(TTR("Reset to default tile shape"), RESET_TO_DEFAULT_TILE, Key::F); button_advanced_menu->get_popup()->add_item(TTR("Clear"), CLEAR_TILE, Key::C); @@ -895,7 +896,8 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_pixel_snap = memnew(MenuButton); toolbar->add_child(button_pixel_snap); - button_pixel_snap->set_flat(true); + button_pixel_snap->set_flat(false); + button_pixel_snap->set_theme_type_variation("FlatMenuButton"); button_pixel_snap->set_tooltip_text(TTR("Toggle Grid Snap")); button_pixel_snap->get_popup()->add_item(TTR("Disable Snap"), SNAP_NONE); button_pixel_snap->get_popup()->add_item(TTR("Half-Pixel Snap"), SNAP_HALF_PIXEL); @@ -939,7 +941,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_center_view = memnew(Button); button_center_view->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT, Control::PRESET_MODE_MINSIZE, 5); button_center_view->connect("pressed", callable_mp(this, &GenericTilePolygonEditor::_center_view)); - button_center_view->set_flat(true); + button_center_view->set_theme_type_variation("FlatButton"); button_center_view->set_disabled(true); root->add_child(button_center_view); @@ -1302,7 +1304,7 @@ TileDataDefaultEditor::TileDataDefaultEditor() { add_child(label); picker_button = memnew(Button); - picker_button->set_flat(true); + picker_button->set_theme_type_variation("FlatButton"); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P)); toolbar->add_child(picker_button); @@ -2789,7 +2791,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() { // Toolbar picker_button = memnew(Button); - picker_button->set_flat(true); + picker_button->set_theme_type_variation("FlatButton"); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P)); toolbar->add_child(picker_button); diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 69b702bf3f2..6bee3660cf7 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -2220,7 +2220,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { tool_buttons_group.instantiate(); select_tool_button = memnew(Button); - select_tool_button->set_flat(true); + select_tool_button->set_theme_type_variation("FlatButton"); select_tool_button->set_toggle_mode(true); select_tool_button->set_button_group(tool_buttons_group); select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", TTR("Selection"), Key::S)); @@ -2229,7 +2229,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { viewport_shortcut_buttons.push_back(select_tool_button); paint_tool_button = memnew(Button); - paint_tool_button->set_flat(true); + paint_tool_button->set_theme_type_variation("FlatButton"); paint_tool_button->set_toggle_mode(true); paint_tool_button->set_button_group(tool_buttons_group); paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", TTR("Paint"), Key::D)); @@ -2239,7 +2239,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { viewport_shortcut_buttons.push_back(paint_tool_button); line_tool_button = memnew(Button); - line_tool_button->set_flat(true); + line_tool_button->set_theme_type_variation("FlatButton"); line_tool_button->set_toggle_mode(true); line_tool_button->set_button_group(tool_buttons_group); // TRANSLATORS: This refers to the line tool in the tilemap editor. @@ -2249,7 +2249,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { viewport_shortcut_buttons.push_back(line_tool_button); rect_tool_button = memnew(Button); - rect_tool_button->set_flat(true); + rect_tool_button->set_theme_type_variation("FlatButton"); rect_tool_button->set_toggle_mode(true); rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), Key::R)); @@ -2258,7 +2258,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { viewport_shortcut_buttons.push_back(rect_tool_button); bucket_tool_button = memnew(Button); - bucket_tool_button->set_flat(true); + bucket_tool_button->set_theme_type_variation("FlatButton"); bucket_tool_button->set_toggle_mode(true); bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), Key::B)); @@ -2276,7 +2276,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { // Picker picker_button = memnew(Button); - picker_button->set_flat(true); + picker_button->set_theme_type_variation("FlatButton"); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P)); Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL; @@ -2287,7 +2287,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { // Erase button. erase_button = memnew(Button); - erase_button->set_flat(true); + erase_button->set_theme_type_variation("FlatButton"); erase_button->set_toggle_mode(true); erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E)); erase_button->set_tooltip_text(TTR("Alternatively use RMB to erase tiles.")); @@ -2301,28 +2301,28 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { transform_toolbar->add_child(memnew(VSeparator)); transform_button_rotate_left = memnew(Button); - transform_button_rotate_left->set_flat(true); + transform_button_rotate_left->set_theme_type_variation("FlatButton"); transform_button_rotate_left->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_left", TTR("Rotate Tile Left"), Key::Z)); transform_toolbar->add_child(transform_button_rotate_left); transform_button_rotate_left->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_LEFT)); viewport_shortcut_buttons.push_back(transform_button_rotate_left); transform_button_rotate_right = memnew(Button); - transform_button_rotate_right->set_flat(true); + transform_button_rotate_right->set_theme_type_variation("FlatButton"); transform_button_rotate_right->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_right", TTR("Rotate Tile Right"), Key::X)); transform_toolbar->add_child(transform_button_rotate_right); transform_button_rotate_right->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_RIGHT)); viewport_shortcut_buttons.push_back(transform_button_rotate_right); transform_button_flip_h = memnew(Button); - transform_button_flip_h->set_flat(true); + transform_button_flip_h->set_theme_type_variation("FlatButton"); transform_button_flip_h->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_horizontal", TTR("Flip Tile Horizontally"), Key::C)); transform_toolbar->add_child(transform_button_flip_h); transform_button_flip_h->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_H)); viewport_shortcut_buttons.push_back(transform_button_flip_h); transform_button_flip_v = memnew(Button); - transform_button_flip_v->set_flat(true); + transform_button_flip_v->set_theme_type_variation("FlatButton"); transform_button_flip_v->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_vertical", TTR("Flip Tile Vertically"), Key::V)); transform_toolbar->add_child(transform_button_flip_v); transform_button_flip_v->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_V)); @@ -2341,7 +2341,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { // Random tile checkbox. random_tile_toggle = memnew(Button); - random_tile_toggle->set_flat(true); + random_tile_toggle->set_theme_type_variation("FlatButton"); random_tile_toggle->set_toggle_mode(true); random_tile_toggle->set_tooltip_text(TTR("Place Random Tile")); random_tile_toggle->connect("toggled", callable_mp(this, &TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled)); @@ -2404,7 +2404,8 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { sources_bottom_actions->set_alignment(HBoxContainer::ALIGNMENT_END); source_sort_button = memnew(MenuButton); - source_sort_button->set_flat(true); + source_sort_button->set_flat(false); + source_sort_button->set_theme_type_variation("FlatMenuButton"); source_sort_button->set_tooltip_text(TTR("Sort sources")); PopupMenu *p = source_sort_button->get_popup(); @@ -3569,7 +3570,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { tool_buttons_group.instantiate(); paint_tool_button = memnew(Button); - paint_tool_button->set_flat(true); + paint_tool_button->set_theme_type_variation("FlatButton"); paint_tool_button->set_toggle_mode(true); paint_tool_button->set_button_group(tool_buttons_group); paint_tool_button->set_pressed(true); @@ -3579,7 +3580,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { viewport_shortcut_buttons.push_back(paint_tool_button); line_tool_button = memnew(Button); - line_tool_button->set_flat(true); + line_tool_button->set_theme_type_variation("FlatButton"); line_tool_button->set_toggle_mode(true); line_tool_button->set_button_group(tool_buttons_group); line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", TTR("Line"), Key::L)); @@ -3588,7 +3589,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { viewport_shortcut_buttons.push_back(line_tool_button); rect_tool_button = memnew(Button); - rect_tool_button->set_flat(true); + rect_tool_button->set_theme_type_variation("FlatButton"); rect_tool_button->set_toggle_mode(true); rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), Key::R)); @@ -3597,7 +3598,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { viewport_shortcut_buttons.push_back(rect_tool_button); bucket_tool_button = memnew(Button); - bucket_tool_button->set_flat(true); + bucket_tool_button->set_theme_type_variation("FlatButton"); bucket_tool_button->set_toggle_mode(true); bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), Key::B)); @@ -3616,7 +3617,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { // Picker picker_button = memnew(Button); - picker_button->set_flat(true); + picker_button->set_theme_type_variation("FlatButton"); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P)); picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); @@ -3625,7 +3626,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { // Erase button. erase_button = memnew(Button); - erase_button->set_flat(true); + erase_button->set_theme_type_variation("FlatButton"); erase_button->set_toggle_mode(true); erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E)); erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); @@ -4240,7 +4241,7 @@ TileMapEditor::TileMapEditor() { tile_map_toolbar->add_child(layers_selection_button); toggle_highlight_selected_layer_button = memnew(Button); - toggle_highlight_selected_layer_button->set_flat(true); + toggle_highlight_selected_layer_button->set_theme_type_variation("FlatButton"); toggle_highlight_selected_layer_button->set_toggle_mode(true); toggle_highlight_selected_layer_button->set_pressed(true); toggle_highlight_selected_layer_button->connect("pressed", callable_mp(this, &TileMapEditor::_update_layers_selection)); @@ -4251,7 +4252,7 @@ TileMapEditor::TileMapEditor() { // Grid toggle. toggle_grid_button = memnew(Button); - toggle_grid_button->set_flat(true); + toggle_grid_button->set_theme_type_variation("FlatButton"); toggle_grid_button->set_toggle_mode(true); toggle_grid_button->set_tooltip_text(TTR("Toggle grid visibility.")); toggle_grid_button->connect("toggled", callable_mp(this, &TileMapEditor::_on_grid_toggled)); @@ -4259,7 +4260,8 @@ TileMapEditor::TileMapEditor() { // Advanced settings menu button. advanced_menu_button = memnew(MenuButton); - advanced_menu_button->set_flat(true); + advanced_menu_button->set_flat(false); + advanced_menu_button->set_theme_type_variation("FlatButton"); advanced_menu_button->get_popup()->add_item(TTR("Automatically Replace Tiles with Proxies")); advanced_menu_button->get_popup()->connect("id_pressed", callable_mp(this, &TileMapEditor::_advanced_menu_button_id_pressed)); tile_map_toolbar->add_child(advanced_menu_button); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 4037655e2c2..ee32083628f 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2491,7 +2491,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_setup_atlas_source_button = memnew(Button); tool_setup_atlas_source_button->set_text(TTR("Setup")); - tool_setup_atlas_source_button->set_flat(true); + tool_setup_atlas_source_button->set_theme_type_variation("FlatButton"); tool_setup_atlas_source_button->set_toggle_mode(true); tool_setup_atlas_source_button->set_pressed(true); tool_setup_atlas_source_button->set_button_group(tools_button_group); @@ -2500,7 +2500,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_select_button = memnew(Button); tool_select_button->set_text(TTR("Select")); - tool_select_button->set_flat(true); + tool_select_button->set_theme_type_variation("FlatButton"); tool_select_button->set_toggle_mode(true); tool_select_button->set_pressed(false); tool_select_button->set_button_group(tools_button_group); @@ -2509,7 +2509,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_paint_button = memnew(Button); tool_paint_button->set_text(TTR("Paint")); - tool_paint_button->set_flat(true); + tool_paint_button->set_theme_type_variation("FlatButton"); tool_paint_button->set_toggle_mode(true); tool_paint_button->set_button_group(tools_button_group); tool_paint_button->set_tooltip_text(TTR("Paint properties.")); @@ -2592,14 +2592,15 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_settings->add_child(tool_settings_tile_data_toolbar_container); tools_settings_erase_button = memnew(Button); - tools_settings_erase_button->set_flat(true); + tools_settings_erase_button->set_theme_type_variation("FlatButton"); tools_settings_erase_button->set_toggle_mode(true); tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E)); tools_settings_erase_button->set_shortcut_context(this); tool_settings->add_child(tools_settings_erase_button); tool_advanced_menu_button = memnew(MenuButton); - tool_advanced_menu_button->set_flat(true); + tool_advanced_menu_button->set_flat(false); + tool_advanced_menu_button->set_theme_type_variation("FlatMenuButton"); tool_advanced_menu_button->get_popup()->add_item(TTR("Create Tiles in Non-Transparent Texture Regions"), ADVANCED_AUTO_CREATE_TILES); tool_advanced_menu_button->get_popup()->add_item(TTR("Remove Tiles in Fully Transparent Texture Regions"), ADVANCED_AUTO_REMOVE_TILES); tool_advanced_menu_button->get_popup()->add_item(TTR("Remove Tiles Outside the Texture"), ADVANCED_CLEANUP_TILES); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 0209e6a6d6e..5bde1f754bb 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -842,7 +842,8 @@ TileSetEditor::TileSetEditor() { split_container->add_child(split_container_left_side); source_sort_button = memnew(MenuButton); - source_sort_button->set_flat(true); + source_sort_button->set_flat(false); + source_sort_button->set_theme_type_variation("FlatButton"); source_sort_button->set_tooltip_text(TTR("Sort Sources")); PopupMenu *p = source_sort_button->get_popup(); @@ -871,20 +872,22 @@ TileSetEditor::TileSetEditor() { split_container_left_side->add_child(sources_bottom_actions); sources_delete_button = memnew(Button); - sources_delete_button->set_flat(true); + sources_delete_button->set_theme_type_variation("FlatButton"); sources_delete_button->set_disabled(true); sources_delete_button->connect("pressed", callable_mp(this, &TileSetEditor::_source_delete_pressed)); sources_bottom_actions->add_child(sources_delete_button); sources_add_button = memnew(MenuButton); - sources_add_button->set_flat(true); + sources_add_button->set_flat(false); + sources_add_button->set_theme_type_variation("FlatButton"); sources_add_button->get_popup()->add_item(TTR("Atlas")); sources_add_button->get_popup()->add_item(TTR("Scenes Collection")); sources_add_button->get_popup()->connect("id_pressed", callable_mp(this, &TileSetEditor::_source_add_id_pressed)); sources_bottom_actions->add_child(sources_add_button); sources_advanced_menu_button = memnew(MenuButton); - sources_advanced_menu_button->set_flat(true); + sources_advanced_menu_button->set_flat(false); + sources_advanced_menu_button->set_theme_type_variation("FlatButton"); sources_advanced_menu_button->get_popup()->add_item(TTR("Open Atlas Merging Tool")); sources_advanced_menu_button->get_popup()->add_item(TTR("Manage Tile Proxies")); sources_advanced_menu_button->get_popup()->connect("id_pressed", callable_mp(this, &TileSetEditor::_sources_advanced_menu_id_pressed)); diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 939ee5f0568..eaf7a2b50b3 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -563,12 +563,12 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() { right_vbox_container->add_child(scenes_bottom_actions); scene_tile_add_button = memnew(Button); - scene_tile_add_button->set_flat(true); + scene_tile_add_button->set_theme_type_variation("FlatButton"); scene_tile_add_button->connect("pressed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_add_pressed)); scenes_bottom_actions->add_child(scene_tile_add_button); scene_tile_delete_button = memnew(Button); - scene_tile_delete_button->set_flat(true); + scene_tile_delete_button->set_theme_type_variation("FlatButton"); scene_tile_delete_button->set_disabled(true); scene_tile_delete_button->connect("pressed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_delete_pressed)); scenes_bottom_actions->add_child(scene_tile_delete_button); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index d6b08b42cb7..afc929b5478 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -1160,7 +1160,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { refresh_button = memnew(Button); refresh_button->set_tooltip_text(TTR("Detect new changes")); - refresh_button->set_flat(true); + refresh_button->set_theme_type_variation("FlatButton"); refresh_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons))); refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_commit_list)); @@ -1183,11 +1183,11 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { discard_all_button->set_tooltip_text(TTR("Discard all changes")); discard_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Close"), EditorStringName(EditorIcons))); discard_all_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_confirm_discard_all)); - discard_all_button->set_flat(true); + discard_all_button->set_theme_type_variation("FlatButton"); unstage_title->add_child(discard_all_button); stage_all_button = memnew(Button); - stage_all_button->set_flat(true); + stage_all_button->set_theme_type_variation("FlatButton"); stage_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons))); stage_all_button->set_tooltip_text(TTR("Stage all changes")); unstage_title->add_child(stage_all_button); @@ -1217,7 +1217,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_title->add_child(stage_label); unstage_all_button = memnew(Button); - unstage_all_button->set_flat(true); + unstage_all_button->set_theme_type_variation("FlatButton"); unstage_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons))); unstage_all_button->set_tooltip_text(TTR("Unstage all changes")); stage_title->add_child(unstage_all_button); @@ -1411,21 +1411,21 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { remote_create_hbc->add_child(remote_create_url_input); fetch_button = memnew(Button); - fetch_button->set_flat(true); + fetch_button->set_theme_type_variation("FlatButton"); fetch_button->set_tooltip_text(TTR("Fetch")); fetch_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons))); fetch_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_fetch)); menu_bar->add_child(fetch_button); pull_button = memnew(Button); - pull_button->set_flat(true); + pull_button->set_theme_type_variation("FlatButton"); pull_button->set_tooltip_text(TTR("Pull")); pull_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons))); pull_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_pull)); menu_bar->add_child(pull_button); push_button = memnew(Button); - push_button->set_flat(true); + push_button->set_theme_type_variation("FlatButton"); push_button->set_tooltip_text(TTR("Push")); push_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons))); push_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_push)); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d952a7be1ec..25cbbbf6de0 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -5268,7 +5268,7 @@ VisualShaderEditor::VisualShaderEditor() { varying_menu->connect("id_pressed", callable_mp(this, &VisualShaderEditor::_varying_menu_id_pressed)); preview_shader = memnew(Button); - preview_shader->set_flat(true); + preview_shader->set_theme_type_variation("FlatButton"); preview_shader->set_toggle_mode(true); preview_shader->set_tooltip_text(TTR("Show generated shader code.")); graph->get_menu_hbox()->add_child(preview_shader); diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp index 1c6dcc8b86d..5129fae176d 100644 --- a/editor/plugins/voxel_gi_editor_plugin.cpp +++ b/editor/plugins/voxel_gi_editor_plugin.cpp @@ -185,7 +185,7 @@ VoxelGIEditorPlugin::VoxelGIEditorPlugin() { bake_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); bake_hb->hide(); bake = memnew(Button); - bake->set_flat(true); + bake->set_theme_type_variation("FlatButton"); // TODO: Rework this as a dedicated toolbar control so we can hook into theme changes and update it // when the editor theme updates. bake->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons))); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 6a20768583f..b5a53fa1bf3 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -1291,14 +1291,14 @@ GridMapEditor::GridMapEditor() { search_box->connect("gui_input", callable_mp(this, &GridMapEditor::_sbox_input)); mode_thumbnail = memnew(Button); - mode_thumbnail->set_flat(true); + mode_thumbnail->set_theme_type_variation("FlatButton"); mode_thumbnail->set_toggle_mode(true); mode_thumbnail->set_pressed(true); hb->add_child(mode_thumbnail); mode_thumbnail->connect("pressed", callable_mp(this, &GridMapEditor::_set_display_mode).bind(DISPLAY_THUMBNAIL)); mode_list = memnew(Button); - mode_list->set_flat(true); + mode_list->set_theme_type_variation("FlatButton"); mode_list->set_toggle_mode(true); mode_list->set_pressed(false); hb->add_child(mode_list); diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 1c7546436bf..89249dd369e 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -245,24 +245,29 @@ ReplicationEditor::ReplicationEditor() { add_pick_button->connect("pressed", callable_mp(this, &ReplicationEditor::_pick_new_property)); add_pick_button->set_text(TTR("Add property to sync...")); hb->add_child(add_pick_button); + VSeparator *vs = memnew(VSeparator); vs->set_custom_minimum_size(Size2(30 * EDSCALE, 0)); hb->add_child(vs); hb->add_child(memnew(Label(TTR("Path:")))); + np_line_edit = memnew(LineEdit); np_line_edit->set_placeholder(":property"); np_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); np_line_edit->connect("text_submitted", callable_mp(this, &ReplicationEditor::_np_text_submitted)); hb->add_child(np_line_edit); + add_from_path_button = memnew(Button); add_from_path_button->connect("pressed", callable_mp(this, &ReplicationEditor::_add_pressed)); add_from_path_button->set_text(TTR("Add from path")); hb->add_child(add_from_path_button); + vs = memnew(VSeparator); vs->set_custom_minimum_size(Size2(30 * EDSCALE, 0)); hb->add_child(vs); + pin = memnew(Button); - pin->set_flat(true); + pin->set_theme_type_variation("FlatButton"); pin->set_toggle_mode(true); hb->add_child(pin); diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp index 85948e75478..d6c31ca35e5 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp @@ -134,7 +134,7 @@ NavigationMeshEditor::NavigationMeshEditor() { bake_hbox = memnew(HBoxContainer); button_bake = memnew(Button); - button_bake->set_flat(true); + button_bake->set_theme_type_variation("FlatButton"); bake_hbox->add_child(button_bake); button_bake->set_toggle_mode(true); button_bake->set_text(TTR("Bake NavigationMesh")); @@ -142,7 +142,7 @@ NavigationMeshEditor::NavigationMeshEditor() { button_bake->connect("pressed", callable_mp(this, &NavigationMeshEditor::_bake_pressed)); button_reset = memnew(Button); - button_reset->set_flat(true); + button_reset->set_theme_type_variation("FlatButton"); bake_hbox->add_child(button_reset); button_reset->set_text(TTR("Clear NavigationMesh")); button_reset->set_tooltip_text(TTR("Clears the internal NavigationMesh vertices and polygons.")); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index d27a40779e5..7af7b2cf7ee 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -1084,13 +1084,13 @@ FileDialog::FileDialog() { HBoxContainer *hbc = memnew(HBoxContainer); dir_prev = memnew(Button); - dir_prev->set_flat(true); + dir_prev->set_theme_type_variation("FlatButton"); dir_prev->set_tooltip_text(RTR("Go to previous folder.")); dir_next = memnew(Button); - dir_next->set_flat(true); + dir_next->set_theme_type_variation("FlatButton"); dir_next->set_tooltip_text(RTR("Go to next folder.")); dir_up = memnew(Button); - dir_up->set_flat(true); + dir_up->set_theme_type_variation("FlatButton"); dir_up->set_tooltip_text(RTR("Go to parent folder.")); hbc->add_child(dir_prev); hbc->add_child(dir_next); @@ -1114,13 +1114,13 @@ FileDialog::FileDialog() { dir->set_h_size_flags(Control::SIZE_EXPAND_FILL); refresh = memnew(Button); - refresh->set_flat(true); + refresh->set_theme_type_variation("FlatButton"); refresh->set_tooltip_text(RTR("Refresh files.")); refresh->connect("pressed", callable_mp(this, &FileDialog::update_file_list)); hbc->add_child(refresh); show_hidden = memnew(Button); - show_hidden->set_flat(true); + show_hidden->set_theme_type_variation("FlatButton"); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip_text(RTR("Toggle the visibility of hidden files.")); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index e37a3671f39..6e12e7f1960 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1988,28 +1988,28 @@ GraphEdit::GraphEdit() { _update_zoom_label(); zoom_minus_button = memnew(Button); - zoom_minus_button->set_flat(true); + zoom_minus_button->set_theme_type_variation("FlatButton"); menu_hbox->add_child(zoom_minus_button); zoom_minus_button->set_tooltip_text(RTR("Zoom Out")); zoom_minus_button->connect("pressed", callable_mp(this, &GraphEdit::_zoom_minus)); zoom_minus_button->set_focus_mode(FOCUS_NONE); zoom_reset_button = memnew(Button); - zoom_reset_button->set_flat(true); + zoom_reset_button->set_theme_type_variation("FlatButton"); menu_hbox->add_child(zoom_reset_button); zoom_reset_button->set_tooltip_text(RTR("Zoom Reset")); zoom_reset_button->connect("pressed", callable_mp(this, &GraphEdit::_zoom_reset)); zoom_reset_button->set_focus_mode(FOCUS_NONE); zoom_plus_button = memnew(Button); - zoom_plus_button->set_flat(true); + zoom_plus_button->set_theme_type_variation("FlatButton"); menu_hbox->add_child(zoom_plus_button); zoom_plus_button->set_tooltip_text(RTR("Zoom In")); zoom_plus_button->connect("pressed", callable_mp(this, &GraphEdit::_zoom_plus)); zoom_plus_button->set_focus_mode(FOCUS_NONE); show_grid_button = memnew(Button); - show_grid_button->set_flat(true); + show_grid_button->set_theme_type_variation("FlatButton"); show_grid_button->set_toggle_mode(true); show_grid_button->set_tooltip_text(RTR("Toggle the visual grid.")); show_grid_button->connect("pressed", callable_mp(this, &GraphEdit::_show_grid_toggled)); @@ -2018,7 +2018,7 @@ GraphEdit::GraphEdit() { menu_hbox->add_child(show_grid_button); toggle_snapping_button = memnew(Button); - toggle_snapping_button->set_flat(true); + toggle_snapping_button->set_theme_type_variation("FlatButton"); toggle_snapping_button->set_toggle_mode(true); toggle_snapping_button->set_tooltip_text(RTR("Toggle snapping to the grid.")); toggle_snapping_button->connect("pressed", callable_mp(this, &GraphEdit::_snapping_toggled)); @@ -2036,7 +2036,7 @@ GraphEdit::GraphEdit() { menu_hbox->add_child(snapping_distance_spinbox); minimap_button = memnew(Button); - minimap_button->set_flat(true); + minimap_button->set_theme_type_variation("FlatButton"); minimap_button->set_toggle_mode(true); minimap_button->set_tooltip_text(RTR("Toggle the graph minimap.")); minimap_button->connect("pressed", callable_mp(this, &GraphEdit::_minimap_toggled)); @@ -2045,7 +2045,7 @@ GraphEdit::GraphEdit() { menu_hbox->add_child(minimap_button); layout_button = memnew(Button); - layout_button->set_flat(true); + layout_button->set_theme_type_variation("FlatButton"); menu_hbox->add_child(layout_button); layout_button->set_tooltip_text(RTR("Automatically arrange selected nodes.")); layout_button->connect("pressed", callable_mp(this, &GraphEdit::arrange_nodes)); diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp index ef4afbb5fa5..b65c372fab8 100644 --- a/scene/theme/default_theme.cpp +++ b/scene/theme/default_theme.cpp @@ -360,6 +360,28 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("check_v_offset", "CheckButton", 0); theme->set_constant("outline_size", "CheckButton", 0); + // Button variations + + theme->set_type_variation("FlatButton", "Button"); + theme->set_type_variation("FlatMenuButton", "MenuButton"); + + Ref flat_button_normal = make_empty_stylebox(); + for (int i = 0; i < 4; i++) { + flat_button_normal->set_content_margin((Side)i, button_normal->get_margin((Side)i) + button_normal->get_border_width((Side)i)); + } + Ref flat_button_pressed = button_pressed->duplicate(); + flat_button_pressed->set_bg_color(style_pressed_color * Color(1, 1, 1, 0.85)); + + theme->set_stylebox("normal", "FlatButton", flat_button_normal); + theme->set_stylebox("hover", "FlatButton", flat_button_normal); + theme->set_stylebox("pressed", "FlatButton", flat_button_pressed); + theme->set_stylebox("disabled", "FlatButton", flat_button_normal); + + theme->set_stylebox("normal", "FlatMenuButton", flat_button_normal); + theme->set_stylebox("hover", "FlatMenuButton", flat_button_normal); + theme->set_stylebox("pressed", "FlatMenuButton", flat_button_pressed); + theme->set_stylebox("disabled", "FlatMenuButton", flat_button_normal); + // Label theme->set_stylebox("normal", "Label", memnew(StyleBoxEmpty));