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-08-19 20:25:29 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-09-13 18:37:35 +0300
commit92736a7b75920ffe4b8016a2d097ff8e36687c70 (patch)
tree33594ff97ce96124481ce9d898ea31158f91236c /source/blender/makesrna/intern/rna_layer.c
parentce34a6b0d727bbde6ae373afa8ec6c42bc8980ce (diff)
Per-Viewport Collection Visibility
Support per-viewport collection visibility options. Note 1: There is no way to show a collection that was not visible before due to depsgraph. Otherwise we would risk having all the collections in the depsgraph and I believe this is not the idea. An alternative would be to have a new depsgraph for viewports that are not local. Something to keep in mind if we do per-viewport current frame in the future. So for now what we do is to only allow collections visibility to be disabled/hidden in this mode. Note 2: hide_viewport (the eye icon) doesn't really matter for depsgraph. So after the merge we can still ignore it to show the collections locally in a viewport with no problems for the depsgraph. Reviewers: brecht, sergey Subscribers: billreynish Related task: T61327 Differential Revision: https://developer.blender.org/D5611
Diffstat (limited to 'source/blender/makesrna/intern/rna_layer.c')
-rw-r--r--source/blender/makesrna/intern/rna_layer.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 3c1b30ab7bd..bab7375f01b 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -120,6 +120,26 @@ static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create)
return view_layer->id_properties;
}
+static bool rna_LayerCollection_visible_get(LayerCollection *layer_collection, bContext *C)
+{
+ View3D *v3d = CTX_wm_view3d(C);
+ const bool runtime_visible = (layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE) != 0;
+
+ if (v3d == NULL) {
+ return runtime_visible;
+ }
+
+ if ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0) {
+ return runtime_visible;
+ }
+
+ if (v3d->local_collections_uuid & layer_collection->local_collections_bits) {
+ return true;
+ }
+
+ return false;
+}
+
static void rna_ViewLayer_update_render_passes(ID *id)
{
Scene *scene = (Scene *)id;
@@ -386,6 +406,13 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
+ func = RNA_def_function(srna, "visible_get", "rna_LayerCollection_visible_get");
+ RNA_def_function_ui_description(func,
+ "Whether this collection is visible, take into account the "
+ "collection parent and the viewport");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
+
/* Run-time flags. */
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);