Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions editor/scene/gui/theme_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2674,19 +2674,20 @@ void ThemeTypeEditor::_update_type_items() {
if (E.value) {
if (edited_theme->has_font(E.key, edited_type)) {
item_editor->set_edited_resource(edited_theme->get_font(E.key, edited_type));
item_editor->set_force_allow_unique(false);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item));
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_font_item_changed).bind(E.key));
} else {
if (ThemeDB::get_singleton()->get_default_theme()->has_font(E.key, edited_type)) {
item_editor->set_edited_resource(ThemeDB::get_singleton()->get_default_theme()->get_font(E.key, edited_type));
item_editor->set_force_allow_unique(true);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->set_editable(false);
}
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_font_item_changed).bind(E.key));

_add_focusable(item_editor);
font_items_list->add_child(item_control);
Expand Down Expand Up @@ -2747,19 +2748,20 @@ void ThemeTypeEditor::_update_type_items() {
if (E.value) {
if (edited_theme->has_icon(E.key, edited_type)) {
item_editor->set_edited_resource(edited_theme->get_icon(E.key, edited_type));
item_editor->set_force_allow_unique(false);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item));
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_icon_item_changed).bind(E.key));
} else {
if (ThemeDB::get_singleton()->get_default_theme()->has_icon(E.key, edited_type)) {
item_editor->set_edited_resource(ThemeDB::get_singleton()->get_default_theme()->get_icon(E.key, edited_type));
item_editor->set_force_allow_unique(true);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->set_editable(false);
}
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_icon_item_changed).bind(E.key));

_add_focusable(item_editor);
icon_items_list->add_child(item_control);
Expand Down Expand Up @@ -2821,11 +2823,11 @@ void ThemeTypeEditor::_update_type_items() {
if (E.value) {
if (edited_theme->has_stylebox(E.key, edited_type)) {
item_editor->set_edited_resource(edited_theme->get_stylebox(E.key, edited_type));
item_editor->set_force_allow_unique(false);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->connect("resource_selected", callable_mp(this, &ThemeTypeEditor::_edit_resource_item));
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_stylebox_item_changed).bind(E.key));

Button *pin_leader_button = memnew(Button);
pin_leader_button->set_flat(true);
Expand All @@ -2838,11 +2840,12 @@ void ThemeTypeEditor::_update_type_items() {
} else {
if (ThemeDB::get_singleton()->get_default_theme()->has_stylebox(E.key, edited_type)) {
item_editor->set_edited_resource(ThemeDB::get_singleton()->get_default_theme()->get_stylebox(E.key, edited_type));
item_editor->set_force_allow_unique(true);
} else {
item_editor->set_edited_resource(Ref<Resource>());
}
item_editor->set_editable(false);
}
item_editor->connect("resource_changed", callable_mp(this, &ThemeTypeEditor::_stylebox_item_changed).bind(E.key));

item_control->add_child(item_editor);
_add_focusable(item_editor);
Expand Down Expand Up @@ -3281,7 +3284,7 @@ void ThemeTypeEditor::_font_item_changed(Ref<Font> p_value, String p_item_name)
if (edited_theme->has_font(p_item_name, edited_type)) {
ur->add_undo_method(*edited_theme, "set_font", p_item_name, edited_type, edited_theme->get_font(p_item_name, edited_type));
} else {
ur->add_undo_method(*edited_theme, "set_font", p_item_name, edited_type, Ref<Font>());
ur->add_undo_method(*edited_theme, "clear_font", p_item_name, edited_type);
}

ur->add_do_method(this, CoreStringName(call_deferred), "_update_type_items");
Expand All @@ -3298,7 +3301,7 @@ void ThemeTypeEditor::_icon_item_changed(Ref<Texture2D> p_value, String p_item_n
if (edited_theme->has_icon(p_item_name, edited_type)) {
ur->add_undo_method(*edited_theme, "set_icon", p_item_name, edited_type, edited_theme->get_icon(p_item_name, edited_type));
} else {
ur->add_undo_method(*edited_theme, "set_icon", p_item_name, edited_type, Ref<Texture2D>());
ur->add_undo_method(*edited_theme, "clear_icon", p_item_name, edited_type);
}

ur->add_do_method(this, CoreStringName(call_deferred), "_update_type_items");
Expand All @@ -3315,7 +3318,7 @@ void ThemeTypeEditor::_stylebox_item_changed(Ref<StyleBox> p_value, String p_ite
if (edited_theme->has_stylebox(p_item_name, edited_type)) {
ur->add_undo_method(*edited_theme, "set_stylebox", p_item_name, edited_type, edited_theme->get_stylebox(p_item_name, edited_type));
} else {
ur->add_undo_method(*edited_theme, "set_stylebox", p_item_name, edited_type, Ref<StyleBox>());
ur->add_undo_method(*edited_theme, "clear_stylebox", p_item_name, edited_type);
}

ur->add_do_method(this, "_change_pinned_stylebox");
Expand Down
Loading