1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Add class icon cache to EditorNode

This commit is contained in:
kobewi
2025-05-27 13:59:13 +02:00
parent 6c9765d87e
commit 18df2ae9ca
4 changed files with 21 additions and 7 deletions

View File

@@ -1116,10 +1116,13 @@ Ref<Texture2D> EditorData::_load_script_icon(const String &p_path) const {
Ref<Texture2D> EditorData::get_script_icon(const String &p_script_path) {
// Take from the local cache, if available.
if (_script_icon_cache.has(p_script_path)) {
// Can be an empty value if we can't resolve any icon for this script.
// An empty value is still cached to avoid unnecessary attempts at resolving it again.
return _script_icon_cache[p_script_path];
{
Ref<Texture2D> *icon = _script_icon_cache.getptr(p_script_path);
if (icon) {
// Can be an empty value if we can't resolve any icon for this script.
// An empty value is still cached to avoid unnecessary attempts at resolving it again.
return *icon;
}
}
// Fast path in case the whole hierarchy is made of global classes.