diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-11-23 15:41:07 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-11-23 15:54:11 +0300 |
commit | 23d148ecaf923a490c3dd4a22d6dd96ea7cb9654 (patch) | |
tree | cbc096d925f772bd28b21c18766ddf795af78f46 /source/blender/makesrna/intern/rna_internal_types.h | |
parent | 545f671b80f2ad39c8fdee07db3b03119c274187 (diff) |
RNA: Allow structs to define tags for their properties
Adds support for defining a number of tags as part of the rna-struct
definition, which its properties can set similar to property-flags.
BPY supports setting these tags when defining custom properties too.
* To define tags for a struct (which its properties can use then), define the tags in an `EnumPropertyItem` array, and assign them to the struct using `RNA_def_struct_property_tags(...)`.
* To set tags for an RNA-property in C, use the new `RNA_def_property_tags(...)`.
* To set tags for an RNA-property in Python, use the newly added tags parameter. E.g. `bpy.props.FloatProperty(name="Some Float", tags={'SOME_TAG', 'ANOTHER_TAG'})`.
Actual usage of this will be added in a follow-up commit.
Diffstat (limited to 'source/blender/makesrna/intern/rna_internal_types.h')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal_types.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index bf34d42116e..b43423464e9 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -159,6 +159,8 @@ struct PropertyRNA { short flag_parameter; /* Internal ("private") flags. */ short flag_internal; + /* The subset of StructRNA.prop_tag_defines values that applies to this property. */ + short tags; /* user readable name */ const char *name; @@ -356,6 +358,9 @@ struct StructRNA { /* various options */ int flag; + /* Each StructRNA type can define own tags which properties can set + * (PropertyRNA.tags) for changed behavior based on struct-type. */ + const EnumPropertyItem *prop_tag_defines; /* user readable name */ const char *name; |