diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-28 05:49:36 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-28 07:33:04 +0300 |
commit | 4de6a210c69fe254518ca8d6c860782c54f03749 (patch) | |
tree | 89e27fa2ef5531a86fe26fdde65857430d0403b2 /source/blender/editors | |
parent | 4521d3e7074d2e08ca813e1f4a2297f5000f335b (diff) |
Per view-layer collection visibility
We still control this in the viewport collections visibility menu. But
now we are actually changing the visibility of the collections, not of
the objects.
If a collection is indirectly invisible (because one of its parents are
invisible) we gray it out.
Also if you click directly in the collection names, it "isolates" the
collection by hiding all collections, and showing the direct parents and
all the children of the selected collection.
Development Note:
Right now I'm excluding the hidden collections from the depsgraph.
Thus the need for tagging relations to update.
If this proves to be too slow, we can change.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5852fcff7e9..df1e67efb2d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -295,6 +295,7 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) BKE_layer_collection_set_visible(scene, view_layer, lc, extend); + DEG_relations_tag_update(CTX_data_main(C)); DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -368,7 +369,7 @@ static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEv void OBJECT_OT_hide_collection(wmOperatorType *ot) { /* identifiers */ - ot->name = "Hide Objects By Collection"; + ot->name = "Hide Collection"; ot->description = "Show only objects in collection (Shift to extend)"; ot->idname = "OBJECT_OT_hide_collection"; diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index cb7d4f1fee9..df7eb07c4d0 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -203,6 +203,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) { continue; } + if ((base->flag & BASE_VISIBLE) == 0) { + continue; + } if ((base->flag & BASE_SELECTED) != 0) { CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base); } @@ -218,6 +221,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) { continue; } + if ((base->flag & BASE_VISIBLE) == 0) { + continue; + } if ((base->flag & BASE_SELECTED) != 0) { if (0 == BKE_object_is_libdata(base->object)) { CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0fca84074f5..47bde2a9af7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5906,7 +5906,8 @@ static int count_proportional_objects(TransInfo *t) for (Base *base = view_layer->object_bases.first; base; base = base->next) { /* all base not already selected or marked that is editable */ if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && - (base->flag & BASE_SELECTED) == 0 && + ((base->flag & BASE_VISIBLE) != 0 && + (base->flag & BASE_SELECTED) == 0) && (BASE_EDITABLE_BGMODE(v3d, base))) { mark_children(base->object); @@ -5920,7 +5921,8 @@ static int count_proportional_objects(TransInfo *t) * selection and it is editable. */ if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && - (base->flag & BASE_SELECTED) == 0 && + ((base->flag & BASE_VISIBLE) != 0 && + (base->flag & BASE_SELECTED) == 0) && (BASE_EDITABLE_BGMODE(v3d, base))) { flush_trans_object_base_deps_flag(depsgraph, ob); |