diff options
author | Bastien Montagne <bastien@blender.org> | 2022-02-03 17:34:56 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-02-03 17:37:05 +0300 |
commit | 946c70e6a7892985289bf8dfaead8512d33eba79 (patch) | |
tree | c3e6c59a83b659eff13b9d1032fe1f923537fd2e /source/blender/blenkernel/intern | |
parent | 3bcbbf8992b0f41f19bef466129ce5b88984ac2b (diff) |
Fix (unreported) broken do_version of hidden layers from pre-2.8 files.
`BKE_collection_object_add` ensures given object is added to an editable
collection, and not e.g. a linked or override one.
However, some processes like do_version manipulate collections also from
libraries, i.e. linked collections, in those cases we need a version of
the code that unconditionnally adds the given object to the given
colleciton.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index e6ce4eb9440..79f40c1c888 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1094,14 +1094,12 @@ static bool collection_object_remove(Main *bmain, return true; } -bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob) +bool BKE_collection_object_add_notest(Main *bmain, Collection *collection, Object *ob) { - if (ELEM(NULL, collection, ob)) { + if (ob == NULL) { return false; } - collection = collection_parent_editable_find_recursive(collection); - /* Only case where this pointer can be NULL is when scene itself is linked, this case should * never be reached. */ BLI_assert(collection != NULL); @@ -1122,6 +1120,17 @@ bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob) return true; } +bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob) +{ + if (collection == NULL) { + return false; + } + + collection = collection_parent_editable_find_recursive(collection); + + return BKE_collection_object_add_notest(bmain, collection, ob); +} + void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, Object *ob_dst) { bool is_instantiated = false; |