summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-24 19:01:36 +0200
committerGitHub <noreply@github.com>2020-06-24 19:01:36 +0200
commit527ab830c63eb2c3e9dc2e2bd1cf17d36601389f (patch)
treec98a86bfdfda3f69e5c884a7dcc030643f7f0ef9 /editor/editor_node.cpp
parent9ad5e9e471086ed429831bea95c01107a9d19ad7 (diff)
parent4a86e2bb76a9efd4b0495f3c62c76a5feedb8d44 (diff)
Merge pull request #39793 from Xrayez/class-icon-opt
Optimize class icon loading
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index bb34a45938..d8bc555d6d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3642,17 +3642,12 @@ Ref<Texture2D> 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<ImageTexture> icon = _load_custom_class_icon(icon_path);
- if (icon.is_valid()) {
- return icon;
- }
-
- Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(p_class), "Script");
+ Ref<ImageTexture> icon;
+ Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(p_class);
while (script.is_valid()) {
- String current_icon_path;
- script->get_language()->get_global_class_name(script->get_path(), nullptr, &current_icon_path);
+ StringName name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
+ String current_icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
icon = _load_custom_class_icon(current_icon_path);
if (icon.is_valid()) {
return icon;