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.
This commit is contained in:
parent
bf7af31e9f
commit
98765e3700
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue