diff options
author | Jacques Lucke <jacques@blender.org> | 2021-02-11 15:44:58 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-02-11 15:44:58 +0300 |
commit | dabf96f732d1ce5f44f53230317ff0d0b8a380df (patch) | |
tree | aa01103cef473024ac86e76815e4c2d3138643c1 /source/blender/makesrna/intern | |
parent | 6ca992b017909064311bab436caad98bc863fa0c (diff) |
Attributes: support bool attribute in rna
Differential Revision: https://developer.blender.org/D10387
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_attribute.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 7cd6e375a82..21b26b51e0a 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -169,6 +169,9 @@ static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRN case CD_PROP_STRING: struct_size = sizeof(MStringProperty); break; + case CD_PROP_BOOL: + struct_size = sizeof(MBoolProperty); + break; default: struct_size = 0; length = 0; @@ -299,6 +302,9 @@ PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter) case CD_PROP_STRING: type = &RNA_StringAttribute; break; + case CD_PROP_BOOL: + type = &RNA_BoolAttribute; + break; default: return PointerRNA_NULL; } @@ -555,6 +561,34 @@ static void rna_def_attribute_string(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Attribute_update_data"); } +static void rna_def_attribute_bool(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "BoolAttribute", "Attribute"); + RNA_def_struct_sdna(srna, "CustomDataLayer"); + RNA_def_struct_ui_text(srna, "Bool Attribute", "Bool geometry attribute"); + + prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "BoolAttributeValue"); + RNA_def_property_collection_funcs(prop, + "rna_Attribute_data_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_Attribute_data_length", + NULL, + NULL, + NULL); + + srna = RNA_def_struct(brna, "BoolAttributeValue", NULL); + RNA_def_struct_sdna(srna, "MBoolProperty"); + RNA_def_struct_ui_text(srna, "Bool Attribute Value", "Bool value in geometry attribute"); + prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "b", 0x01); +} + static void rna_def_attribute(BlenderRNA *brna) { PropertyRNA *prop; @@ -592,6 +626,7 @@ static void rna_def_attribute(BlenderRNA *brna) rna_def_attribute_byte_color(brna); rna_def_attribute_int(brna); rna_def_attribute_string(brna); + rna_def_attribute_bool(brna); } /* Mesh/PointCloud/Hair.attributes */ |