Attributes: Expose "is required" read-only property to Python #111468
@ -273,6 +273,12 @@ static bool rna_Attribute_is_internal_get(PointerRNA *ptr)
|
||||
return !BKE_attribute_allow_procedural_access(layer->name);
|
||||
}
|
||||
|
||||
static bool rna_Attribute_is_required_get(PointerRNA *ptr)
|
||||
{
|
||||
const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
|
||||
return BKE_id_attribute_required(ptr->owner_id, layer->name);
|
||||
}
|
||||
|
||||
static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
ID *id = ptr->owner_id;
|
||||
@ -1152,6 +1158,11 @@ static void rna_def_attribute(BlenderRNA *brna)
|
||||
prop, "Is Internal", "The attribute is meant for internal use by Blender");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Attribute_is_required_get", nullptr);
|
||||
RNA_def_property_ui_text(prop, "Is Required", "Whether the attribute can be removed or renamed");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
/* types */
|
||||
rna_def_attribute_float(brna);
|
||||
rna_def_attribute_float_vector(brna);
|
||||
|
Loading…
Reference in New Issue
Block a user