Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2019-10-10 01:02:56 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-10-15 04:45:33 +0300
commit280d6b03a7a9c35d5b50fdeaf03a43f72c3a8059 (patch)
treef2b6c5d5547bfbd3d5f754f1a9298abeffb3683d /source/blender/blenkernel/intern/layer.c
parentaf5cc8cbd411fd83584dafac281dd10e5c65312a (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.c27
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;