Blender  V3.3
Classes | Macros
collection.c File Reference
#include <string.h>
#include "BLI_blenlib.h"
#include "BLI_iterator.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_threads.h"
#include "BLT_translation.h"
#include "BKE_anim_data.h"
#include "BKE_collection.h"
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_rigidbody.h"
#include "BKE_scene.h"
#include "DNA_defaults.h"
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_layer_types.h"
#include "DNA_object_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
#include "BLO_read_write.h"

Go to the source code of this file.

Classes

struct  CollectionsIteratorData
 
struct  SceneObjectsIteratorData
 

Macros

#define DNA_DEPRECATED_ALLOW
 

Functions

Prototypes
static bool collection_child_add (Collection *parent, Collection *collection, const int flag, const bool add_us)
 
static bool collection_child_remove (Collection *parent, Collection *collection)
 
static bool collection_object_add (Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us)
 
static bool collection_object_remove (Main *bmain, Collection *collection, Object *ob, const bool free_us)
 
static CollectionChildcollection_find_child (Collection *parent, Collection *collection)
 
static CollectionParentcollection_find_parent (Collection *child, Collection *collection)
 
static bool collection_find_child_recursive (const Collection *parent, const Collection *collection)
 
Add Collection
static Collectioncollection_add (Main *bmain, Collection *collection_parent, const char *name_custom)
 
CollectionBKE_collection_add (Main *bmain, Collection *collection_parent, const char *name_custom)
 
void BKE_collection_add_from_object (Main *bmain, Scene *scene, const Object *ob_src, Collection *collection_dst)
 
void BKE_collection_add_from_collection (Main *bmain, Scene *scene, Collection *collection_src, Collection *collection_dst)
 
Free and Delete Collection
void BKE_collection_free_data (Collection *collection)
 
bool BKE_collection_delete (Main *bmain, Collection *collection, bool hierarchy)
 
Collection Copy
static Collectioncollection_duplicate_recursive (Main *bmain, Collection *parent, Collection *collection_old, const eDupli_ID_Flags duplicate_flags, const eLibIDDuplicateFlags duplicate_options)
 
CollectionBKE_collection_duplicate (Main *bmain, Collection *parent, Collection *collection, eDupli_ID_Flags duplicate_flags, eLibIDDuplicateFlags duplicate_options)
 
Collection Naming
void BKE_collection_new_name_get (Collection *collection_parent, char *rname)
 
const char * BKE_collection_ui_name_get (struct Collection *collection)
 
Object List Cache
static void collection_object_cache_fill (ListBase *lb, Collection *collection, int parent_restrict, bool with_instances)
 
ListBase BKE_collection_object_cache_get (Collection *collection)
 
ListBase BKE_collection_object_cache_instanced_get (Collection *collection)
 
static void collection_object_cache_free (Collection *collection)
 
void BKE_collection_object_cache_free (Collection *collection)
 
BaseBKE_collection_or_layer_objects (const ViewLayer *view_layer, Collection *collection)
 
Scene Master Collection
CollectionBKE_collection_master_add ()
 
Cyclic Checks
static bool collection_object_cyclic_check_internal (Object *object, Collection *collection)
 
bool BKE_collection_object_cyclic_check (Main *bmain, Object *object, Collection *collection)
 
Collection Object Membership
bool BKE_collection_has_object (Collection *collection, const Object *ob)
 
bool BKE_collection_has_object_recursive (Collection *collection, Object *ob)
 
bool BKE_collection_has_object_recursive_instanced (Collection *collection, Object *ob)
 
static Collectioncollection_next_find (Main *bmain, Scene *scene, Collection *collection)
 
CollectionBKE_collection_object_find (Main *bmain, Scene *scene, Collection *collection, Object *ob)
 
bool BKE_collection_is_empty (const Collection *collection)
 
Collection Objects
static void collection_tag_update_parent_recursive (Main *bmain, Collection *collection, const int flag)
 
CollectionBKE_collection_parent_editable_find_recursive (const ViewLayer *view_layer, Collection *collection)
 
bool BKE_collection_object_add_notest (Main *bmain, Collection *collection, Object *ob)
 
bool BKE_collection_object_add (Main *bmain, Collection *collection, Object *ob)
 
bool BKE_collection_viewlayer_object_add (Main *bmain, const ViewLayer *view_layer, Collection *collection, Object *ob)
 
void BKE_collection_object_add_from (Main *bmain, Scene *scene, Object *ob_src, Object *ob_dst)
 
