You've already forked godot
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user