Replace flat buttons with flat-styled buttons with a visible pressed state

This commit is contained in:
Yuri Sizov 2023-09-19 18:03:10 +02:00
parent 571cd0eb79
commit 4bd569be95
40 changed files with 291 additions and 212 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -949,7 +949,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> 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
@ -1020,6 +1020,30 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("h_separation", "Button", 4 * EDSCALE);
theme->set_constant("outline_size", "Button", 0);
// Flat button variations.
Ref<StyleBoxEmpty> 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<StyleBoxFlat> 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");

View File

@ -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));

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -1652,7 +1652,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);
@ -1661,7 +1661,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);
@ -1669,7 +1669,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);
@ -1682,7 +1682,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);
@ -1697,7 +1697,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);

View File

@ -5173,7 +5173,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));
@ -5185,7 +5185,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));
@ -5194,7 +5194,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));
@ -5203,7 +5203,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));
@ -5214,21 +5214,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));
@ -5237,7 +5237,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));
@ -5248,7 +5248,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));
@ -5257,7 +5257,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));
@ -5266,6 +5266,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);
@ -5299,7 +5301,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));
@ -5308,7 +5310,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."));
@ -5316,7 +5318,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."));
@ -5324,7 +5326,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."));
@ -5334,6 +5336,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"));
@ -5349,7 +5353,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);
@ -5359,6 +5363,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);
@ -5424,7 +5430,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);
@ -5433,7 +5439,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);
@ -5442,7 +5448,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));
@ -5450,7 +5456,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)."));
@ -5459,7 +5465,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."));
@ -5468,6 +5474,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);

View File

@ -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);

View File

@ -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));

View File

@ -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)));

View File

@ -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);

View File

@ -8218,7 +8218,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));
@ -8229,7 +8229,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));
@ -8238,7 +8238,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);
@ -8246,7 +8246,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);
@ -8256,13 +8256,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.
@ -8270,7 +8270,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.
@ -8278,7 +8278,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.
@ -8286,7 +8286,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.
@ -8297,7 +8297,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);
@ -8305,7 +8305,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);
@ -8315,7 +8315,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);
@ -8324,7 +8324,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);
@ -8334,7 +8334,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);
@ -8343,7 +8343,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);
@ -8379,6 +8379,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);
@ -8394,6 +8396,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);

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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"));

View File

@ -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));
@ -1358,6 +1358,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);
@ -1370,7 +1372,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);
@ -1380,7 +1382,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);

View File

@ -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);

View File

@ -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."));

View File

@ -1656,12 +1656,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));
@ -1672,7 +1672,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);
@ -1680,7 +1680,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);
@ -1739,27 +1739,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);
@ -1777,45 +1777,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));
@ -1981,7 +1981,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);
@ -2019,21 +2019,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));

View File

@ -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));

View File

@ -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);

View File

@ -2204,7 +2204,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));
@ -2213,7 +2213,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));
@ -2223,7 +2223,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.
@ -2233,7 +2233,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));
@ -2242,7 +2242,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));
@ -2260,7 +2260,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));
picker_button->set_tooltip_text(TTR("Alternatively hold Ctrl with other tools to pick tile."));
@ -2270,7 +2270,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."));
@ -2284,28 +2284,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));
@ -2324,7 +2324,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));
@ -2387,7 +2387,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();
@ -3552,7 +3553,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);
@ -3562,7 +3563,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));
@ -3571,7 +3572,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));
@ -3580,7 +3581,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));
@ -3599,7 +3600,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));
@ -3608,7 +3609,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));
@ -4223,7 +4224,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));
@ -4234,7 +4235,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));
@ -4242,7 +4243,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);

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -5265,7 +5265,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);

View File

@ -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)));

View File

@ -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);

View File

@ -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);

View File

@ -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."));

View File

@ -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."));

View File

@ -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));

View File

@ -360,6 +360,28 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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<StyleBoxEmpty> 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<StyleBoxFlat> 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));