bool BKE_collection_object_remove (Main *bmain, Collection *collection, Object *ob, const bool free_us)
 
static bool scene_collections_object_remove (Main *bmain, Scene *scene, Object *ob, const bool free_us, Collection *collection_skip)
 
bool BKE_scene_collections_object_remove (Main *bmain, Scene *scene, Object *ob, const bool free_us)
 
static void collection_object_remove_nulls (Collection *collection)
 
void BKE_collections_object_remove_nulls (Main *bmain)
 
static void collection_object_remove_duplicates (Collection *collection)
 
void BKE_collections_object_remove_duplicates (struct Main *bmain)
 
static void collection_null_children_remove (Collection *collection)
 
static void collection_missing_parents_remove (Collection *collection)
 
void BKE_collections_child_remove_nulls (Main *bmain, Collection *parent_collection, Collection *child_collection)
 
void BKE_collection_object_move (Main *bmain, Scene *scene, Collection *collection_dst, Collection *collection_src, Object *ob)
 
Collection Scene Membership
bool BKE_collection_is_in_scene (Collection *collection)
 
void BKE_collections_after_lib_link (Main *bmain)
 
Collection Children
static bool collection_instance_find_recursive (Collection *collection, Collection *instance_collection)
 
bool BKE_collection_cycle_find (Collection *new_ancestor, Collection *collection)
 
static bool collection_instance_fix_recursive (Collection *parent_collection, Collection *collection)
 
static bool collection_cycle_fix_recursive (Main *bmain, Collection *parent_collection, Collection *collection)
 
bool BKE_collection_cycles_fix (Main *bmain, Collection *collection)
 
bool BKE_collection_has_collection (const Collection *parent, const Collection *collection)
 
bool BKE_collection_child_add (Main *bmain, Collection *parent, Collection *child)
 
bool BKE_collection_child_add_no_sync (Collection *parent, Collection *child)
 
bool BKE_collection_child_remove (Main *bmain, Collection *parent, Collection *child)
 
void BKE_collection_parent_relations_rebuild (Collection *collection)
 
static void collection_parents_rebuild_recursive (Collection *collection)
 
void BKE_main_collections_parent_relations_rebuild (Main *bmain)
 
Collection Index
static Collectioncollection_from_index_recursive (Collection *collection, const int index, int *index_current)
 
CollectionBKE_collection_from_index (Scene *scene, const int index)
 
static bool collection_objects_select (ViewLayer *view_layer, Collection *collection, bool deselect)
 
bool BKE_collection_objects_select (ViewLayer *view_layer, Collection *collection, bool deselect)
 
Collection move (outliner drag & drop)
bool BKE_collection_move (Main *bmain, Collection *to_parent, Collection *from_parent, Collection *relative, bool relative_after, Collection *collection)
 

Iterators

typedef struct CollectionsIteratorData CollectionsIteratorData
 
typedef struct SceneObjectsIteratorData SceneObjectsIteratorData
 
static void scene_collection_callback (Collection *collection, BKE_scene_collections_Cb callback, void *data)
 
static void scene_collections_count (Collection *UNUSED(collection), void *data)
 
static void scene_collections_build_array (Collection *collection, void *data)
 
static void scene_collections_array (Scene *scene, Collection ***r_collections_array, int *r_collections_array_len)
 
void BKE_scene_collections_iterator_begin (BLI_Iterator *iter, void *data_in)
 
void BKE_scene_collections_iterator_next (struct BLI_Iterator *iter)
 
void BKE_scene_collections_iterator_end (struct BLI_Iterator *iter)
 
static void scene_objects_iterator_begin (BLI_Iterator *iter, Scene *scene, GSet *visited_objects)
 
void BKE_scene_objects_iterator_begin (BLI_Iterator *iter, void *data_in)
 
static void scene_objects_iterator_skip_invalid_flag (BLI_Iterator *iter)
 
void BKE_scene_objects_iterator_begin_ex (BLI_Iterator *iter, void *data_in)
 
void BKE_scene_objects_iterator_next_ex (struct BLI_Iterator *iter)
 
void BKE_scene_objects_iterator_end_ex (struct BLI_Iterator *iter)
 
static CollectionObjectobject_base_unique (GSet *gs, CollectionObject *cob)
 
void BKE_scene_objects_iterator_next (BLI_Iterator *iter)
 
void BKE_scene_objects_iterator_end (BLI_Iterator *iter)
 
