Create a MainScreenButton theme variation
This turns custom font theme properties into a proper variation, which makes applying it simpler.
This commit is contained in:
parent
51991e2014
commit
7496f99060
|
@ -519,11 +519,6 @@ void EditorNode::_update_theme(bool p_skip_creation) {
|
|||
help_menu->set_item_icon(help_menu->get_item_index(HELP_ABOUT), theme->get_icon(SNAME("Godot"), EditorStringName(EditorIcons)));
|
||||
help_menu->set_item_icon(help_menu->get_item_index(HELP_SUPPORT_GODOT_DEVELOPMENT), theme->get_icon(SNAME("Heart"), EditorStringName(EditorIcons)));
|
||||
|
||||
for (int i = 0; i < main_editor_buttons.size(); i++) {
|
||||
main_editor_buttons.write[i]->add_theme_font_override("font", theme->get_font(SNAME("main_button_font"), EditorStringName(EditorFonts)));
|
||||
main_editor_buttons.write[i]->add_theme_font_size_override("font_size", theme->get_font_size(SNAME("main_button_font_size"), EditorStringName(EditorFonts)));
|
||||
}
|
||||
|
||||
if (EditorDebuggerNode::get_singleton()->is_visible()) {
|
||||
bottom_panel->add_theme_style_override("panel", theme->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles)));
|
||||
}
|
||||
|
@ -3279,21 +3274,21 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
|
|||
Button *tb = memnew(Button);
|
||||
tb->set_flat(true);
|
||||
tb->set_toggle_mode(true);
|
||||
tb->connect("pressed", callable_mp(singleton, &EditorNode::editor_select).bind(singleton->main_editor_buttons.size()));
|
||||
tb->set_theme_type_variation("MainScreenButton");
|
||||
tb->set_name(p_editor->get_name());
|
||||
tb->set_text(p_editor->get_name());
|
||||
|
||||
Ref<Texture2D> icon = p_editor->get_icon();
|
||||
if (icon.is_null() && singleton->theme->has_icon(p_editor->get_name(), EditorStringName(EditorIcons))) {
|
||||
icon = singleton->theme->get_icon(p_editor->get_name(), EditorStringName(EditorIcons));
|
||||
}
|
||||
if (icon.is_valid()) {
|
||||
tb->set_icon(icon);
|
||||
// Make sure the control is updated if the icon is reimported.
|
||||
icon->connect_changed(callable_mp((Control *)tb, &Control::update_minimum_size));
|
||||
} else if (singleton->theme->has_icon(p_editor->get_name(), EditorStringName(EditorIcons))) {
|
||||
tb->set_icon(singleton->theme->get_icon(p_editor->get_name(), EditorStringName(EditorIcons)));
|
||||
}
|
||||
|
||||
tb->add_theme_font_override("font", singleton->theme->get_font(SNAME("main_button_font"), EditorStringName(EditorFonts)));
|
||||
tb->add_theme_font_size_override("font_size", singleton->theme->get_font_size(SNAME("main_button_font_size"), EditorStringName(EditorFonts)));
|
||||
tb->connect("pressed", callable_mp(singleton, &EditorNode::editor_select).bind(singleton->main_editor_buttons.size()));
|
||||
|
||||
singleton->main_editor_buttons.push_back(tb);
|
||||
singleton->main_editor_button_hb->add_child(tb);
|
||||
|
|
|
@ -390,8 +390,9 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
|
|||
p_theme->set_font("title", EditorStringName(EditorFonts), bold_fc);
|
||||
p_theme->set_font_size("title_size", EditorStringName(EditorFonts), default_font_size + 1 * EDSCALE);
|
||||
|
||||
p_theme->set_font("main_button_font", EditorStringName(EditorFonts), bold_fc);
|
||||
p_theme->set_font_size("main_button_font_size", EditorStringName(EditorFonts), default_font_size + 1 * EDSCALE);
|
||||
p_theme->set_type_variation("MainScreenButton", "Button");
|
||||
p_theme->set_font("font", "MainScreenButton", bold_fc);
|
||||
p_theme->set_font_size("font_size", "MainScreenButton", default_font_size + 2 * EDSCALE);
|
||||
|
||||
p_theme->set_font("font", "Label", default_fc);
|
||||
|
||||
|
|
Loading…
Reference in New Issue