From 23d148ecaf923a490c3dd4a22d6dd96ea7cb9654 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 23 Nov 2017 13:41:07 +0100 Subject: 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. --- source/blender/makesrna/RNA_define.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/makesrna/RNA_define.h') diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 47648583e14..e9e4276b235 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -66,6 +66,7 @@ void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop); void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname); void RNA_def_struct_flag(StructRNA *srna, int flag); void RNA_def_struct_clear_flag(StructRNA *srna, int flag); +void RNA_def_struct_property_tags(StructRNA *srna, const EnumPropertyItem *prop_tag_defines); void RNA_def_struct_refine_func(StructRNA *srna, const char *refine); void RNA_def_struct_idprops_func(StructRNA *srna, const char *refine); void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance); @@ -148,6 +149,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag); void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag); +void RNA_def_property_tags(PropertyRNA *prop, int tags); void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype); void RNA_def_property_array(PropertyRNA *prop, int length); void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[]); -- cgit v1.2.3