GSetBKE_scene_objects_as_gset (Scene *scene, GSet *objects_gset)
 

Collection Data-Block

IDTypeInfo IDType_ID_GR
 
static void collection_init_data (ID *id)
 
static void collection_copy_data (Main *bmain, ID *id_dst, const ID *id_src, const int flag)
 
static void collection_free_data (ID *id)
 
static void collection_foreach_id (ID *id, LibraryForeachIDData *data)
 
static IDcollection_owner_get (Main *bmain, ID *id, ID *owner_id_hint)
 
void BKE_collection_blend_write_nolib (BlendWriter *writer, Collection *collection)
 
static void collection_blend_write (BlendWriter *writer, ID *id, const void *id_address)
 
void BKE_collection_blend_read_data (BlendDataReader *reader, Collection *collection)
 
static void collection_blend_read_data (BlendDataReader *reader, ID *id)
 
static void lib_link_collection_data (BlendLibReader *reader, Library *lib, Collection *collection)
 
void BKE_collection_blend_read_lib (BlendLibReader *reader, Collection *collection)
 
static void collection_blend_read_lib (BlendLibReader *reader, ID *id)
 
void BKE_collection_blend_read_expand (BlendExpander *expander, Collection *collection)
 
static void collection_blend_read_expand (BlendExpander *expander, ID *id)
 

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 8 of file collection.c.

Typedef Documentation

◆ CollectionsIteratorData

◆ SceneObjectsIteratorData

Function Documentation

◆ BKE_collection_add()

Collection* BKE_collection_add ( struct Main bmain,
struct Collection parent,
const char *  name 
)

◆ BKE_collection_add_from_collection()

void BKE_collection_add_from_collection ( struct Main bmain,
struct Scene scene,
struct Collection collection_src,
struct Collection collection_dst 
)

Add collection_dst to all scene collections that reference collection collection_src is in.

Logic is very similar to BKE_collection_object_add_from().

Definition at line 455 of file collection.c.

References BKE_main_collection_sync(), collection_child_add(), collection_find_child(), FOREACH_SCENE_COLLECTION_BEGIN, FOREACH_SCENE_COLLECTION_END, ID_IS_LINKED, ID_IS_OVERRIDABLE_LIBRARY, Scene::master_collection, and scene.

Referenced by lib_override_library_create_post_process().

◆ BKE_collection_add_from_object()

void BKE_collection_add_from_object ( Main bmain,
Scene scene,
const Object ob_src,
Collection collection_dst 
)

◆ BKE_collection_blend_read_data()

void BKE_collection_blend_read_data ( BlendDataReader reader,
Collection collection 
)

◆ BKE_collection_blend_read_expand()

void BKE_collection_blend_read_expand ( BlendExpander expander,
Collection collection 
)

◆ BKE_collection_blend_read_lib()

void BKE_collection_blend_read_lib ( BlendLibReader reader,
Collection collection 
)

◆ BKE_collection_blend_write_nolib()

void BKE_collection_blend_write_nolib ( BlendWriter writer,
Collection collection 
)

◆ BKE_collection_child_add()

bool BKE_collection_child_add ( Main bmain,
Collection parent,
Collection child 
)

◆ BKE_collection_child_add_no_sync()

bool BKE_collection_child_add_no_sync ( Collection parent,
Collection child 
)

Definition at line 1595 of file collection.c.

References collection_child_add().

Referenced by single_object_users_collection().

◆ BKE_collection_child_remove()

bool BKE_collection_child_remove ( Main bmain,
Collection parent,
Collection child 
)

◆ BKE_collection_cycle_find()

bool BKE_collection_cycle_find ( struct Collection new_ancestor,
struct Collection collection 
)

Find potential cycles in collections.

Parameters
new_ancestorthe potential new owner of given collection, or the collection to check if the later is NULL.
collectionthe collection we want to add to new_ancestor, may be NULL if we just want to ensure new_ancestor does not already have cycles.
Returns
true if a cycle is found.

Definition at line 1435 of file collection.c.

References BKE_collection_cycle_find(), collection_instance_find_recursive(), LISTBASE_FOREACH, NULL, and Collection::parents.

Referenced by BKE_collection_cycle_find(), BKE_collection_move(), BKE_collection_parent_relations_rebuild(), collection_add_info_get_from_op(), collection_child_add(), collection_cycle_fix_recursive(), and collection_instance_exec().

◆ BKE_collection_cycles_fix()

