You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Merge pull request #106963 from KoBeWi/a_wild_crash_has_occured
Fix `get_class_icon()` ignoring fallback
This commit is contained in:
@@ -5221,9 +5221,11 @@ 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) {
|
Ref<Texture2D> 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.");
|
ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty.");
|
||||||
|
const Pair<String, String> key(p_class, p_fallback);
|
||||||
|
|
||||||
// Take from the local cache, if available.
|
// Take from the local cache, if available.
|
||||||
{
|
{
|
||||||
Ref<Texture2D> *icon = class_icon_cache.getptr(p_class);
|
Ref<Texture2D> *icon = class_icon_cache.getptr(key);
|
||||||
if (icon) {
|
if (icon) {
|
||||||
return *icon;
|
return *icon;
|
||||||
}
|
}
|
||||||
@@ -5237,7 +5239,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ref<Texture2D> icon = _get_class_or_script_icon(p_class, script_path, p_fallback, true);
|
Ref<Texture2D> 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;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ private:
|
|||||||
PrintHandlerList print_handler;
|
PrintHandlerList print_handler;
|
||||||
|
|
||||||
HashMap<String, Ref<Texture2D>> icon_type_cache;
|
HashMap<String, Ref<Texture2D>> icon_type_cache;
|
||||||
HashMap<String, Ref<Texture2D>> class_icon_cache;
|
HashMap<Pair<String, String>, Ref<Texture2D>> class_icon_cache;
|
||||||
|
|
||||||
ProjectUpgradeTool *project_upgrade_tool = nullptr;
|
ProjectUpgradeTool *project_upgrade_tool = nullptr;
|
||||||
bool run_project_upgrade_tool = false;
|
bool run_project_upgrade_tool = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user