Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_collections.c
| Show First 20 Lines • Show All 330 Lines • ▼ Show 20 Lines | if (BLI_findindex(&bmain->collections, collection) != -1) { | ||||
| /* We cannot allow to delete collections that are indirectly linked, | /* We cannot allow to delete collections that are indirectly linked, | ||||
| * or that are used by (linked to...) other linked scene/collection. */ | * or that are used by (linked to...) other linked scene/collection. */ | ||||
| bool skip = false; | bool skip = false; | ||||
| if (ID_IS_LINKED(collection)) { | if (ID_IS_LINKED(collection)) { | ||||
| if (collection->id.tag & LIB_TAG_INDIRECT) { | if (collection->id.tag & LIB_TAG_INDIRECT) { | ||||
| skip = true; | skip = true; | ||||
| } | } | ||||
| else { | else { | ||||
| for (CollectionParent *cparent = collection->parents.first; cparent; | LISTBASE_FOREACH (CollectionParent *, cparent, &collection->parents) { | ||||
| cparent = cparent->next) { | |||||
| Collection *parent = cparent->collection; | Collection *parent = cparent->collection; | ||||
| if (ID_IS_LINKED(parent)) { | if (ID_IS_LINKED(parent)) { | ||||
| skip = true; | skip = true; | ||||
| break; | break; | ||||
| } | } | ||||
| else if (parent->flag & COLLECTION_IS_MASTER) { | else if (parent->flag & COLLECTION_IS_MASTER) { | ||||
| Scene *parent_scene = BKE_collection_master_scene_search(bmain, parent); | Scene *parent_scene = BKE_collection_master_scene_search(bmain, parent); | ||||
| if (ID_IS_LINKED(parent_scene)) { | if (ID_IS_LINKED(parent_scene)) { | ||||
| ▲ Show 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | |||||
| static bool collections_indirect_only_clear_poll(bContext *C) | static bool collections_indirect_only_clear_poll(bContext *C) | ||||
| { | { | ||||
| return collections_view_layer_poll(C, true, LAYER_COLLECTION_INDIRECT_ONLY); | return collections_view_layer_poll(C, true, LAYER_COLLECTION_INDIRECT_ONLY); | ||||
| } | } | ||||
| static void layer_collection_flag_recursive_set(LayerCollection *lc, int flag) | static void layer_collection_flag_recursive_set(LayerCollection *lc, int flag) | ||||
| { | { | ||||
| for (LayerCollection *nlc = lc->layer_collections.first; nlc; nlc = nlc->next) { | LISTBASE_FOREACH (LayerCollection *, nlc, &lc->layer_collections) { | ||||
| if (lc->flag & flag) { | if (lc->flag & flag) { | ||||
| nlc->flag |= flag; | nlc->flag |= flag; | ||||
| } | } | ||||
| else { | else { | ||||
| nlc->flag &= ~flag; | nlc->flag &= ~flag; | ||||
| } | } | ||||
| layer_collection_flag_recursive_set(nlc, flag); | layer_collection_flag_recursive_set(nlc, flag); | ||||
| ▲ Show 20 Lines • Show All 603 Lines • ▼ Show 20 Lines | |||||
| static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op)) | static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| /* Unhide all the collections. */ | /* Unhide all the collections. */ | ||||
| LayerCollection *lc_master = view_layer->layer_collections.first; | LayerCollection *lc_master = view_layer->layer_collections.first; | ||||
| for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; | LISTBASE_FOREACH (LayerCollection *, lc_iter, &lc_master->layer_collections) { | ||||
| lc_iter = lc_iter->next) { | |||||
| lc_iter->flag &= ~LAYER_COLLECTION_HIDE; | lc_iter->flag &= ~LAYER_COLLECTION_HIDE; | ||||
| layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_HIDE); | layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_HIDE); | ||||
| } | } | ||||
| /* Unhide all objects. */ | /* Unhide all objects. */ | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| base->flag &= ~BASE_HIDDEN; | base->flag &= ~BASE_HIDDEN; | ||||
| } | } | ||||
| BKE_layer_collection_sync(scene, view_layer); | BKE_layer_collection_sync(scene, view_layer); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); | DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| Show All 18 Lines | |||||