1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add support for partial custom editor themes

This commit is contained in:
Yuri Sizov
2021-08-14 01:06:21 +03:00
parent 632844e464
commit ab25266213
5 changed files with 103 additions and 16 deletions

View File

@@ -4198,6 +4198,10 @@ void CanvasItemEditor::_notification(int p_what) {
font->set_outline_color(Color(0, 0, 0));
zoom_reset->add_font_override("font", font);
zoom_reset->add_color_override("font_color", Color(1, 1, 1));
info_overlay->get_theme()->set_stylebox("normal", "Label", get_stylebox("CanvasItemInfoOverlay", "EditorStyles"));
warning_child_of_container->add_color_override("font_color", get_color("warning_color", "Editor"));
warning_child_of_container->add_font_override("font", get_font("main", "EditorFonts"));
}
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
@@ -5778,20 +5782,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
info_overlay->add_constant_override("separation", 10);
viewport_scrollable->add_child(info_overlay);
// Make sure all labels inside of the container are styled the same.
Theme *info_overlay_theme = memnew(Theme);
info_overlay_theme->copy_default_theme();
info_overlay->set_theme(info_overlay_theme);
StyleBoxFlat *info_overlay_label_stylebox = memnew(StyleBoxFlat);
info_overlay_label_stylebox->set_bg_color(Color(0.0, 0.0, 0.0, 0.2));
info_overlay_label_stylebox->set_expand_margin_size_all(4);
info_overlay_theme->set_stylebox("normal", "Label", info_overlay_label_stylebox);
warning_child_of_container = memnew(Label);
warning_child_of_container->hide();
warning_child_of_container->set_text(TTR("Warning: Children of a container get their position and size determined only by their parent."));
warning_child_of_container->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor"));
warning_child_of_container->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts"));
add_control_to_info_overlay(warning_child_of_container);
h_scroll = memnew(HScrollBar);