From 0138e33792e563f81e0aa64f2e308c7a17582e39 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 30 May 2025 14:44:14 +0200 Subject: [PATCH] Fix get_class_icon() ignoring fallback --- editor/editor_node.cpp | 6 ++++-- editor/editor_node.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6188eeeecb9..f1733d8f907 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5202,9 +5202,11 @@ Ref EditorNode::get_object_icon(const Object *p_object, const String Ref EditorNode::get_class_icon(const String &p_class, const String &p_fallback) { ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty."); + const Pair key(p_class, p_fallback); + // Take from the local cache, if available. { - Ref *icon = class_icon_cache.getptr(p_class); + Ref *icon = class_icon_cache.getptr(key); if (icon) { return *icon; } @@ -5218,7 +5220,7 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p } Ref icon = _get_class_or_script_icon(p_class, script_path, p_fallback, true); - class_icon_cache[p_class] = icon; + class_icon_cache[key] = icon; return icon; } diff --git a/editor/editor_node.h b/editor/editor_node.h index 163075d0d27..e0886ce5be2 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -484,7 +484,7 @@ private: PrintHandlerList print_handler; HashMap> icon_type_cache; - HashMap> class_icon_cache; + HashMap, Ref> class_icon_cache; ProjectUpgradeTool *project_upgrade_tool = nullptr; bool run_project_upgrade_tool = false;