bool BKE_collection_cycles_fix ( struct Main bmain,
struct Collection collection 
)

Find and fix potential cycles in collections.

Parameters
collectionThe collection to check for existing cycles.
Returns
true if cycles are found and fixed.

Definition at line 1498 of file collection.c.

References collection_cycle_fix_recursive(), and collection_instance_fix_recursive().

Referenced by do_versions_after_linking_290().

◆ BKE_collection_delete()

bool BKE_collection_delete ( struct Main bmain,
struct Collection collection,
bool  hierarchy 
)

◆ BKE_collection_duplicate()

Collection* BKE_collection_duplicate ( Main bmain,
Collection parent,
Collection collection,
eDupli_ID_Flags  duplicate_flags,
eLibIDDuplicateFlags  duplicate_options 
)

◆ BKE_collection_free_data()

void BKE_collection_free_data ( struct Collection collection)

Free (or release) any data used by this collection (does not free the collection itself).

Definition at line 489 of file collection.c.

References BKE_libblock_free_data(), collection_free_data(), and Collection::id.

Referenced by scene_free_data().

◆ BKE_collection_from_index()

Collection* BKE_collection_from_index ( struct Scene scene,
int  index 
)

Return Scene Collection for a given index.

The index is calculated from top to bottom counting the children before the siblings.

Definition at line 1716 of file collection.c.

References collection_from_index_recursive(), Scene::master_collection, and scene.

Referenced by move_to_collection_exec(), and move_to_collection_invoke().

◆ BKE_collection_has_collection()

bool BKE_collection_has_collection ( const Collection parent,
const Collection collection 
)

Definition at line 1524 of file collection.c.

References collection_find_child_recursive().

◆ BKE_collection_has_object()

bool BKE_collection_has_object ( Collection collection,
const Object ob 
)

◆ BKE_collection_has_object_recursive()

bool BKE_collection_has_object_recursive ( Collection collection,
Object ob 
)

◆ BKE_collection_has_object_recursive_instanced()

bool BKE_collection_has_object_recursive_instanced ( Collection collection,
Object ob 
)

◆ BKE_collection_is_empty()

bool BKE_collection_is_empty ( const Collection collection)

Definition at line 974 of file collection.c.

References BLI_listbase_is_empty(), Collection::children, and Collection::gobject.

◆ BKE_collection_is_in_scene()

bool BKE_collection_is_in_scene ( Collection collection)

◆ BKE_collection_master_add()

Collection* BKE_collection_master_add ( void  )

◆ BKE_collection_move()

bool BKE_collection_move ( Main bmain,
Collection to_parent,
Collection from_parent,
Collection relative,
bool  relative_after,
Collection collection 
)

◆ BKE_collection_new_name_get()

void BKE_collection_new_name_get ( struct Collection collection_parent,
char *  rname 
)

◆ BKE_collection_object_add()

bool BKE_collection_object_add ( struct Main bmain,
struct Collection collection,
struct Object ob 
)

◆ BKE_collection_object_add_from()

void BKE_collection_object_add_from ( struct Main bmain,
struct Scene scene,
struct Object ob_src,
struct Object ob_dst 
)

◆ BKE_collection_object_add_notest()

bool BKE_collection_object_add_notest ( struct Main bmain,
struct Collection collection,
struct Object ob 
)

Same as BKE_collection_object_add, but unconditionally adds the object to the given collection.

NOTE: required in certain cases, like do-versioning or complex ID management tasks.

Definition at line 1099 of file collection.c.

References BKE_collection_is_in_scene(), BKE_main_collection_sync(), BLI_assert, collection_object_add(), DEG_id_tag_update(), Collection::id, ID_RECALC_GEOMETRY, and NULL.

Referenced by BKE_collection_viewlayer_object_add(), do_version_layers_to_collections(), and do_versions_after_linking_280().

◆ BKE_collection_object_cache_free()

void BKE_collection_object_cache_free ( Collection collection)

◆ BKE_collection_object_cache_get()

ListBase BKE_collection_object_cache_get ( Collection collection)

◆ BKE_collection_object_cache_instanced_get()

ListBase BKE_collection_object_cache_instanced_get ( Collection collection)

◆ BKE_collection_object_cyclic_check()

bool BKE_collection_object_cyclic_check ( Main bmain,
Object object,
Collection collection 
)

◆ BKE_collection_object_find()

Collection* BKE_collection_object_find ( Main bmain,
Scene scene,
Collection collection,
Object ob 
)

◆ BKE_collection_object_move()

