Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script

Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
This commit is contained in:
Aaron Franke
2023-01-10 14:42:05 -06:00
parent 2bc0bcbd26
commit 2a65f6812b
7 changed files with 34 additions and 27 deletions

View File

@ -262,7 +262,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
if ((p.get_type() == Variant::DICTIONARY || p.get_type() == Variant::ARRAY)) {
r->set(E.name, p.duplicate(p_subresources));
} else if (p.get_type() == Variant::OBJECT && (p_subresources || (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE))) {
} else if (p.get_type() == Variant::OBJECT && !(E.usage & PROPERTY_USAGE_NEVER_DUPLICATE) && (p_subresources || (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE))) {
Ref<Resource> sr = p;
if (sr.is_valid()) {
r->set(E.name, sr->duplicate(p_subresources));