summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-01-10 18:02:57 +0100
committerGitHub <noreply@github.com>2019-01-10 18:02:57 +0100
commit658296856c3bd132df1844febca2ea4732ef4f43 (patch)
tree02d74024d3f85c41086990050f9220a3d4568119 /modules/mono/csharp_script.cpp
parent9eb93356086a67b84a79e3dbce9d53141f3df2a2 (diff)
parentea85ff0dc2a04e695d396f62ce5949f4e04254e4 (diff)
downloadredot-engine-658296856c3bd132df1844febca2ea4732ef4f43.tar.gz
Merge pull request #24877 from neikeq/issue-24280
Fix properties being lost when reloading placeholder GDScript instance
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 1cdbb4fe51..1b2ba58d22 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -783,7 +783,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// Even though build didn't fail, this tells the placeholder to keep properties and
// it allows using property_set_fallback for restoring the state without a valid script.
- placeholder->set_build_failed(true);
+ scr->placeholder_fallback_enabled = true;
// Restore Variant properties state, it will be kept by the placeholder until the next script reloading
for (List<Pair<StringName, Variant> >::Element *G = scr->pending_reload_state[obj_id].properties.front(); G; G = G->next()) {
@@ -1830,12 +1830,10 @@ void CSharpScript::_update_exports_values(Map<StringName, Variant> &values, List
bool CSharpScript::_update_exports() {
#ifdef TOOLS_ENABLED
- if (!valid) {
- for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->set_build_failed(true);
- }
+ placeholder_fallback_enabled = true; // until proven otherwise
+
+ if (!valid)
return false;
- }
bool changed = false;
@@ -1944,6 +1942,8 @@ bool CSharpScript::_update_exports() {
tmp_object = NULL;
}
+ placeholder_fallback_enabled = false;
+
if (placeholders.size()) {
// Update placeholders if any
Map<StringName, Variant> values;
@@ -1951,7 +1951,6 @@ bool CSharpScript::_update_exports() {
_update_exports_values(values, propnames);
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->set_build_failed(false);
E->get()->update(propnames, values);
}
}
@@ -2697,6 +2696,7 @@ CSharpScript::CSharpScript() :
#ifdef TOOLS_ENABLED
source_changed_cache = false;
+ placeholder_fallback_enabled = false;
exports_invalidated = true;
#endif