Merge pull request #102372 from Rindbee/display-the-actual-used-theme-items-in-the-Inspector

Display the actual used theme items in the Inspector
This commit is contained in:
Thaddeus Crews 2025-03-11 16:53:55 -05:00
commit 3bc2821e26
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
5 changed files with 76 additions and 11 deletions

View file

@ -2795,6 +2795,44 @@ Variant Control::get_theme_item(Theme::DataType p_data_type, const StringName &p
return Variant();
}
Variant Control::get_used_theme_item(const String &p_full_name, const StringName &p_theme_type) const {
if (p_full_name.begins_with("theme_override_icons/")) {
String name = p_full_name.substr(strlen("theme_override_icons/"));
if (has_theme_icon(name)) { // Exclude cached and default ones.
return get_theme_icon(name);
}
} else if (p_full_name.begins_with("theme_override_styles/")) {
String name = p_full_name.substr(strlen("theme_override_styles/"));
if (has_theme_stylebox(name)) {
return get_theme_stylebox(name);
}
} else if (p_full_name.begins_with("theme_override_fonts/")) {
String name = p_full_name.substr(strlen("theme_override_fonts/"));
if (has_theme_font(name)) {
return get_theme_font(name);
}
} else if (p_full_name.begins_with("theme_override_font_sizes/")) {
String name = p_full_name.substr(strlen("theme_override_font_sizes/"));
if (has_theme_font_size(name)) {
return get_theme_font_size(name);
}
} else if (p_full_name.begins_with("theme_override_colors/")) {
String name = p_full_name.substr(strlen("theme_override_colors/"));
if (has_theme_color(name)) {
return get_theme_color(name);
}
} else if (p_full_name.begins_with("theme_override_constants/")) {
String name = p_full_name.substr(strlen("theme_override_constants/"));
if (has_theme_constant(name)) {
return get_theme_constant(name);
}
} else {
ERR_FAIL_V_MSG(Variant(), vformat("The property %s is not a theme item.", p_full_name));
}
return Variant();
}
#ifdef TOOLS_ENABLED
Ref<Texture2D> Control::get_editor_theme_icon(const StringName &p_name) const {
return get_theme_icon(p_name, SNAME("EditorIcons"));