From 63523e56e1438adb0d19eb89394b1474b6dd6630 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Thu, 25 Jun 2020 02:13:13 +0300 Subject: [PATCH] Don't use arbitrary theme editor icons for scripts with the same name The existing theme editor icon could be unintentionally set for any global class with matching name (`Group` icon, `Group` class_name etc), which would only show up in the "Create Dialog" context, but not the scene tree dock. This change prevents this behavior, and ensures that the icon can be actually overidden by explicit icon path in `class_name`, if there's any custom icon to begin with. The correct built-in type's icon is fetched for child classes if there are no custom icons detected throughout base classes as well, so it isn't left empty for those cases. (cherry picked from commit c177308f80b46b358751eaaa6e96f693066b4bdc) --- editor/editor_node.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 91afb5615e5..f11f67ff58b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3822,16 +3822,13 @@ Ref EditorNode::get_object_icon(const Object *p_object, const String &p Ref EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const { ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty."); - if (gui_base->has_icon(p_class, "EditorIcons")) { - return gui_base->get_icon(p_class, "EditorIcons"); - } - if (ScriptServer::is_global_class(p_class)) { Ref icon; Ref