summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-26 08:05:52 +0200
committerGitHub <noreply@github.com>2020-06-26 08:05:52 +0200
commitb92477d77e9a6f46e4276a20a451dfac9d485f47 (patch)
tree289907329dc590ea1e192d5bb80266513f258b8c /editor
parent87d23972733e02b70a26e486456e0ab133e12d78 (diff)
parentc177308f80b46b358751eaaa6e96f693066b4bdc (diff)
Merge pull request #39814 from Xrayez/specific-weird-icons
Don't use arbitrary theme editor icons for scripts with the same name
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d8bc555d6d..21a66e8281 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3637,16 +3637,13 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty.");
- if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
- return gui_base->get_theme_icon(p_class, "EditorIcons");
- }
-
if (ScriptServer::is_global_class(p_class)) {
Ref<ImageTexture> icon;
Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(p_class);
+ StringName name = p_class;
while (script.is_valid()) {
- StringName name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
+ name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
String current_icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
icon = _load_custom_class_icon(current_icon_path);
if (icon.is_valid()) {
@@ -3656,7 +3653,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
if (icon.is_null()) {
- icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(p_class), "EditorIcons");
+ icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(name), "EditorIcons");
}
return icon;
@@ -3674,6 +3671,10 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
}
+ if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
+ return gui_base->get_theme_icon(p_class, "EditorIcons");
+ }
+
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) {
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
}