diff options
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 37063a42906..74abe104134 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -271,9 +271,11 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot) static int object_hide_collection_exec(bContext *C, wmOperator *op) { wmWindow *win = CTX_wm_window(C); + View3D *v3d = CTX_wm_view3d(C); int index = RNA_int_get(op->ptr, "collection_index"); - const bool extend = (win->eventstate->shift != 0) || RNA_boolean_get(op->ptr, "toggle"); + const bool extend = (win->eventstate->shift != 0); + const bool toggle = RNA_boolean_get(op->ptr, "toggle"); if (win->eventstate->alt != 0) { index += 10; @@ -289,7 +291,21 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); - BKE_layer_collection_isolate(scene, view_layer, lc, extend); + if (v3d->flag & V3D_LOCAL_COLLECTIONS) { + if ((lc->runtime_flag & LAYER_COLLECTION_VISIBLE) == 0) { + return OPERATOR_CANCELLED; + } + if (toggle) { + lc->local_collections_bits ^= v3d->local_collections_uuid; + BKE_layer_collection_local_sync(view_layer, v3d); + } + else { + BKE_layer_collection_local_isolate(view_layer, v3d, lc, extend); + } + } + else { + BKE_layer_collection_isolate(scene, view_layer, lc, extend); + } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); |