diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-11-09 08:16:01 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-11-09 08:16:36 -0300 |
commit | 6e5872b70978b4ded3ade769ff46a44de6a6eb02 (patch) | |
tree | 35fb3c7df43748b063b5885fef658977d690c5b6 | |
parent | 4e1995c29b678d99b3f3ad81f9f2d33124f0afe2 (diff) |
Use a more compatible (and certain to work) mechanism to check default value on scene packing.
-rw-r--r-- | scene/resources/packed_scene.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 2514cf9876..87483a7da4 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -490,9 +490,15 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value)); } - if (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { - isdefault = true; //is script default value + Ref<Script> script = p_node->get_script(); + if (!isdefault && script.is_valid() && script->get_property_default_value(name, default_value)) { + isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value)); } + // the version above makes more sense, because it does not rely on placeholder or usage flag + // in the script, just the default value function. + // if (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { + // isdefault = true; //is script default value + // } if (pack_state_stack.size()) { // we are on part of an instanced subscene |