void BKE_collection_object_move ( struct Main bmain,
struct Scene scene,
struct Collection collection_dst,
struct Collection collection_src,
struct Object ob 
)

Move object from a collection into another

If source collection is NULL move it from all the existing collections.

Definition at line 1361 of file collection.c.

References BKE_collection_object_add(), BKE_collection_object_remove(), NULL, scene, and scene_collections_object_remove().

Referenced by collection_drop_invoke(), and move_to_collection_exec().

◆ BKE_collection_object_remove()

bool BKE_collection_object_remove ( struct Main bmain,
struct Collection collection,
struct Object object,
bool  free_us 
)

◆ BKE_collection_objects_select()

bool BKE_collection_objects_select ( struct ViewLayer view_layer,
struct Collection collection,
bool  deselect 
)

Select all the objects in this Collection (and its nested collections) for this ViewLayer. Return true if any object was selected.

Definition at line 1759 of file collection.c.

References BKE_layer_collection_first_from_scene_collection(), BKE_layer_collection_objects_select(), collection_objects_select(), and NULL.

◆ BKE_collection_or_layer_objects()

Base* BKE_collection_or_layer_objects ( const ViewLayer view_layer,
Collection collection 
)

Definition at line 837 of file collection.c.

References BKE_collection_object_cache_get(), ListBase::first, and FIRSTBASE.

◆ BKE_collection_parent_editable_find_recursive()

Collection* BKE_collection_parent_editable_find_recursive ( const ViewLayer view_layer,
Collection collection 
)

◆ BKE_collection_parent_relations_rebuild()

void BKE_collection_parent_relations_rebuild ( struct Collection collection)

Rebuild parent relationships from child ones, for all children of given collection.

Note
Given collection is assumed to already have valid parents.

Definition at line 1610 of file collection.c.

References BKE_collection_cycle_find(), BLI_addtail(), BLI_assert, BLI_freelinkN(), Collection::children, CollectionParent::collection, collection_find_child(), collection_find_parent(), LIB_TAG_COPIED_ON_WRITE, LIB_TAG_NO_MAIN, LISTBASE_FOREACH_MUTABLE, MEM_callocN, and NULL.

Referenced by collection_parents_rebuild_recursive().

◆ BKE_collection_ui_name_get()

const char* BKE_collection_ui_name_get ( struct Collection collection)

◆ BKE_collection_viewlayer_object_add()

bool BKE_collection_viewlayer_object_add ( Main bmain,
const ViewLayer view_layer,
Collection collection,
Object ob 
)

◆ BKE_collections_after_lib_link()

void BKE_collections_after_lib_link ( Main bmain)

Definition at line 1400 of file collection.c.

References BKE_main_collection_sync().

Referenced by blo_read_file_internal(), and library_link_end().

◆ BKE_collections_child_remove_nulls()

void BKE_collections_child_remove_nulls ( struct Main bmain,
struct Collection parent_collection,
struct Collection child_collection 
)

Remove all NULL children from parent collections of changed collection. This is used for library remapping, where these pointers have been set to NULL. Otherwise this should never happen.

Note
caller must ensure BKE_main_collection_sync_remap() is called afterwards!
Parameters
parent_collectionThe collection owning the pointers that were remapped. May be NULL, in which case whole bmain database of collections is checked.
child_collectionThe collection that was remapped to another pointer. May be NULL, in which case whole bmain database of collections is checked.

Definition at line 1322 of file collection.c.

References BLI_freelinkN(), collection_find_child(), collection_missing_parents_remove(), collection_null_children_remove(), Main::collections, LISTBASE_FOREACH, LISTBASE_FOREACH_MUTABLE, Scene::master_collection, NULL, Collection::parents, scene, and Main::scenes.

Referenced by libblock_remap_data_postprocess_collection_update().

◆ BKE_collections_object_remove_duplicates()

void BKE_collections_object_remove_duplicates ( struct Main bmain)

Check all collections in 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.

Definition at line 1289 of file collection.c.

References collection_object_remove_duplicates(), Main::collections, LISTBASE_FOREACH, Scene::master_collection, Main::objects, scene, and Main::scenes.

Referenced by libblock_remap_data_postprocess_object_update().

◆ BKE_collections_object_remove_nulls()

void BKE_collections_object_remove_nulls ( struct Main bmain)

Check all collections in bmain (including embedded ones in scenes) for CollectionObject with NULL object pointer, and remove them.

Definition at line 1250 of file collection.c.

