Blender  V3.3
Classes | Macros | Typedefs | Functions
BKE_collection.h File Reference
#include "BLI_compiler_compat.h"
#include "BLI_ghash.h"
#include "BLI_iterator.h"
#include "BLI_sys_types.h"
#include "DNA_listBase.h"

Go to the source code of this file.

Classes

struct  CollectionParent
 
struct  SceneObjectsIteratorExData
 

Macros

#define BKE_SCENE_COLLECTION_NAME   "Scene Collection"
 
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode)
 
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END
 
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
 
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
 
#define FOREACH_SCENE_COLLECTION_BEGIN(scene, _instance)
 
#define FOREACH_SCENE_COLLECTION_END   ITER_END
 
#define FOREACH_COLLECTION_BEGIN(_bmain, _scene, Type, _instance)
 
#define FOREACH_COLLECTION_END
 
#define FOREACH_SCENE_OBJECT_BEGIN(scene, _instance)
 
#define FOREACH_SCENE_OBJECT_END   ITER_END
 

Typedefs

typedef struct CollectionParent CollectionParent
 
typedef void(* BKE_scene_objects_Cb) (struct Object *ob, void *data)
 
typedef void(* BKE_scene_collections_Cb) (struct Collection *ob, void *data)
 
typedef struct SceneObjectsIteratorExData SceneObjectsIteratorExData
 

Functions

struct CollectionBKE_collection_add (struct Main *bmain, struct Collection *parent, const char *name)
 
void BKE_collection_add_from_object (struct Main *bmain, struct Scene *scene, const struct Object *ob_src, struct Collection *collection_dst)
 
void BKE_collection_add_from_collection (struct Main *bmain, struct Scene *scene, struct Collection *collection_src, struct Collection *collection_dst)
 
void BKE_collection_free_data (struct Collection *collection)
 
bool BKE_collection_delete (struct Main *bmain, struct Collection *collection, bool hierarchy)
 
struct CollectionBKE_collection_duplicate (struct Main *bmain, struct Collection *parent, struct Collection *collection, uint duplicate_flags, uint duplicate_options)
 
struct CollectionBKE_collection_master_add (void)
 
bool BKE_collection_has_object (struct Collection *collection, const struct Object *ob)
 
bool BKE_collection_has_object_recursive (struct Collection *collection, struct Object *ob)
 
bool BKE_collection_has_object_recursive_instanced (struct Collection *collection, struct Object *ob)
 
struct CollectionBKE_collection_object_find (struct Main *bmain, struct Scene *scene, struct Collection *collection, struct Object *ob)
 
bool BKE_collection_is_empty (const struct Collection *collection)
 
bool BKE_collection_object_add (struct Main *bmain, struct Collection *collection, struct Object *ob)
 
bool BKE_collection_viewlayer_object_add (struct Main *bmain, const struct ViewLayer *view_layer, struct Collection *collection, struct Object *ob)
 
bool BKE_collection_object_add_notest (struct Main *bmain, struct Collection *collection, struct Object *ob)
 
void BKE_collection_object_add_from (struct Main *bmain, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst)
 
bool BKE_collection_object_remove (struct Main *bmain, struct Collection *collection, struct Object *object, bool free_us)
 
void BKE_collection_object_move (struct Main *bmain, struct Scene *scene, struct Collection *collection_dst, struct Collection *collection_src, struct Object *ob)
 
bool BKE_scene_collections_object_remove (struct Main *bmain, struct Scene *scene, struct Object *object, bool free_us)
 
void BKE_collections_object_remove_nulls (struct Main *bmain)
 
void BKE_collections_object_remove_duplicates (struct Main *bmain)
 
void BKE_collections_child_remove_nulls (struct Main *bmain, struct Collection *parent_collection, struct Collection *child_collection)
 
bool BKE_collection_is_in_scene (struct Collection *collection)
 
void BKE_collections_after_lib_link (struct Main *bmain)
 
bool BKE_collection_object_cyclic_check (struct Main *bmain, struct Object *object, struct Collection *collection)
 
struct ListBase BKE_collection_object_cache_get (struct Collection *collection)
 
ListBase BKE_collection_object_cache_instanced_get (struct Collection *collection)
 
