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/makesrna/intern/rna_object_api.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/makesrna/intern/rna_object_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 56d25f5bebf..babf388bfc7 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -70,6 +70,7 @@ static const EnumPropertyItem space_items[] = { # include "BKE_customdata.h" # include "BKE_font.h" # include "BKE_global.h" +# include "BKE_layer.h" # include "BKE_main.h" # include "BKE_mesh.h" # include "BKE_mball.h" @@ -283,6 +284,11 @@ static void rna_Object_local_view_set(Object *ob, } } +static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d) +{ + return BKE_object_is_visible_in_viewport(v3d, ob); +} + /* Convert a given matrix from a space to another (using the object and/or a bone as * reference). */ static void rna_Object_mat_convert_space(Object *ob, @@ -825,6 +831,15 @@ void RNA_api_object(StructRNA *srna) parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* Viewport */ + func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get"); + RNA_def_function_ui_description( + func, "Check for local view and local collections for this viewport and object"); + parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_boolean(func, "result", 0, "", "Object viewport visibility"); + RNA_def_function_return(func, parm); + /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space"); RNA_def_function_ui_description( |