From 2c77f07aaa4c04c6f439a4636156ba234f6d2e13 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 24 Aug 2023 12:49:20 +0200 Subject: Add a script method to get its class icon Co-authored-by: Danil Alexeev --- modules/gdscript/gdscript.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/gdscript/gdscript.cpp') diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 42b08f8a68..fe7ccc31a5 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -482,6 +482,10 @@ void GDScript::_clear_doc() { docs.clear(); doc = DocData::ClassDoc(); } + +String GDScript::get_class_icon_path() const { + return simplified_icon_path; +} #endif bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderScriptInstance *p_instance_to_update) { @@ -2527,13 +2531,6 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b * Before changing this function, please ask the current maintainer of EditorFileSystem. */ - if (r_icon_path) { - if (c->icon_path.is_empty() || c->icon_path.is_absolute_path()) { - *r_icon_path = c->icon_path.simplify_path(); - } else if (c->icon_path.is_relative_path()) { - *r_icon_path = p_path.get_base_dir().path_join(c->icon_path).simplify_path(); - } - } if (r_base_type) { const GDScriptParser::ClassNode *subclass = c; String path = p_path; @@ -2601,6 +2598,9 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b } } } + if (r_icon_path) { + *r_icon_path = c->simplified_icon_path; + } return c->identifier != nullptr ? String(c->identifier->name) : String(); } -- cgit v1.2.3