void BKE_collection_object_cache_free (struct Collection *collection)
 
struct BaseBKE_collection_or_layer_objects (const struct ViewLayer *view_layer, struct Collection *collection)
 
struct CollectionBKE_collection_from_index (struct Scene *scene, int index)
 
void BKE_collection_new_name_get (struct Collection *collection_parent, char *rname)
 
const char * BKE_collection_ui_name_get (struct Collection *collection)
 
bool BKE_collection_objects_select (struct ViewLayer *view_layer, struct Collection *collection, bool deselect)
 
bool BKE_collection_child_add (struct Main *bmain, struct Collection *parent, struct Collection *child)
 
bool BKE_collection_child_add_no_sync (struct Collection *parent, struct Collection *child)
 
bool BKE_collection_child_remove (struct Main *bmain, struct Collection *parent, struct Collection *child)
 
bool BKE_collection_move (struct Main *bmain, struct Collection *to_parent, struct Collection *from_parent, struct Collection *relative, bool relative_after, struct Collection *collection)
 
bool BKE_collection_cycle_find (struct Collection *new_ancestor, struct Collection *collection)
 
bool BKE_collection_cycles_fix (struct Main *bmain, struct Collection *collection)
 
bool BKE_collection_has_collection (const struct Collection *parent, const struct Collection *collection)
 
struct CollectionBKE_collection_parent_editable_find_recursive (const struct ViewLayer *view_layer, struct Collection *collection)
 
void BKE_collection_parent_relations_rebuild (struct Collection *collection)
 
void BKE_main_collections_parent_relations_rebuild (struct Main *bmain)
 
void BKE_collection_blend_write_nolib (struct BlendWriter *writer, struct Collection *collection)
 
void BKE_collection_blend_read_data (struct BlendDataReader *reader, struct Collection *collection)
 
void BKE_collection_blend_read_lib (struct BlendLibReader *reader, struct Collection *collection)
 
void BKE_collection_blend_read_expand (struct BlendExpander *expander, struct Collection *collection)
 
void BKE_collection_compat_blend_read_data (struct BlendDataReader *reader, struct SceneCollection *sc)
 
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)
 
void BKE_scene_collections_iterator_begin (struct 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)
 
void BKE_scene_objects_iterator_begin (struct BLI_Iterator *iter, void *data_in)
 
void BKE_scene_objects_iterator_next (struct BLI_Iterator *iter)
 
void BKE_scene_objects_iterator_end (struct BLI_Iterator *iter)
 
void BKE_scene_objects_iterator_begin_ex (struct 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)
 
struct GSetBKE_scene_objects_as_gset (struct Scene *scene, struct GSet *objects_gset)
 

Macro Definition Documentation

◆ BKE_SCENE_COLLECTION_NAME

#define BKE_SCENE_COLLECTION_NAME   "Scene Collection"

Definition at line 96 of file BKE_collection.h.

◆ FOREACH_COLLECTION_BEGIN

#define FOREACH_COLLECTION_BEGIN (   _bmain,
  _scene,
  Type,
  _instance 
)
Value:
{ \
Type _instance; \
Collection *_instance_next; \
bool is_scene_collection = (_scene) != NULL; \
if (_scene) { \
_instance_next = _scene->master_collection; \
} \
else { \
_instance_next = (_bmain)->collections.first; \
} \
\
while ((_instance = _instance_next)) { \
if (is_scene_collection) { \
_instance_next = (_bmain)->collections.first; \
is_scene_collection = false; \
} \
else { \
_instance_next = _instance->id.next; \
}

Definition at line 399 of file BKE_collection.h.

◆ FOREACH_COLLECTION_END

#define FOREACH_COLLECTION_END
Value:
} \
} \
((void)0)
SyclQueue void void size_t num_bytes void

Definition at line 421 of file BKE_collection.h.

◆ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN

#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (   _collection,
  _object 
)
Value:
for (Base *_base = (Base *)BKE_collection_object_cache_get(_collection).first; _base; \
_base = _base->next) { \
Object *_object = _base->object; \
BLI_assert(_object != NULL);
struct ListBase BKE_collection_object_cache_get(struct Collection *collection)
Definition: collection.c:787

Definition at line 342 of file BKE_collection.h.

◆ FOREACH_COLLECTION_OBJECT_RECURSIVE_END

#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
Value:
} \
((void)0)