References collection_object_remove_nulls(), Main::collections, LISTBASE_FOREACH, Scene::master_collection, scene, and Main::scenes.

Referenced by libblock_remap_data_postprocess_object_update().

◆ BKE_main_collections_parent_relations_rebuild()

void BKE_main_collections_parent_relations_rebuild ( struct Main bmain)

◆ BKE_scene_collections_iterator_begin()

void BKE_scene_collections_iterator_begin ( struct BLI_Iterator iter,
void data_in 
)

Only use this in non-performance critical situations (it iterates over all scene collections twice)

Definition at line 1884 of file collection.c.

References BLI_assert, BLI_ITERATOR_INIT, BLI_Iterator::current, BLI_Iterator::data, data, MEM_callocN, scene, and scene_collections_array().

Referenced by scene_objects_iterator_begin().

◆ BKE_scene_collections_iterator_end()

void BKE_scene_collections_iterator_end ( struct BLI_Iterator iter)

Definition at line 1913 of file collection.c.

References BLI_Iterator::data, data, MEM_freeN, and BLI_Iterator::valid.

Referenced by BKE_scene_objects_iterator_end().

◆ BKE_scene_collections_iterator_next()

void BKE_scene_collections_iterator_next ( struct BLI_Iterator iter)

◆ BKE_scene_collections_object_remove()

bool BKE_scene_collections_object_remove ( struct Main bmain,
struct Scene scene,
struct Object object,
bool  free_us 
)

◆ BKE_scene_objects_as_gset()

GSet* BKE_scene_objects_as_gset ( struct Scene scene,
struct GSet objects_gset 
)

Generate a new GSet (or extend given objects_gset if not NULL) with all objects referenced by all collections of given scene.

Note
This will include objects without a base currently (because they would belong to excluded collections only e.g.).

Definition at line 2086 of file collection.c.

References BKE_scene_objects_iterator_end(), BKE_scene_objects_iterator_next(), BLI_Iterator::data, NULL, scene, scene_objects_iterator_begin(), and BLI_Iterator::valid.

Referenced by lib_override_library_create_post_process().

◆ BKE_scene_objects_iterator_begin()

void BKE_scene_objects_iterator_begin ( BLI_Iterator iter,
void data_in 
)

Definition at line 1958 of file collection.c.

References NULL, scene, and scene_objects_iterator_begin().

Referenced by BKE_scene_objects_iterator_begin_ex().

◆ BKE_scene_objects_iterator_begin_ex()

void BKE_scene_objects_iterator_begin_ex ( BLI_Iterator iter,
void data_in 
)

◆ BKE_scene_objects_iterator_end()

void BKE_scene_objects_iterator_end ( BLI_Iterator iter)

◆ BKE_scene_objects_iterator_end_ex()

void BKE_scene_objects_iterator_end_ex ( struct BLI_Iterator iter)

Definition at line 2013 of file collection.c.

References BKE_scene_objects_iterator_end(), BLI_Iterator::data, and data.

◆ BKE_scene_objects_iterator_next()

void BKE_scene_objects_iterator_next ( BLI_Iterator iter)

◆ BKE_scene_objects_iterator_next_ex()

void BKE_scene_objects_iterator_next_ex ( struct BLI_Iterator iter)

◆ collection_add()

static Collection* collection_add ( Main bmain,
Collection collection_parent,
const char *  name_custom 
)
static

◆ collection_blend_read_data()

static void collection_blend_read_data ( BlendDataReader reader,
ID id 
)
static

Definition at line 265 of file collection.c.

References BKE_collection_blend_read_data().

◆ collection_blend_read_expand()

static void collection_blend_read_expand ( BlendExpander expander,
ID id 
)
static

Definition at line 354 of file collection.c.

References BKE_collection_blend_read_expand().

◆ collection_blend_read_lib()

static void collection_blend_read_lib ( BlendLibReader reader,
ID id 
)
static

Definition at line 317 of file collection.c.

References BKE_collection_blend_read_lib().

◆ collection_blend_write()

static void collection_blend_write ( BlendWriter writer,
ID id,
const void id_address 
)
static

◆ collection_child_add()

static bool collection_child_add ( Collection parent,
Collection collection,
const int  flag,
const bool  add_us 
)
static

◆ collection_child_remove()

static bool collection_child_remove ( Collection parent,
Collection collection 
)
static

◆ collection_copy_data()

static void collection_copy_data ( Main bmain,
ID id_dst,
const ID id_src,
const int  flag 
)
static

