diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-11-29 05:52:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-29 05:53:34 +0300 |
commit | ad625acda82281461267a3379c57ce76d54325a1 (patch) | |
tree | 22b2b7c583ba35c33cfec4aac7608f5f62e6e2c8 /source/blender/makesrna/intern/makesrna.c | |
parent | 0b325ba201269b3c8aab6e61c70f15c1758737d8 (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'})`.
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index ff081a56b61..e1d4e8fb8ad 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3010,7 +3010,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr else fprintf(f, "NULL,\n"); fprintf(f, "\t%d, ", prop->magic); rna_print_c_string(f, prop->identifier); - fprintf(f, ", %d, %d, %d, ", prop->flag, prop->flag_parameter, prop->flag_internal); + fprintf(f, ", %d, %d, %d, %d, ", prop->flag, prop->flag_parameter, prop->flag_internal, prop->tags); rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); fprintf(f, "%d, ", prop->icon); @@ -3254,7 +3254,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "\t"); rna_print_c_string(f, srna->identifier); fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */ - fprintf(f, ", %d, ", srna->flag); + fprintf(f, ", %d, NULL, ", srna->flag); rna_print_c_string(f, srna->name); fprintf(f, ",\n\t"); rna_print_c_string(f, srna->description); |