Definition at line 348 of file BKE_collection.h.

◆ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN

#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (   _collection,
  _object,
  _mode 
)
Value:
{ \
int _base_flag = (_mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; \
int _object_visibility_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_HIDE_VIEWPORT : \
int _base_id = 0; \
for (Base *_base = (Base *)BKE_collection_object_cache_get(_collection).first; _base; \
_base = _base->next, _base_id++) { \
Object *_object = _base->object; \
if ((_base->flag & _base_flag) && \
(_object->visibility_flag & _object_visibility_flag) == 0) {
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:45
@ BASE_ENABLED_RENDER
@ BASE_ENABLED_VIEWPORT
@ OB_HIDE_RENDER
@ OB_HIDE_VIEWPORT

Definition at line 324 of file BKE_collection.h.

◆ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END

#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END
Value:
} \
} \
} \
((void)0)

Definition at line 336 of file BKE_collection.h.

◆ FOREACH_SCENE_COLLECTION_BEGIN

#define FOREACH_SCENE_COLLECTION_BEGIN (   scene,
  _instance 
)
Value:
scene, \
_instance)
void BKE_scene_collections_iterator_begin(struct BLI_Iterator *iter, void *data_in)
Definition: collection.c:1884
void BKE_scene_collections_iterator_end(struct BLI_Iterator *iter)
Definition: collection.c:1913
void BKE_scene_collections_iterator_next(struct BLI_Iterator *iter)
Definition: collection.c:1901
#define ITER_BEGIN(callback_begin, callback_next, callback_end, _data_in, _type, _instance)
Definition: BLI_iterator.h:30
Scene scene

Definition at line 389 of file BKE_collection.h.

◆ FOREACH_SCENE_COLLECTION_END

#define FOREACH_SCENE_COLLECTION_END   ITER_END

Definition at line 397 of file BKE_collection.h.

◆ FOREACH_SCENE_OBJECT_BEGIN

#define FOREACH_SCENE_OBJECT_BEGIN (   scene,
  _instance 
)
Value:
scene, \
Object *, \
_instance)
void BKE_scene_objects_iterator_next(struct BLI_Iterator *iter)
Definition: collection.c:2042
void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter)
Definition: collection.c:2074
void BKE_scene_objects_iterator_begin(struct BLI_Iterator *iter, void *data_in)
Definition: collection.c:1958

Definition at line 426 of file BKE_collection.h.

◆ FOREACH_SCENE_OBJECT_END

#define FOREACH_SCENE_OBJECT_END   ITER_END

Definition at line 434 of file BKE_collection.h.

Typedef Documentation

◆ BKE_scene_collections_Cb

typedef void(* BKE_scene_collections_Cb) (struct Collection *ob, void *data)

Definition at line 320 of file BKE_collection.h.

◆ BKE_scene_objects_Cb

typedef void(* BKE_scene_objects_Cb) (struct Object *ob, void *data)

Definition at line 319 of file BKE_collection.h.

◆ CollectionParent

◆ SceneObjectsIteratorExData

Iterate over objects in the scene based on a flag.

Note
The object->flag is tested against flag.

Function Documentation

◆ BKE_collection_add()

struct 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 ( struct Main bmain,
struct Scene scene,
const struct Object ob_src,
struct Collection collection_dst 
)

Add collection_dst to all scene collections that reference object ob_src is in. Used to replace an instance object with a collection (library override operator).

Logic is very similar to BKE_collection_object_add_from().

Referenced by lib_override_library_create_post_process().

◆ BKE_collection_blend_read_data()

void BKE_collection_blend_read_data ( struct BlendDataReader reader,
struct Collection collection 
)

◆ BKE_collection_blend_read_expand()

void BKE_collection_blend_read_expand ( struct BlendExpander expander,
struct Collection collection 
)

◆ BKE_collection_blend_read_lib()

void BKE_collection_blend_read_lib ( struct BlendLibReader reader,
struct Collection collection 
)

◆ BKE_collection_blend_write_nolib()

