diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-10-10 01:02:56 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-10-15 04:45:33 +0300 |
commit | 280d6b03a7a9c35d5b50fdeaf03a43f72c3a8059 (patch) | |
tree | f2b6c5d5547bfbd3d5f754f1a9298abeffb3683d /source/blender/blenkernel/intern/layer.c | |
parent | af5cc8cbd411fd83584dafac281dd10e5c65312a (diff) |
Fix T70670: Hidden collections are still rendered by Cycles in the Viewport
Now local collections are fully working with cycles preview, while the
collection visibility bug is fixed.
Local collections were not working with cycles viewport even before the recent
commit to allow users to show collections that are hidden in the view layer.
It just got worse with said commit (0812949bbc3d).
Differential Revision: https://developer.blender.org/D6034
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 726ca9d705b..b915fddca18 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1059,6 +1059,33 @@ bool BKE_base_is_visible(const View3D *v3d, const Base *base) return base->flag & BASE_VISIBLE_VIEWLAYER; } +bool BKE_object_is_visible_in_viewport(const struct View3D *v3d, const struct Object *ob) +{ + if (ob->restrictflag & OB_RESTRICT_VIEWPORT) { + return false; + } + + if ((v3d->object_type_exclude_viewport & (1 << ob->type)) != 0) { + return false; + } + + if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) { + return false; + } + + if ((v3d->flag & V3D_LOCAL_COLLECTIONS) && + ((v3d->local_collections_uuid & ob->runtime.local_collections_bits) == 0)) { + return false; + } + + /* If not using local view or local collection the object may still be in a hidden collection. */ + if (((v3d->localvd) == NULL) && ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0)) { + return (ob->base_flag & BASE_VISIBLE_VIEWLAYER) != 0; + } + + return true; +} + static void layer_collection_flag_set_recursive(LayerCollection *lc, const int flag) { lc->flag |= flag; |