summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript.h
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-10 00:26:00 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-10 01:58:50 +0100
commitea85ff0dc2a04e695d396f62ce5949f4e04254e4 (patch)
tree04bb98e3619c4060484f189884014be5efe77efb /modules/gdscript/gdscript.h
parent9a8569d434107e721f5c7de0bf8ffe6471367d28 (diff)
Fix properties being lost when reloading placeholder GDScript instance
During reloading in `GDScriptLanguage::reload_all_scripts` a placeholder instance that must remain so is replaced with a new placeholder instance. The state is then restored by calling `ScriptInstance::set` for each property. This does not work if the script is missing the properties due to build/parse failing. The fix for such cases is to call `placeholder_set_fallback` instead of `set` on the script instance. I took this chance to move the `build_failed` flag from `PlaceHolderScriptInstance` to `Script`. That improves the code a lot. I also renamed it to `placeholder_fallback_enabled` which is a much better name (`build_failed` could lead to misunderstandings).
Diffstat (limited to 'modules/gdscript/gdscript.h')
-rw-r--r--modules/gdscript/gdscript.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 752d660ffb..71282bcdc8 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -97,6 +97,7 @@ class GDScript : public Script {
Ref<GDScript> base_cache;
Set<ObjectID> inheriters_cache;
bool source_changed_cache;
+ bool placeholder_fallback_enabled;
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
#endif
@@ -209,6 +210,10 @@ public:
virtual void get_constants(Map<StringName, Variant> *p_constants);
virtual void get_members(Set<StringName> *p_members);
+#ifdef TOOLS_ENABLED
+ virtual bool is_placeholder_fallback_enabled() const { return placeholder_fallback_enabled; }
+#endif
+
GDScript();
~GDScript();
};