diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-10-04 01:22:36 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-10-09 01:16:05 +0300 |
commit | 0812949bbc3d7acfd1f20a47087ff973110aa177 (patch) | |
tree | 0ec8a52ea73790d85f4b14993de3c252e9fa6de5 /source/blender/editors/object | |
parent | 6d3c34fe9d1eabc7765275ff68600734be0e3acb (diff) |
Local Collections: Allow users to show hidden collections
Users now can turn on in a viewport collections that are temporarily
hidden (eye) in the view layer.
Design task: T61327
As for the implementation, I had to decouple the visibility in the
depsgraph from the visibility in the view layer.
Also there is a "bug" that in a way was there before which is some
operators (e.g., writing a text inside of a text object, tab into edit
mode) run regardless of the visibility of the active object. The bug was
present already (with object type visibility restriction) in 2.80 so if
we decide to tackle it, can be done separately (I have a patch for it
though P1132).
Reviewed by: brecht (thank you)
Differential Revision: D5992
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 2f8141bef95..bbd8c425386 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2576,7 +2576,7 @@ static Base *object_add_duplicate_internal( DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); base = BKE_view_layer_base_find(view_layer, ob); - if ((base != NULL) && (base->flag & BASE_VISIBLE)) { + if ((base != NULL) && (base->flag & BASE_VISIBLE_DEPSGRAPH)) { BKE_collection_object_add_from(bmain, scene, ob, obn); } else { diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index d9baec7c3ca..9e9cfe1beed 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -879,7 +879,7 @@ static int bake(Render *re, else { ob_cage_eval = DEG_get_evaluated_object(depsgraph, ob_cage); ob_cage_eval->restrictflag |= OB_RESTRICT_RENDER; - ob_cage_eval->base_flag &= ~(BASE_VISIBLE | BASE_ENABLED_RENDER); + ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); } } } @@ -976,7 +976,7 @@ static int bake(Render *re, highpoly[i].ob = ob_iter; highpoly[i].ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter); highpoly[i].ob_eval->restrictflag &= ~OB_RESTRICT_RENDER; - highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE | BASE_ENABLED_RENDER); + highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); highpoly[i].me = BKE_mesh_new_from_object(NULL, highpoly[i].ob_eval, false); /* lowpoly to highpoly transformation matrix */ @@ -992,10 +992,10 @@ static int bake(Render *re, if (ob_cage != NULL) { ob_cage_eval->restrictflag |= OB_RESTRICT_RENDER; - ob_cage_eval->base_flag &= ~(BASE_VISIBLE | BASE_ENABLED_RENDER); + ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); } ob_low_eval->restrictflag |= OB_RESTRICT_RENDER; - ob_low_eval->base_flag &= ~(BASE_VISIBLE | BASE_ENABLED_RENDER); + ob_low_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); /* populate the pixel arrays with the corresponding face data for each high poly object */ if (!RE_bake_pixels_populate_from_objects(me_low, diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 40bb1c7378f..70d024c7902 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -218,7 +218,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) /* Hide selected or unselected objects. */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { - if (!(base->flag & BASE_VISIBLE)) { + if (!(base->flag & BASE_VISIBLE_DEPSGRAPH)) { continue; } @@ -292,7 +292,7 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); if (v3d->flag & V3D_LOCAL_COLLECTIONS) { - if ((lc->runtime_flag & LAYER_COLLECTION_VISIBLE) == 0) { + if (lc->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) { return OPERATOR_CANCELLED; } if (toggle) { @@ -300,11 +300,11 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) BKE_layer_collection_local_sync(view_layer, v3d); } else { - BKE_layer_collection_local_isolate(view_layer, v3d, lc, extend); + BKE_layer_collection_isolate_local(view_layer, v3d, lc, extend); } } else { - BKE_layer_collection_isolate(scene, view_layer, lc, extend); + BKE_layer_collection_isolate_global(scene, view_layer, lc, extend); } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 28242b986f1..40fa11994f4 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -214,7 +214,7 @@ bool ED_object_base_deselect_all(ViewLayer *view_layer, View3D *v3d, int action) static int get_base_select_priority(Base *base) { - if (base->flag & BASE_VISIBLE) { + if (base->flag & BASE_VISIBLE_DEPSGRAPH) { if (base->flag & BASE_SELECTABLE) { return 3; } @@ -288,7 +288,7 @@ bool ED_object_jump_to_object(bContext *C, Object *ob, const bool UNUSED(reveal_ if (!(base->flag & BASE_SELECTED)) { ED_object_base_deselect_all(view_layer, v3d, SEL_DESELECT); - if (base->flag & BASE_VISIBLE) { + if (BASE_VISIBLE(v3d, base)) { ED_object_base_select(base, BA_SELECT); } |