Check the native base of scripts when resolving icons

(cherry picked from commit 21c5f86d5d)
This commit is contained in:
Yuri Sizov 2023-09-06 15:20:07 +02:00
parent a5b59b596f
commit 08bd6ba734
1 changed files with 4 additions and 4 deletions

View File

@ -4251,10 +4251,10 @@ Ref<Texture2D> EditorNode::_get_class_or_script_icon(const String &p_class, cons
} }
if (p_fallback_script_to_theme) { if (p_fallback_script_to_theme) {
// Look for the base type in the editor theme. // Look for the native base type in the editor theme. This is relevant for
// This is only relevant for built-in classes. // scripts extending other scripts and for built-in classes.
String base_type; String script_class_name = p_script->get_language()->get_global_class_name(p_script->get_path());
p_script->get_language()->get_global_class_name(p_script->get_path(), &base_type); String base_type = ScriptServer::get_global_class_native_base(script_class_name);
if (gui_base && gui_base->has_theme_icon(base_type, SNAME("EditorIcons"))) { if (gui_base && gui_base->has_theme_icon(base_type, SNAME("EditorIcons"))) {
return gui_base->get_theme_icon(base_type, SNAME("EditorIcons")); return gui_base->get_theme_icon(base_type, SNAME("EditorIcons"));
} }