Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/collection.c
| Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | IDTypeInfo IDType_ID_GR = { | ||||
| .foreach_cache = NULL, | .foreach_cache = NULL, | ||||
| .blend_write = collection_blend_write, | .blend_write = collection_blend_write, | ||||
| .blend_read_data = collection_blend_read_data, | .blend_read_data = collection_blend_read_data, | ||||
| .blend_read_lib = collection_blend_read_lib, | .blend_read_lib = collection_blend_read_lib, | ||||
| .blend_read_expand = collection_blend_read_expand, | .blend_read_expand = collection_blend_read_expand, | ||||
| .blend_read_undo_preserve = NULL, | .blend_read_undo_preserve = NULL, | ||||
| .lib_override_apply_post = NULL, | |||||
| }; | }; | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Add Collection | /** \name Add Collection | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 1,563 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Collection ***array = data; | Collection ***array = data; | ||||
| **array = collection; | **array = collection; | ||||
| (*array)++; | (*array)++; | ||||
| } | } | ||||
| static void scene_collections_array(Scene *scene, Collection ***collections_array, int *tot) | static void scene_collections_array(Scene *scene, Collection ***collections_array, int *tot) | ||||
| { | { | ||||
| Collection *collection; | |||||
| Collection **array; | |||||
| *collections_array = NULL; | *collections_array = NULL; | ||||
| *tot = 0; | *tot = 0; | ||||
| if (scene == NULL) { | if (scene == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| collection = scene->master_collection; | Collection *collection = scene->master_collection; | ||||
| BLI_assert(collection != NULL); | BLI_assert(collection != NULL); | ||||
| scene_collection_callback(collection, scene_collections_count, tot); | scene_collection_callback(collection, scene_collections_count, tot); | ||||
| if (*tot == 0) { | if (*tot == 0) { | ||||
| return; | return; | ||||
| } | } | ||||
| *collections_array = array = MEM_mallocN(sizeof(Collection *) * (*tot), "CollectionArray"); | Collection **array = MEM_mallocN(sizeof(Collection *) * (*tot), "CollectionArray"); | ||||
| *collections_array = array; | |||||
| scene_collection_callback(collection, scene_collections_build_array, &array); | scene_collection_callback(collection, scene_collections_build_array, &array); | ||||
| } | } | ||||
| /** | /** | ||||
| * Only use this in non-performance critical situations | * Only use this in non-performance critical situations | ||||
| * (it iterates over all scene collections twice) | * (it iterates over all scene collections twice) | ||||
| */ | */ | ||||
| void BKE_scene_collections_iterator_begin(BLI_Iterator *iter, void *data_in) | void BKE_scene_collections_iterator_begin(BLI_Iterator *iter, void *data_in) | ||||
| ▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines | |||||