diff options
author | Bastien Montagne <bastien@blender.org> | 2021-12-22 18:57:07 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-12-22 19:34:13 +0300 |
commit | 8d3e57f338234995c30ae702fff62ed6229f762e (patch) | |
tree | d27b1f8a3a9de4c4404aa06fb5743e6044228479 /source/blender/blenkernel/BKE_collection.h | |
parent | 902318f0fd0e4f5ad73887451dcbe4f482e26702 (diff) |
Fix T93799: Outliner: Remaping objects could result in duplicates in a collection.
Fix is similar to how CollectionObject with NULL object pointers are handled.
Using one of the 'free' pad bytes in Object_Runtime struct instead of a
gset (or other external way to detect object duplicates), as this is
several times faster.
NOTE: This makes remapping slightly slower again (adds 10 extra seconds
to file case in T94059).
General improvements of remapping time complexity, especially when
remapping a lot of IDs at once, is a separate topic currently
investigated in D13615.
Diffstat (limited to 'source/blender/blenkernel/BKE_collection.h')
-rw-r--r-- | source/blender/blenkernel/BKE_collection.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 46c1fe0d33d..7dfda7b5121 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -163,7 +163,21 @@ bool BKE_scene_collections_object_remove(struct Main *bmain, struct Scene *scene, struct Object *object, const bool free_us); + +/** + * Check all collections in \a bmain (including embedded ones in scenes) for CollectionObject with + * NULL object pointer, and remove them. + */ void BKE_collections_object_remove_nulls(struct Main *bmain); + +/** + * Check all collections in \a bmain (including embedded ones in scenes) for duplicate + * CollectionObject with a same object pointer within a same object, and remove them. + * + * NOTE: Always keeps the first of the detected duplicates. + */ +void BKE_collections_object_remove_duplicates(struct Main *bmain); + /** * Remove all NULL children from parent collections of changed \a collection. * This is used for library remapping, where these pointers have been set to NULL. |