Use a more compatible (and certain to work) mechanism to check default value on scene packing.

This commit is contained in:
Juan Linietsky 2018-11-09 08:16:01 -03:00
parent 4e1995c29b
commit 6e5872b709

View file

@ -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