diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-17 18:01:21 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-17 18:06:05 +0300 |
commit | 13f591d400e2d17633bf7ebba9c7890fd563e4d2 (patch) | |
tree | 361374096efc8d2d2258bdec2946c352439680b2 /source/blender/blenkernel/intern/collection.c | |
parent | c84fee1ffeab3842d01779f1a2e5bfd826b48e60 (diff) |
ID Duplicate: Factorize a lot the code.
Now that we have a uniform consistent behavior in all our ID duplicate
funtions, we can easily factorize it greatly. Code gets cleaner,
smaller, and less error-prone.
Note that ultimately, this duplicate/deep copy behavior could be added
as a callback of IDTypeInfo.
We could also rethink the duplicate flags (some data, even some obdata,
like Lattice, are not coverred currently).
And so on. But at least code should now be much more easily maintainable
and extendable.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index f115b9e8b7b..dddbf7d45b2 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -345,17 +345,8 @@ static Collection *collection_duplicate_recursive(Main *bmain, do_full_process = true; } else if (collection_old->id.newid == NULL) { - BKE_id_copy(bmain, &collection_old->id, (ID **)&collection_new); - - /* Copying add one user by default, need to get rid of that one. */ - id_us_min(&collection_new->id); - - ID_NEW_SET(collection_old, collection_new); - - if (duplicate_flags & USER_DUP_ACT) { - BKE_animdata_copy_id_action(bmain, &collection_new->id, true); - } - + collection_new = (Collection *)BKE_id_copy_for_duplicate( + bmain, (ID *)collection_old, is_collection_liboverride, duplicate_flags); do_full_process = true; } else { |