1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add a script method to get its class icon

Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
This commit is contained in:
Yuri Sizov
2023-08-24 12:49:20 +02:00
parent 6758a7f8c0
commit 2c77f07aaa
13 changed files with 52 additions and 12 deletions

View File

@@ -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();
}