Only copy internal data of Collection ID from source to already allocated/initialized destination. You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.

WARNING! This function will not handle ID user count!

Parameters
flagCopying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).

Definition at line 95 of file collection.c.

References BKE_previewimg_id_copy(), BLI_assert, BLI_listbase_clear(), Collection::children, collection_child_add(), COLLECTION_HAS_OBJECT_CACHE, COLLECTION_HAS_OBJECT_CACHE_INSTANCED, COLLECTION_IS_MASTER, collection_object_add(), Collection::flag, ID::flag, Collection::gobject, Collection::id, LIB_EMBEDDED_DATA, LIB_ID_COPY_NO_PREVIEW, LISTBASE_FOREACH, NULL, Collection::object_cache, Collection::object_cache_instanced, Collection::parents, and Collection::preview.

◆ collection_cycle_fix_recursive()

static bool collection_cycle_fix_recursive ( Main bmain,
Collection parent_collection,
Collection collection 
)
static

◆ collection_duplicate_recursive()

static Collection* collection_duplicate_recursive ( Main bmain,
Collection parent,
Collection collection_old,
const eDupli_ID_Flags  duplicate_flags,
const eLibIDDuplicateFlags  duplicate_options 
)
static

◆ collection_find_child()

static CollectionChild * collection_find_child ( Collection parent,
Collection collection 
)
static

◆ collection_find_child_recursive()

static bool collection_find_child_recursive ( const Collection parent,
const Collection collection 
)
static

Definition at line 1509 of file collection.c.

References Collection::children, and LISTBASE_FOREACH.

Referenced by BKE_collection_has_collection(), and collection_object_add().

◆ collection_find_parent()

static CollectionParent * collection_find_parent ( Collection child,
Collection collection 
)
static

◆ collection_foreach_id()

static void collection_foreach_id ( ID id,
LibraryForeachIDData data 
)
static

◆ collection_free_data()

static void collection_free_data ( ID id)
static

◆ collection_from_index_recursive()

static Collection* collection_from_index_recursive ( Collection collection,
const int  index,
int *  index_current 
)
static

Definition at line 1697 of file collection.c.

References Collection::children, LISTBASE_FOREACH, and NULL.

Referenced by BKE_collection_from_index().

◆ collection_init_data()

static void collection_init_data ( ID id)
static

◆ collection_instance_find_recursive()

static bool collection_instance_find_recursive ( Collection collection,
Collection instance_collection 
)
static

Definition at line 1414 of file collection.c.

References Collection::children, ELEM, Collection::gobject, LISTBASE_FOREACH, and NULL.

Referenced by BKE_collection_cycle_find().

◆ collection_instance_fix_recursive()

static bool collection_instance_fix_recursive ( Collection parent_collection,
Collection collection 
)
static

◆ collection_missing_parents_remove()

static void collection_missing_parents_remove ( Collection collection)
static

◆ collection_next_find()

static Collection* collection_next_find ( Main bmain,
Scene scene,
Collection collection 
)
static

◆ collection_null_children_remove()

static void collection_null_children_remove ( Collection collection)
static

◆ collection_object_add()

static bool collection_object_add ( Main bmain,
Collection collection,
Object ob,
int  flag,
const bool  add_us 
)
static

◆ collection_object_cache_fill()

static void collection_object_cache_fill ( ListBase lb,
Collection collection,
int  parent_restrict,
bool  with_instances 
)
static

◆ collection_object_cache_free()

static void collection_object_cache_free ( Collection collection)
static

◆ collection_object_cyclic_check_internal()

static bool collection_object_cyclic_check_internal ( Object object,
Collection collection 
)
static

◆ collection_object_remove()

static bool collection_object_remove ( Main bmain,
Collection collection,
Object ob,
const bool  free_us 
)
static

◆ collection_object_remove_duplicates()

static void collection_object_remove_duplicates ( Collection collection)
static

◆ collection_object_remove_nulls()

static void collection_object_remove_nulls ( Collection collection)
static

◆ collection_objects_select()

static bool collection_objects_select ( ViewLayer view_layer,
Collection collection,
bool  deselect 
)
static

◆ collection_owner_get()

static ID* collection_owner_get ( Main bmain,
ID id,
ID owner_id_hint 
)
static

◆ collection_parents_rebuild_recursive()

static void collection_parents_rebuild_recursive ( Collection collection)
static

◆ collection_tag_update_parent_recursive()

