Fixed crash on duplicate GIProbe baking
This commit is contained in:
parent
4b414f45c4
commit
5ac441131e
3 changed files with 12 additions and 2 deletions
|
@ -111,6 +111,7 @@ enum PropertyUsageFlags {
|
||||||
PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 18,
|
PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 18,
|
||||||
PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 19,
|
PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 19,
|
||||||
PROPERTY_USAGE_INTERNAL = 1 << 20,
|
PROPERTY_USAGE_INTERNAL = 1 << 20,
|
||||||
|
PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 21, // If the object is duplicated also this property will be duplicated
|
||||||
|
|
||||||
PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK,
|
PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK,
|
||||||
PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED,
|
PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED,
|
||||||
|
|
|
@ -535,7 +535,7 @@ void GIProbe::_bind_methods() {
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData"), "set_probe_data", "get_probe_data");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data");
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(SUBDIV_64);
|
BIND_ENUM_CONSTANT(SUBDIV_64);
|
||||||
BIND_ENUM_CONSTANT(SUBDIV_128);
|
BIND_ENUM_CONSTANT(SUBDIV_128);
|
||||||
|
|
|
@ -2169,9 +2169,18 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
|
||||||
value = Array(value).duplicate();
|
value = Array(value).duplicate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
|
||||||
|
|
||||||
|
Resource *res = Object::cast_to<Resource>(value);
|
||||||
|
if (res) // Duplicate only if it's a resource
|
||||||
|
current_node->set(name, res->duplicate());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
current_node->set(name, value);
|
current_node->set(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node->set_name(get_name());
|
node->set_name(get_name());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue