diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 46 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 60 |
4 files changed, 85 insertions, 51 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 25130f43b73..ca6806a98c6 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -95,18 +95,25 @@ void BKE_layer_collection_sync(const struct Scene *scene, struct ViewLayer *view void BKE_main_collection_sync_remap(const struct Main *bmain); -struct LayerCollection *BKE_layer_collection_first_from_scene_collection(struct ViewLayer *view_layer, const struct Collection *collection); -bool BKE_view_layer_has_collection(struct ViewLayer *view_layer, const struct Collection *collection); -bool BKE_scene_has_object(struct Scene *scene, struct Object *ob); +struct LayerCollection *BKE_layer_collection_first_from_scene_collection( + struct ViewLayer *view_layer, const struct Collection *collection); +bool BKE_view_layer_has_collection( + struct ViewLayer *view_layer, const struct Collection *collection); +bool BKE_scene_has_object( + struct Scene *scene, struct Object *ob); -bool BKE_layer_collection_objects_select(struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect); +bool BKE_layer_collection_objects_select( + struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect); /* override */ -void BKE_override_view_layer_datablock_add(struct ViewLayer *view_layer, int id_type, const char *data_path, const struct ID *owner_id); -void BKE_override_view_layer_int_add(struct ViewLayer *view_layer, int id_type, const char *data_path, const int value); +void BKE_override_view_layer_datablock_add( + struct ViewLayer *view_layer, int id_type, const char *data_path, const struct ID *owner_id); +void BKE_override_view_layer_int_add( + struct ViewLayer *view_layer, int id_type, const char *data_path, const int value); -void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value); +void BKE_override_layer_collection_boolean_add( + struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value); /* evaluation */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 215477e66cc..30ed796d73f 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -189,7 +189,8 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy) * * \param flag Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */ -void BKE_collection_copy_data(Main *UNUSED(bmain), Collection *collection_dst, const Collection *collection_src, const int flag) +void BKE_collection_copy_data( + Main *UNUSED(bmain), Collection *collection_dst, const Collection *collection_src, const int flag) { /* Do not copy collection's preview (same behavior as for objects). */ if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */ @@ -287,7 +288,8 @@ void BKE_collection_new_name_get(Collection *collection_parent, char *rname) else { const int number = BLI_listbase_count(&collection_parent->children) + 1; const int digits = integer_digits_i(number); - const int max_len = sizeof(collection_parent->id.name) - 1 /* NULL terminator */ - (1 + digits) /* " %d" */ - 2 /* ID */; + const int max_len = + sizeof(collection_parent->id.name) - 1 /* NULL terminator */ - (1 + digits) /* " %d" */ - 2 /* ID */; name = BLI_sprintfN("%.*s %d", max_len, collection_parent->id.name + 2, number); } @@ -723,7 +725,8 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *old_collection) * * If source collection is NULL move it from all the existing collections. */ -void BKE_collection_object_move(Main *bmain, Scene *scene, Collection *collection_dst, Collection *collection_src, Object *ob) +void BKE_collection_object_move( + Main *bmain, Scene *scene, Collection *collection_dst, Collection *collection_src, Object *ob) { /* In both cases we first add the object, then remove it from the other collections. * Otherwise we lose the original base and whether it was active and selected. */ diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 461d332dcf5..7bda471d3da 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -528,12 +528,10 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection * in at least one layer collection. That list is also synchronized here, and * stores state like selection. */ -static void layer_collection_sync(ViewLayer *view_layer, - const ListBase *lb_scene, - ListBase *lb_layer, - ListBase *new_object_bases, - int parent_exclude, - int parent_restrict) +static void layer_collection_sync( + ViewLayer *view_layer, const ListBase *lb_scene, + ListBase *lb_layer, ListBase *new_object_bases, + int parent_exclude, int parent_restrict) { /* TODO: support recovery after removal of intermediate collections, reordering, .. * For local edits we can make editing operating do the appropriate thing, but for @@ -543,7 +541,8 @@ static void layer_collection_sync(ViewLayer *view_layer, for (LayerCollection *lc = lb_layer->first; lc;) { /* Note ID remap can set lc->collection to NULL when deleting collections. */ LayerCollection *lc_next = lc->next; - Collection *collection = (lc->collection) ? BLI_findptr(lb_scene, lc->collection, offsetof(CollectionChild, collection)) : NULL; + Collection *collection = (lc->collection) ? + BLI_findptr(lb_scene, lc->collection, offsetof(CollectionChild, collection)) : NULL; if (!collection) { /* Free recursively. */ @@ -577,7 +576,10 @@ static void layer_collection_sync(ViewLayer *view_layer, } /* Sync child collections. */ - layer_collection_sync(view_layer, &collection->children, &lc->layer_collections, new_object_bases, lc->flag, child_restrict); + layer_collection_sync( + view_layer, &collection->children, + &lc->layer_collections, new_object_bases, + lc->flag, child_restrict); /* Layer collection exclude is not inherited. */ if (lc->flag & LAYER_COLLECTION_EXCLUDE) { @@ -653,7 +655,10 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer) ListBase new_object_bases = {NULL, NULL}; const int parent_exclude = 0, parent_restrict = 0; - layer_collection_sync(view_layer, &collections, &view_layer->layer_collections, &new_object_bases, parent_exclude, parent_restrict); + layer_collection_sync( + view_layer, &collections, + &view_layer->layer_collections, &new_object_bases, + parent_exclude, parent_restrict); /* Any remaning object bases are to be removed. */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { @@ -827,7 +832,8 @@ bool BKE_scene_has_object(Scene *scene, Object *ob) /** * Add a new datablock override */ -void BKE_override_view_layer_datablock_add(ViewLayer *view_layer, int id_type, const char *data_path, const ID *owner_id) +void BKE_override_view_layer_datablock_add( + ViewLayer *view_layer, int id_type, const char *data_path, const ID *owner_id) { UNUSED_VARS(view_layer, id_type, data_path, owner_id); TODO_LAYER_OVERRIDE; @@ -836,7 +842,8 @@ void BKE_override_view_layer_datablock_add(ViewLayer *view_layer, int id_type, c /** * Add a new int override */ -void BKE_override_view_layer_int_add(ViewLayer *view_layer, int id_type, const char *data_path, const int value) +void BKE_override_view_layer_int_add( + ViewLayer *view_layer, int id_type, const char *data_path, const int value) { UNUSED_VARS(view_layer, id_type, data_path, value); TODO_LAYER_OVERRIDE; @@ -845,7 +852,8 @@ void BKE_override_view_layer_int_add(ViewLayer *view_layer, int id_type, const c /** * Add a new boolean override */ -void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value) +void BKE_override_layer_collection_boolean_add( + struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value) { UNUSED_VARS(layer_collection, id_type, data_path, value); TODO_LAYER_OVERRIDE; @@ -1147,9 +1155,10 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter)) /* Evaluation */ -void BKE_layer_eval_view_layer(struct Depsgraph *depsgraph, - struct Scene *UNUSED(scene), - ViewLayer *view_layer) +void BKE_layer_eval_view_layer( + struct Depsgraph *depsgraph, + struct Scene *UNUSED(scene), + ViewLayer *view_layer) { DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer); @@ -1185,9 +1194,10 @@ void BKE_layer_eval_view_layer(struct Depsgraph *depsgraph, } } -void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, - struct Scene *scene, - int view_layer_index) +void BKE_layer_eval_view_layer_indexed( + struct Depsgraph *depsgraph, + struct Scene *scene, + int view_layer_index) { BLI_assert(view_layer_index >= 0); ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index c3bf632fe6e..a33f3eb944d 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -144,11 +144,11 @@ static void do_version_area_change_space_to_space_action(ScrArea *area, const Sc /** * \brief After lib-link versioning for new workspace design. * - * * Adds a workspace for (almost) each screen of the old file - * and adds the needed workspace-layout to wrap the screen. - * * Active screen isn't stored directly in window anymore, but in the active workspace. - * * Active scene isn't stored in screen anymore, but in window. - * * Create workspace instance hook for each window. + * - Adds a workspace for (almost) each screen of the old file + * and adds the needed workspace-layout to wrap the screen. + * - Active screen isn't stored directly in window anymore, but in the active workspace. + * - Active scene isn't stored in screen anymore, but in window. + * - Create workspace instance hook for each window. * * \note Some of the created workspaces might be deleted again in case of reading the default startup.blend. */ @@ -212,10 +212,11 @@ static void do_version_view_layer_visibility(ViewLayer *view_layer) } } -static void do_version_layer_collection_pre(ViewLayer *view_layer, - ListBase *lb, - GSet *enabled_set, - GSet *selectable_set) +static void do_version_layer_collection_pre( + ViewLayer *view_layer, + ListBase *lb, + GSet *enabled_set, + GSet *selectable_set) { /* Convert from deprecated DISABLED to new layer collection and collection flags */ for (LayerCollection *lc = lb->first; lc; lc = lc->next) { @@ -232,11 +233,12 @@ static void do_version_layer_collection_pre(ViewLayer *view_layer, } } -static void do_version_layer_collection_post(ViewLayer *view_layer, - ListBase *lb, - GSet *enabled_set, - GSet *selectable_set, - GHash *collection_map) +static void do_version_layer_collection_post( + ViewLayer *view_layer, + ListBase *lb, + GSet *enabled_set, + GSet *selectable_set, + GHash *collection_map) { /* Apply layer collection exclude flags. */ for (LayerCollection *lc = lb->first; lc; lc = lc->next) { @@ -253,14 +255,16 @@ static void do_version_layer_collection_post(ViewLayer *view_layer, } } - do_version_layer_collection_post(view_layer, &lc->layer_collections, enabled_set, selectable_set, collection_map); + do_version_layer_collection_post( + view_layer, &lc->layer_collections, enabled_set, selectable_set, collection_map); } } -static void do_version_scene_collection_convert(Main *bmain, - SceneCollection *sc, - Collection *collection, - GHash *collection_map) +static void do_version_scene_collection_convert( + Main *bmain, + SceneCollection *sc, + Collection *collection, + GHash *collection_map) { if (collection_map) { BLI_ghash_insert(collection_map, collection, sc); @@ -324,9 +328,13 @@ static void do_version_scene_collection_to_collection(Main *bmain, Scene *scene) GSet *enabled_set = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); GSet *selectable_set = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); - do_version_layer_collection_pre(view_layer, &view_layer->layer_collections, enabled_set, selectable_set); + do_version_layer_collection_pre( + view_layer, &view_layer->layer_collections, enabled_set, selectable_set); + BKE_layer_collection_sync(scene, view_layer); - do_version_layer_collection_post(view_layer, &view_layer->layer_collections, enabled_set, selectable_set, collection_map); + + do_version_layer_collection_post( + view_layer, &view_layer->layer_collections, enabled_set, selectable_set, collection_map); BLI_gset_free(enabled_set, NULL); BLI_gset_free(selectable_set, NULL); @@ -476,7 +484,10 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) for (int layer = 0; layer < 20; layer++) { if (collections[DO_VERSION_COLLECTION_VISIBLE].created & (1 << layer)) { - CollectionChild *hide_child = BLI_findptr(&collection_parent->children, collections[DO_VERSION_COLLECTION_HIDE].collections[layer], offsetof(CollectionChild, collection)); + CollectionChild *hide_child = BLI_findptr( + &collection_parent->children, + collections[DO_VERSION_COLLECTION_HIDE].collections[layer], + offsetof(CollectionChild, collection)); if ((collections[DO_VERSION_COLLECTION_HIDE].created & (1 << layer)) && (hide_child != collection_parent->children.first)) @@ -487,7 +498,10 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) collection_parent->children.first); } - CollectionChild *hide_all_child = BLI_findptr(&collection_parent->children, collections[DO_VERSION_COLLECTION_HIDE_ALL].collections[layer], offsetof(CollectionChild, collection)); + CollectionChild *hide_all_child = BLI_findptr( + &collection_parent->children, + collections[DO_VERSION_COLLECTION_HIDE_ALL].collections[layer], + offsetof(CollectionChild, collection)); if ((collections[DO_VERSION_COLLECTION_HIDE_ALL].created & (1 << layer)) && (hide_all_child != collection_parent->children.last)) |