diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-15 23:25:45 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-16 02:01:01 +0300 |
commit | 98765e370093e088022145e841421f7a7e1da368 (patch) | |
tree | 721ec20a7c0543dbdcb29f3494806ad9e50b1a21 /source/blender | |
parent | bf7af31e9f7c0177c1d390ab77804f8d556e0e56 (diff) |
RNA: LayerCollection.has_hidden_objects
With this we have a way to tell that a collection has visible objects
but not all of its objects are visible.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_layer_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 16 |
3 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 0e4a38503ae..2f9c818934f 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -726,6 +726,7 @@ static short layer_collection_sync( if (base->flag & BASE_HIDDEN) { view_layer->runtime_flag |= VIEW_LAYER_HAS_HIDE; + lc->runtime_flag |= LAYER_COLLECTION_HAS_HIDDEN_OBJECTS; } else if (base->flag & BASE_VISIBLE) { lc->runtime_flag |= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS; diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 3dcd31fbd7b..e363c0c54b2 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -123,7 +123,8 @@ enum { enum { LAYER_COLLECTION_HAS_OBJECTS = (1 << 0), LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 1), - LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 2), + LAYER_COLLECTION_HAS_HIDDEN_OBJECTS = (1 << 2), + LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 3), }; /* ViewLayer->flag */ diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index ffa48df010d..46d1f5bef7d 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -232,6 +232,16 @@ static bool rna_LayerCollection_has_visible_objects(LayerCollection *lc, ViewLay return true; } +static bool rna_LayerCollection_has_hidden_objects(LayerCollection *lc, ViewLayer *view_layer) +{ + if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) && + (lc->runtime_flag & LAYER_COLLECTION_HAS_HIDDEN_OBJECTS)) + { + return true; + } + return false; +} + static bool rna_LayerCollection_has_selected_objects(LayerCollection *lc, ViewLayer *view_layer) { return BKE_layer_collection_has_selected_objects(view_layer, lc); @@ -297,6 +307,12 @@ static void rna_def_layer_collection(BlenderRNA *brna) RNA_def_parameter_flags(prop, 0, PARM_REQUIRED); RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", "")); + func = RNA_def_function(srna, "has_hidden_objects", "rna_LayerCollection_has_hidden_objects"); + RNA_def_function_ui_description(func, ""); + prop = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to"); + RNA_def_parameter_flags(prop, 0, PARM_REQUIRED); + RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", "")); + func = RNA_def_function(srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects"); RNA_def_function_ui_description(func, ""); prop = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to"); |