summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-12 16:46:25 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-12 16:46:25 -0300
commit101049518a71eeece66bc94688ae69d9018cdeb0 (patch)
treeae60e690c392f14e3b20e487d1fd78228704523e /scene
parent5abe4313615dc17b999e150346f857313573a26d (diff)
-force exporting of original script exported variables on overriden scripts
-this works around the problem of scripts being reloaded and their properties lost -fixes #2958
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/packed_scene.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 863f2be699..f8283bb5ca 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -509,6 +509,19 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
}
}
+ if (exists && p_node->get_script_instance()) {
+ //if this is an overriden value by another script, save it anyway
+ //as the script change will erase it
+ //https://github.com/godotengine/godot/issues/2958
+
+ bool valid=false;
+ p_node->get_script_instance()->get_property_type(name,&valid);
+ if (valid) {
+ exists=false;
+ isdefault=false;
+ }
+ }
+
if (exists && bool(Variant::evaluate(Variant::OP_EQUAL,value,original))) {
//exists and did not change