From 946c70e6a7892985289bf8dfaead8512d33eba79 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 3 Feb 2022 15:34:56 +0100 Subject: 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. --- source/blender/blenkernel/BKE_collection.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/BKE_collection.h') diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 402bffea91d..bce15349880 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -123,11 +123,20 @@ struct Collection *BKE_collection_object_find(struct Main *bmain, bool BKE_collection_is_empty(const struct Collection *collection); /** - * Add object to collection + * Add object to given collection, ensuring this collection is 'editable' (i.e. local and not a + * liboverride), and finding a suitable parent one otherwise. */ bool BKE_collection_object_add(struct Main *bmain, struct Collection *collection, struct Object *ob); +/** + * Same as #BKE_collection_object_add, but uncondionnaly adds the object to the given collection. + * + * NOTE: required in certain cases, like do-versionning or complex ID management tasks. + */ +bool BKE_collection_object_add_notest(struct Main *bmain, + struct Collection *collection, + struct Object *ob); /** * Add \a ob_dst to all scene collections that reference object \a ob_src is in. * Used for copying objects. -- cgit v1.2.3