|
@@ -4477,21 +4477,33 @@ Ref<Texture2D> EditorNode::_get_class_or_script_icon(const String &p_class, cons
|
|
|
return script_icon;
|
|
|
}
|
|
|
|
|
|
- // No custom icon was found in the inheritance chain, so check the built-in
|
|
|
- // base class instead.
|
|
|
+ // No custom icon was found in the inheritance chain, so check the base
|
|
|
+ // class of the script instead.
|
|
|
String base_type;
|
|
|
p_script->get_language()->get_global_class_name(p_script->get_path(), &base_type);
|
|
|
- if (gui_base) {
|
|
|
- if (gui_base->has_theme_icon(base_type, "EditorIcons")) {
|
|
|
- return gui_base->get_theme_icon(base_type, "EditorIcons");
|
|
|
- }
|
|
|
- return gui_base->get_theme_icon(p_fallback, "EditorIcons");
|
|
|
+
|
|
|
+ // Check if the base type is an extension-defined type.
|
|
|
+ Ref<Texture2D> ext_icon = ed.extension_class_get_icon(base_type);
|
|
|
+ if (ext_icon.is_valid()) {
|
|
|
+ return ext_icon;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Look for the base type in the editor theme.
|
|
|
+ // This is only relevant for built-in classes.
|
|
|
+ if (gui_base && gui_base->has_theme_icon(base_type, "EditorIcons")) {
|
|
|
+ return gui_base->get_theme_icon(base_type, "EditorIcons");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Script was not valid or didn't yield any useful values, try the class name
|
|
|
// directly.
|
|
|
|
|
|
+ // Check if the class name is an extension-defined type.
|
|
|
+ Ref<Texture2D> ext_icon = ed.extension_class_get_icon(p_class);
|
|
|
+ if (ext_icon.is_valid()) {
|
|
|
+ return ext_icon;
|
|
|
+ }
|
|
|
+
|
|
|
// Check if the class name is a custom type.
|
|
|
// TODO: Should probably be deprecated in 4.x
|
|
|
const EditorData::CustomType *ctype = ed.get_custom_type_by_name(p_class);
|