8 #define DNA_DEPRECATED_ALLOW
156 const int cb_flag = ((parent->collection !=
NULL &&
176 ((
Scene *)owner_id_hint)->master_collection == master_collection) {
177 return owner_id_hint;
186 BLI_assert_msg(0,
"Embedded collection with no owner. Critical Main inconsistency.");
224 #ifdef USE_COLLECTION_COMPAT_28
251 #ifdef USE_COLLECTION_COMPAT_28
254 if (collection->collection !=
NULL) {
259 if (collection->view_layer !=
NULL) {
276 if (cob->ob ==
NULL) {
286 #ifdef USE_COLLECTION_COMPAT_28
304 #ifdef USE_COLLECTION_COMPAT_28
305 if (collection->collection) {
309 if (collection->view_layer) {
323 #ifdef USE_COLLECTION_COMPAT_28
347 #ifdef USE_COLLECTION_COMPAT_28
348 if (collection->collection !=
NULL) {
365 .name =
"Collection",
366 .name_plural =
"collections",
369 .asset_type_info =
NULL,
376 .foreach_cache =
NULL,
377 .foreach_path =
NULL,
385 .blend_read_undo_preserve =
NULL,
387 .lib_override_apply_post =
NULL,
399 const char *name_custom)
418 if (collection_parent) {
437 bool is_instantiated =
false;
443 is_instantiated =
true;
448 if (!is_instantiated) {
460 bool is_instantiated =
false;
466 is_instantiated =
true;
471 is_instantiated =
true;
476 if (!is_instantiated) {
506 while (cob !=
NULL) {
513 while (child !=
NULL) {
528 while (cob !=
NULL) {
561 bool do_full_process =
false;
566 if (is_collection_master) {
570 collection_new = collection_old;
571 do_full_process =
true;
577 if (collection_new == collection_old) {
578 return collection_new;
581 do_full_process =
true;
589 if (parent !=
NULL) {
595 if (child && child_new) {
605 if (!do_full_process) {
606 return collection_new;
643 Collection *child_collection_old = child->collection;
646 bmain, collection_new, child_collection_old, duplicate_flags, duplicate_options);
647 if (child_collection_new != child_collection_old) {
652 return collection_new;
664 if (!is_subprocess) {
677 bmain, parent, collection, duplicate_flags, duplicate_options);
679 if (!is_subprocess) {
704 return collection_new;
717 if (!collection_parent) {
727 const int max_len =
sizeof(collection_parent->
id.
name) - 1 -
739 return IFACE_(
"Scene Collection");
742 return collection->
id.
name + 2;
756 int child_restrict = collection->
flag | parent_restrict;
765 if (with_instances && cob->ob->instance_collection) {
767 lb, cob->ob->instance_collection, child_restrict, with_instances);
860 return master_collection;
872 Collection *dup_collection =
object->instance_collection;
880 if (dup_collection == collection) {
947 return collection->
id.
next;
1020 if (view_layer !=
NULL &&
1026 return collection_parent->collection;
1029 view_layer, collection_parent->collection);
1030 if (editable_collection !=
NULL) {
1031 return editable_collection;
1108 if (collection ==
NULL) {
1135 if (collection ==
NULL) {
1141 if (collection ==
NULL) {
1150 bool is_instantiated =
false;
1156 is_instantiated =
true;
1161 if (!is_instantiated) {
1199 bool removed =
false;
1203 if (collection_skip ==
NULL) {
1211 if (collection == collection_skip) {
1236 bool changed =
false;
1239 if (cob->ob ==
NULL) {
1268 bool changed =
false;
1271 if (cob->ob->runtime.collection_management) {
1276 cob->ob->runtime.collection_management =
true;
1281 cob->ob->runtime.collection_management =
false;
1292 ob->runtime.collection_management =
false;
1307 if (child->collection ==
NULL) {
1326 if (child_collection ==
NULL) {
1327 if (parent_collection !=
NULL) {
1366 if (collection_src !=
NULL) {
1418 if (collection_object->ob !=
NULL &&
1420 ELEM(collection_object->ob->instance_collection, instance_collection, collection)) {
1426 if (collection_child->collection !=
NULL &&
1437 if (collection == new_ancestor) {
1441 if (collection ==
NULL) {
1442 collection = new_ancestor;
1459 bool cycles_found =
false;
1462 if (collection_object->ob !=
NULL &&
1463 collection_object->ob->instance_collection == collection) {
1465 collection_object->ob->instance_collection =
NULL;
1466 cycles_found =
true;
1472 cycles_found =
true;
1476 return cycles_found;
1483 bool cycles_found =
false;
1488 cycles_found =
true;
1491 cycles_found =
true;
1495 return cycles_found;
1512 if (child->collection == collection) {
1570 if (child ==
NULL) {
1615 if (other_child != child) {
1635 BLI_addtail(&child->collection->parents, cparent);
1701 if (index == (*index_current)) {
1709 if (nested !=
NULL) {
1718 int index_current = 0;
1725 bool changed =
false;
1764 if (layer_collection !=
NULL) {
1781 bool relative_after,
1803 if (relative_child) {
1806 if (relative_after) {
1857 **
array = collection;
1863 int *r_collections_array_len)
1865 *r_collections_array =
NULL;
1866 *r_collections_array_len = 0;
1879 *r_collections_array_len,
sizeof(
Collection *),
"CollectionArray");
1880 *r_collections_array =
array;
1909 iter->
valid =
false;
1923 iter->
valid =
false;
1942 if (visited_objects !=
NULL) {
1943 data->visited = visited_objects;
1976 if (ob && (ob->
flag &
data->flag) == 0) {
1993 iter->
data = data_in;
2031 for (; cob !=
NULL; cob = cob->
next) {
2057 collection =
data->scene_collection_iter.current;
2066 }
while (
data->scene_collection_iter.valid);
2068 if (!
data->scene_collection_iter.valid) {
2069 iter->
valid =
false;
2090 while (iter.
valid) {
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_SCENE_COLLECTION_END
void(* BKE_scene_collections_Cb)(struct Collection *ob, void *data)
void BKE_collection_compat_blend_read_lib(struct BlendLibReader *reader, struct Library *lib, struct SceneCollection *sc)
void BKE_collection_compat_blend_read_expand(struct BlendExpander *expander, struct SceneCollection *sc)
#define FOREACH_SCENE_COLLECTION_BEGIN(scene, _instance)
void BKE_collection_compat_blend_read_data(struct BlendDataReader *reader, struct SceneCollection *sc)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
#define BKE_SCENE_COLLECTION_NAME
void BKE_previewimg_free(struct PreviewImage **prv)
void BKE_previewimg_id_copy(struct ID *new_id, const struct ID *old_id)
void BKE_previewimg_blend_read(struct BlendDataReader *reader, struct PreviewImage *prv)
void BKE_previewimg_blend_write(struct BlendWriter *writer, const struct PreviewImage *prv)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
@ IDTYPE_FLAGS_NO_ANIMDATA
bool BKE_layer_collection_objects_select(struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect)
void BKE_main_collection_sync(const struct Main *bmain)
bool BKE_view_layer_has_collection(const struct ViewLayer *view_layer, const struct Collection *collection)
void BKE_view_layer_blend_read_data(struct BlendDataReader *reader, struct ViewLayer *view_layer)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
struct LayerCollection * BKE_layer_collection_first_from_scene_collection(const struct ViewLayer *view_layer, const struct Collection *collection)
void BKE_view_layer_blend_read_lib(struct BlendLibReader *reader, struct Library *lib, struct ViewLayer *view_layer)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void BKE_main_id_newptr_and_tag_clear(struct Main *bmain)
void BKE_libblock_free_data(struct ID *id, bool do_id_user) ATTR_NONNULL()
void id_us_min(struct ID *id)
void * BKE_libblock_alloc(struct Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void id_us_plus(struct ID *id)
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
void * BKE_id_new(struct Main *bmain, short type, const char *name)
struct ID * BKE_id_copy_for_duplicate(struct Main *bmain, struct ID *id, uint duplicate_flags, int copy_flags)
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL()
void BKE_main_id_tag_listbase(struct ListBase *lb, int tag, bool value)
@ LIB_ID_DUPLICATE_IS_ROOT_ID
@ LIB_ID_DUPLICATE_IS_SUBPROCESS
void BKE_id_free_us(struct Main *bmain, void *idv) ATTR_NONNULL()
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag)
void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id, int remap_flag) ATTR_NONNULL()
#define FOREACH_MAIN_ID_END
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_duplicate(struct Main *bmain, struct Object *ob, uint dupflag, uint duplicate_options)
API for Blender-side Rigid Body stuff.
void BKE_rigidbody_main_collection_object_add(struct Main *bmain, struct Collection *collection, struct Object *object)
void BKE_scene_remove_rigidbody_object(struct Main *bmain, struct Scene *scene, struct Object *ob, bool free_us)
#define BLI_assert_msg(a, msg)
bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key)
GSet * BLI_gset_ptr_new(const char *info)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
#define BLI_ITERATOR_INIT(iter)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int integer_digits_i(int i)
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define STRNCPY(dst, src)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
#define BLI_MUTEX_INITIALIZER
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
pthread_mutex_t ThreadMutex
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_list(BlendDataReader *reader, struct ListBase *list)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_expand(expander, id)
#define BLT_I18NCONTEXT_ID_COLLECTION
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_id_tag_update(struct ID *id, int flag)
ID and Library types, which are fundamental for sdna.
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_OVERRIDABLE_LIBRARY(_id)
#define ID_IS_LINKED(_id)
@ LIB_TAG_COPIED_ON_WRITE
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object groups, one object can be in many groups at once.
@ COLLECTION_TAG_RELATION_REBUILD
struct Collection Collection
@ COLLECTION_HAS_OBJECT_CACHE_INSTANCED
@ COLLECTION_HAS_OBJECT_CACHE
@ COLLECTION_HIDE_VIEWPORT
#define DNA_struct_default_get(struct_name)
Object is a sort of wrapper for general info.
Types and defines for representing Rigid Body entities.
#define FIRSTBASE(_view_layer)
Read Guarded memory(de)allocation.
static void init_data(ModifierData *md)
static void collection_object_cache_fill(ListBase *lb, Collection *collection, int parent_restrict, bool with_instances)
static bool collection_cycle_fix_recursive(Main *bmain, Collection *parent_collection, Collection *collection)
bool BKE_collection_has_object_recursive_instanced(Collection *collection, Object *ob)
void BKE_scene_objects_iterator_begin_ex(BLI_Iterator *iter, void *data_in)
static void scene_collections_count(Collection *UNUSED(collection), void *data)
static CollectionParent * collection_find_parent(Collection *child, Collection *collection)
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
Collection * BKE_collection_from_index(Scene *scene, const int index)
void BKE_collection_add_from_collection(Main *bmain, Scene *scene, Collection *collection_src, Collection *collection_dst)
static void collection_object_remove_duplicates(Collection *collection)
static bool collection_child_remove(Collection *parent, Collection *collection)
const char * BKE_collection_ui_name_get(struct Collection *collection)
void BKE_collection_blend_write_nolib(BlendWriter *writer, Collection *collection)
bool BKE_collection_child_remove(Main *bmain, Collection *parent, Collection *child)
static bool collection_child_add(Collection *parent, Collection *collection, const int flag, const bool add_us)
Collection * BKE_collection_master_add()
bool BKE_collection_viewlayer_object_add(Main *bmain, const ViewLayer *view_layer, Collection *collection, Object *ob)
void BKE_scene_objects_iterator_next_ex(struct BLI_Iterator *iter)
static CollectionObject * object_base_unique(GSet *gs, CollectionObject *cob)
static bool collection_object_remove(Main *bmain, Collection *collection, Object *ob, const bool free_us)
static bool collection_instance_find_recursive(Collection *collection, Collection *instance_collection)
Collection * BKE_collection_parent_editable_find_recursive(const ViewLayer *view_layer, Collection *collection)
bool BKE_collection_has_object(Collection *collection, const Object *ob)
ListBase BKE_collection_object_cache_instanced_get(Collection *collection)
static void collection_object_cache_free(Collection *collection)
static void collection_blend_read_lib(BlendLibReader *reader, ID *id)
Collection * BKE_collection_duplicate(Main *bmain, Collection *parent, Collection *collection, eDupli_ID_Flags duplicate_flags, eLibIDDuplicateFlags duplicate_options)
static bool collection_object_add(Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us)
void BKE_collections_object_remove_duplicates(struct Main *bmain)
static void collection_blend_read_expand(BlendExpander *expander, ID *id)
GSet * BKE_scene_objects_as_gset(Scene *scene, GSet *objects_gset)
bool BKE_collection_child_add_no_sync(Collection *parent, Collection *child)
Collection * BKE_collection_object_find(Main *bmain, Scene *scene, Collection *collection, Object *ob)
void BKE_scene_objects_iterator_end(BLI_Iterator *iter)
bool BKE_collection_is_empty(const Collection *collection)
static void collection_parents_rebuild_recursive(Collection *collection)
bool BKE_collection_move(Main *bmain, Collection *to_parent, Collection *from_parent, Collection *relative, bool relative_after, Collection *collection)
bool BKE_collection_is_in_scene(Collection *collection)
static void scene_collection_callback(Collection *collection, BKE_scene_collections_Cb callback, void *data)
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
void BKE_collection_object_move(Main *bmain, Scene *scene, Collection *collection_dst, Collection *collection_src, Object *ob)
void BKE_collection_add_from_object(Main *bmain, Scene *scene, const Object *ob_src, Collection *collection_dst)
void BKE_collection_blend_read_expand(BlendExpander *expander, Collection *collection)
static bool collection_object_cyclic_check_internal(Object *object, Collection *collection)
static Collection * collection_next_find(Main *bmain, Scene *scene, Collection *collection)
void BKE_scene_objects_iterator_end_ex(struct BLI_Iterator *iter)
bool BKE_scene_collections_object_remove(Main *bmain, Scene *scene, Object *ob, const bool free_us)
bool BKE_collection_objects_select(ViewLayer *view_layer, Collection *collection, bool deselect)
void BKE_collections_child_remove_nulls(Main *bmain, Collection *parent_collection, Collection *child_collection)
static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
static Collection * collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
void BKE_collection_object_cache_free(Collection *collection)
bool BKE_collection_object_remove(Main *bmain, Collection *collection, Object *ob, const bool free_us)
static ID * collection_owner_get(Main *bmain, ID *id, ID *owner_id_hint)
static void lib_link_collection_data(BlendLibReader *reader, Library *lib, Collection *collection)
void BKE_scene_collections_iterator_begin(BLI_Iterator *iter, void *data_in)
void BKE_collection_new_name_get(Collection *collection_parent, char *rname)
void BKE_collection_free_data(Collection *collection)
Base * BKE_collection_or_layer_objects(const ViewLayer *view_layer, Collection *collection)
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
static bool collection_find_child_recursive(const Collection *parent, const Collection *collection)
static CollectionChild * collection_find_child(Collection *parent, Collection *collection)
bool BKE_collection_cycles_fix(Main *bmain, Collection *collection)
struct SceneObjectsIteratorData SceneObjectsIteratorData
bool BKE_collection_object_add_notest(Main *bmain, Collection *collection, Object *ob)
static void collection_free_data(ID *id)
static bool collection_instance_fix_recursive(Collection *parent_collection, Collection *collection)
static void collection_object_remove_nulls(Collection *collection)
void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, Object *ob_dst)
static void collection_blend_read_data(BlendDataReader *reader, ID *id)
static void scene_collections_array(Scene *scene, Collection ***r_collections_array, int *r_collections_array_len)
static Collection * collection_duplicate_recursive(Main *bmain, Collection *parent, Collection *collection_old, const eDupli_ID_Flags duplicate_flags, const eLibIDDuplicateFlags duplicate_options)
void BKE_collection_blend_read_lib(BlendLibReader *reader, Collection *collection)
bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
void BKE_collections_object_remove_nulls(Main *bmain)
bool BKE_collection_cycle_find(Collection *new_ancestor, Collection *collection)
static void scene_objects_iterator_begin(BLI_Iterator *iter, Scene *scene, GSet *visited_objects)
static void collection_null_children_remove(Collection *collection)
static void collection_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static Collection * collection_from_index_recursive(Collection *collection, const int index, int *index_current)
bool BKE_collection_object_cyclic_check(Main *bmain, Object *object, Collection *collection)
void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collection)
static void collection_missing_parents_remove(Collection *collection)
void BKE_collections_after_lib_link(Main *bmain)
bool BKE_collection_has_collection(const Collection *parent, const Collection *collection)
static void scene_collections_build_array(Collection *collection, void *data)
struct CollectionsIteratorData CollectionsIteratorData
static bool scene_collections_object_remove(Main *bmain, Scene *scene, Object *ob, const bool free_us, Collection *collection_skip)
static void collection_init_data(ID *id)
ListBase BKE_collection_object_cache_get(Collection *collection)
void BKE_scene_collections_iterator_end(struct BLI_Iterator *iter)
void BKE_scene_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
void BKE_scene_collections_iterator_next(struct BLI_Iterator *iter)
void BKE_collection_parent_relations_rebuild(Collection *collection)
static void collection_tag_update_parent_recursive(Main *bmain, Collection *collection, const int flag)
static void scene_objects_iterator_skip_invalid_flag(BLI_Iterator *iter)
void BKE_scene_objects_iterator_next(BLI_Iterator *iter)
static void collection_foreach_id(ID *id, LibraryForeachIDData *data)
void BKE_main_collections_parent_relations_rebuild(Main *bmain)
static bool collection_objects_select(ViewLayer *view_layer, Collection *collection, bool deselect)
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
DEGForeachIDComponentCallback callback
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
struct Collection * collection
struct CollectionObject * next
struct Collection * collection
struct PreviewImage * preview
ListBase object_cache_instanced
struct Collection * instance_collection
ListBase scene_collections
BLI_Iterator scene_collection_iter
CollectionObject * cob_next
struct Collection * master_collection