void BKE_collection_blend_write_nolib ( struct BlendWriter writer,
struct Collection collection 
)

◆ BKE_collection_child_add()

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

◆ BKE_collection_child_add_no_sync()

bool BKE_collection_child_add_no_sync ( struct Collection parent,
struct 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 ( struct Main bmain,
struct Collection parent,
struct Collection child 
)

◆ BKE_collection_compat_blend_read_data()

void BKE_collection_compat_blend_read_data ( struct BlendDataReader reader,
struct SceneCollection sc 
)

◆ BKE_collection_compat_blend_read_expand()

void BKE_collection_compat_blend_read_expand ( struct BlendExpander expander,
struct SceneCollection sc 
)

◆ BKE_collection_compat_blend_read_lib()

void BKE_collection_compat_blend_read_lib ( struct BlendLibReader reader,
struct Library lib,
struct SceneCollection sc 
)

◆ 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()

struct Collection* BKE_collection_duplicate ( struct Main bmain,
struct Collection parent,
struct Collection collection,
uint  duplicate_flags,
uint  duplicate_options 
)

Make a deep copy (aka duplicate) of the given collection and all of its children, recursively.

Warning
This functions will clear all bmain #ID.idnew pointers, unless LIB_ID_DUPLICATE_IS_SUBPROCESS duplicate option is passed on, in which case caller is responsible to reconstruct collection dependencies information's (i.e. call BKE_main_collection_sync).

Referenced by BKE_scene_duplicate(), and collection_duplicate_exec().

◆ 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()

struct 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 struct Collection parent,
const struct Collection collection 
)

◆ BKE_collection_has_object()

bool BKE_collection_has_object ( struct Collection collection,
const struct Object ob 
)

◆ BKE_collection_has_object_recursive()

bool BKE_collection_has_object_recursive ( struct Collection collection,
struct Object ob 
)

◆ BKE_collection_has_object_recursive_instanced()

bool BKE_collection_has_object_recursive_instanced ( struct Collection collection,
struct Object ob 
)

◆ BKE_collection_is_empty()

bool BKE_collection_is_empty ( const struct Collection collection)

◆ BKE_collection_is_in_scene()

bool BKE_collection_is_in_scene ( struct Collection collection)

◆ BKE_collection_master_add()

struct Collection* BKE_collection_master_add ( void  )

◆ BKE_collection_move()

bool BKE_collection_move ( struct Main bmain,
struct Collection to_parent,
struct Collection from_parent,
struct Collection relative,
bool  relative_after,
struct 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 ( struct Collection collection)

◆ BKE_collection_object_cache_get()

struct ListBase BKE_collection_object_cache_get ( struct Collection collection)

◆ BKE_collection_object_cache_instanced_get()

ListBase BKE_collection_object_cache_instanced_get ( struct Collection collection)

◆ BKE_collection_object_cyclic_check()

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

◆ BKE_collection_object_find()

struct Collection* BKE_collection_object_find ( struct Main bmain,
struct Scene scene,
struct Collection collection,
struct 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()

struct Base* BKE_collection_or_layer_objects ( const struct ViewLayer view_layer,
struct Collection collection 
)

◆ BKE_collection_parent_editable_find_recursive()

struct Collection* BKE_collection_parent_editable_find_recursive ( const struct ViewLayer view_layer,
struct Collection collection 
)

Return parent collection which is not linked.

Referenced by loose_data_instantiate_ensure_active_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 ( struct Main bmain,
const struct ViewLayer view_layer,
struct Collection collection,
struct Object ob 
)

Add object to given collection, similar to BKE_collection_object_add.

However, it additionally ensures that the selected collection is also part of the given view_layer, if non-NULL. Otherwise, the object is not added to any collection.

Referenced by BKE_object_add().

◆ BKE_collections_after_lib_link()

void BKE_collections_after_lib_link ( struct 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()

struct 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 ( struct 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 ( struct BLI_Iterator iter,
void data_in 
)

◆ BKE_scene_objects_iterator_end()

void BKE_scene_objects_iterator_end ( struct 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 ( struct BLI_Iterator iter)

◆ BKE_scene_objects_iterator_next_ex()

void BKE_scene_objects_iterator_next_ex ( struct BLI_Iterator iter)