From 4a86e2bb76a9efd4b0495f3c62c76a5feedb8d44 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. --- 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 bb34a459387..d8bc555d6d6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3642,17 +3642,12 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p } 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