Add custom icons to script classes.

This commit is contained in:
Will Nations 2018-07-28 22:36:43 -05:00
parent b4f579b5ba
commit 6d9cc032e7
12 changed files with 165 additions and 38 deletions

View file

@ -1811,7 +1811,7 @@ bool GDScriptLanguage::handles_global_class_type(const String &p_type) const {
return p_type == "GDScript";
}
String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type) const {
String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const {
PoolVector<uint8_t> sourcef;
Error err;
@ -1876,6 +1876,12 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
}
}
}
if (r_icon_path) {
if (c->icon_path.is_abs_path())
*r_icon_path = c->icon_path;
else if (c->icon_path.is_rel_path())
*r_icon_path = p_path.get_base_dir().plus_file(c->icon_path).simplify_path();
}
return c->name;
}