mirror of
https://github.com/godotengine/godot.git
synced 2024-12-01 16:42:26 +00:00
Fix script class icon filepath lookups at runtime.
This commit is contained in:
parent
26cf4fed6e
commit
c4ff433b17
@ -3479,16 +3479,20 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
tokenizer->advance();
|
||||
|
||||
if ((tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING)) {
|
||||
Variant constant = tokenizer->get_token_constant();
|
||||
String icon_path = constant.operator String();
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
Variant constant = tokenizer->get_token_constant();
|
||||
String icon_path = constant.operator String();
|
||||
|
||||
String abs_icon_path = icon_path.is_rel_path() ? self_path.get_base_dir().plus_file(icon_path).simplify_path() : icon_path;
|
||||
if (!FileAccess::exists(abs_icon_path)) {
|
||||
_set_error("No class icon found at: " + abs_icon_path);
|
||||
return;
|
||||
String abs_icon_path = icon_path.is_rel_path() ? self_path.get_base_dir().plus_file(icon_path).simplify_path() : icon_path;
|
||||
if (!FileAccess::exists(abs_icon_path)) {
|
||||
_set_error("No class icon found at: " + abs_icon_path);
|
||||
return;
|
||||
}
|
||||
|
||||
p_class->icon_path = icon_path;
|
||||
}
|
||||
|
||||
p_class->icon_path = icon_path;
|
||||
#endif
|
||||
|
||||
tokenizer->advance();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user