summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-08-24 12:49:20 +0200
committerYuri Sizov <yuris@humnom.net>2023-08-24 13:05:41 +0200
commit2c77f07aaa4c04c6f439a4636156ba234f6d2e13 (patch)
tree6ef8828a7fcc43832fec43e89d2d7dc4545af97a /modules/gdscript/gdscript.cpp
parent6758a7f8c07d1f4c8ec4f052ded6d26402967ebe (diff)
downloadredot-engine-2c77f07aaa4c04c6f439a4636156ba234f6d2e13.tar.gz
Add a script method to get its class icon
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r--modules/gdscript/gdscript.cpp14
1 files changed, 7 insertions, 7 deletions
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();
}