summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-09 12:22:51 +0100
committerGitHub <noreply@github.com>2019-02-09 12:22:51 +0100
commit6c243326bd00e0894252baeaacf52897ff87f0e2 (patch)
treec64a021341c3bd207576e21cafffd4572ed6c577 /modules/gdscript
parent4912f578d13a7c4be42adf1e9c0cf29bbe35f3bb (diff)
parentc4ff433b17695a65624e2b1829c981d77ce1adcd (diff)
Merge pull request #25650 from willnationsdev/script-icon
Fix script class icons looking for paths at runtime
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_parser.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index af189fdb7e..7334e8a8cc 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3494,16 +3494,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 {