From 6dee6477ddf264ce901ecd0ea58091443439ecc9 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Wed, 24 Jun 2020 13:08:27 +0300 Subject: [PATCH] Optimize class icon loading `get_global_class_name` for `GDScriptLanguage` is slow because it forces to parse an entire script each time. This patch ensures that the icon is actually fetched from the EditorData where they are loaded beforehand. This change also makes the behavior consistent with the existing `get_object_icon` method in EditorNode. (cherry picked from commit 4a86e2bb76a9efd4b0495f3c62c76a5feedb8d44) --- editor/editor_node.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d858002f796..91afb5615e5 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3827,17 +3827,12 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p_f } if (ScriptServer::is_global_class(p_class)) { - String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(p_class); - Ref icon = _load_custom_class_icon(icon_path); - if (icon.is_valid()) { - return icon; - } - - Ref