Merge pull request #21044 from willnationsdev/class_icons

Fix error spam from loading script class icons
This commit is contained in:
Rémi Verschelde 2018-08-15 22:13:36 +02:00 committed by GitHub
commit 12e22f004a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View file

@ -158,12 +158,15 @@ Ref<Texture> CreateDialog::_get_editor_icon(const String &p_type) const {
} }
if (ScriptServer::is_global_class(p_type)) { if (ScriptServer::is_global_class(p_type)) {
RES icon = ResourceLoader::load(EditorNode::get_editor_data().script_class_get_icon_path(p_type)); String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(p_type);
if (icon.is_valid()) RES icon;
return icon; if (FileAccess::exists(icon_path)) {
icon = get_icon(ScriptServer::get_global_class_base(p_type), "EditorIcons"); icon = ResourceLoader::load(icon_path);
if (icon.is_valid()) }
return icon; if (!icon.is_valid()) {
icon = get_icon(ScriptServer::get_global_class_base(p_type), "EditorIcons");
}
return icon;
} }
const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types(); const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();

View file

@ -1877,7 +1877,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
} }
} }
if (r_icon_path) { if (r_icon_path) {
if (c->icon_path.is_abs_path()) if (c->icon_path.empty() || c->icon_path.is_abs_path())
*r_icon_path = c->icon_path; *r_icon_path = c->icon_path;
else if (c->icon_path.is_rel_path()) else if (c->icon_path.is_rel_path())
*r_icon_path = p_path.get_base_dir().plus_file(c->icon_path).simplify_path(); *r_icon_path = p_path.get_base_dir().plus_file(c->icon_path).simplify_path();