static void collection_tag_update_parent_recursive ( Main bmain,
Collection collection,
const int  flag 
)
static

◆ lib_link_collection_data()

static void lib_link_collection_data ( BlendLibReader reader,
Library lib,
Collection collection 
)
static

◆ object_base_unique()

static CollectionObject* object_base_unique ( GSet gs,
CollectionObject cob 
)
static

Ensures we only get each object once, even when included in several collections.

Definition at line 2029 of file collection.c.

References BLI_gset_ensure_p_ex(), CollectionObject::next, NULL, and CollectionObject::ob.

Referenced by BKE_scene_objects_iterator_next().

◆ scene_collection_callback()

static void scene_collection_callback ( Collection collection,
BKE_scene_collections_Cb  callback,
void data 
)
static

Definition at line 1837 of file collection.c.

References callback, Collection::children, data, and LISTBASE_FOREACH.

Referenced by scene_collections_array().

◆ scene_collections_array()

static void scene_collections_array ( Scene scene,
Collection ***  r_collections_array,
int *  r_collections_array_len 
)
static

◆ scene_collections_build_array()

static void scene_collections_build_array ( Collection collection,
void data 
)
static

Definition at line 1854 of file collection.c.

References data.

Referenced by scene_collections_array().

◆ scene_collections_count()

static void scene_collections_count ( Collection UNUSEDcollection,
void data 
)
static

Definition at line 1848 of file collection.c.

References data.

Referenced by scene_collections_array().

◆ scene_collections_object_remove()

static bool scene_collections_object_remove ( Main bmain,
Scene scene,
Object ob,
const bool  free_us,
Collection collection_skip 
)
static

Remove object from all collections of scene

Parameters
collection_skipDon't remove base from this collection.

Definition at line 1196 of file collection.c.

References BKE_main_collection_sync(), BKE_scene_remove_rigidbody_object(), collection_object_remove(), FOREACH_SCENE_COLLECTION_BEGIN, FOREACH_SCENE_COLLECTION_END, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY, NULL, and scene.

Referenced by BKE_collection_object_move(), and BKE_scene_collections_object_remove().

◆ scene_objects_iterator_begin()

static void scene_objects_iterator_begin ( BLI_Iterator iter,
Scene scene,
GSet visited_objects 
)
static

◆ scene_objects_iterator_skip_invalid_flag()

static void scene_objects_iterator_skip_invalid_flag ( BLI_Iterator iter)
static

Variable Documentation

◆ IDType_ID_GR

IDTypeInfo IDType_ID_GR
Initial value:
= {
.id_code = ID_GR,
.id_filter = FILTER_ID_GR,
.main_listbase_index = INDEX_ID_GR,
.struct_size = sizeof(Collection),
.name = "Collection",
.name_plural = "collections",
.translation_context = BLT_I18NCONTEXT_ID_COLLECTION,
.asset_type_info = NULL,
.copy_data = collection_copy_data,
.free_data = collection_free_data,
.make_local = NULL,
.foreach_id = collection_foreach_id,
.foreach_cache = NULL,
.foreach_path = NULL,
.owner_get = collection_owner_get,
.blend_write = collection_blend_write,
.blend_read_data = collection_blend_read_data,
.blend_read_lib = collection_blend_read_lib,
.blend_read_expand = collection_blend_read_expand,
.blend_read_undo_preserve = NULL,
.lib_override_apply_post = NULL,
}
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition: BKE_idtype.h:39
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition: BKE_idtype.h:41
#define BLT_I18NCONTEXT_ID_COLLECTION
@ INDEX_ID_GR
Definition: DNA_ID.h:1040
#define FILTER_ID_GR
Definition: DNA_ID.h:905
@ ID_GR
Definition: DNA_ID_enums.h:65
struct Collection Collection
static void init_data(ModifierData *md)
static void collection_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: collection.c:317
static void collection_blend_read_expand(BlendExpander *expander, ID *id)
Definition: collection.c:354
static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
Definition: collection.c:95
static ID * collection_owner_get(Main *bmain, ID *id, ID *owner_id_hint)
Definition: collection.c:165
static void collection_free_data(ID *id)
Definition: collection.c:128
static void collection_blend_read_data(BlendDataReader *reader, ID *id)
Definition: collection.c:265
static void collection_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: collection.c:206
static void collection_init_data(ID *id)
Definition: collection.c:77
static void collection_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: collection.c:142

Definition at line 360 of file collection.c.