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/RNA_access.h | |
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/RNA_access.h')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index dd96b1848df..5f97724eaa6 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -745,6 +745,7 @@ const char *RNA_struct_translation_context(const StructRNA *type); int RNA_struct_ui_icon(const StructRNA *type); PropertyRNA *RNA_struct_name_property(StructRNA *type); +const EnumPropertyItem *RNA_struct_property_tag_defines(const StructRNA *type); PropertyRNA *RNA_struct_iterator_property(StructRNA *type); StructRNA *RNA_struct_base(StructRNA *type); @@ -799,6 +800,7 @@ PropertyType RNA_property_type(PropertyRNA *prop); PropertySubType RNA_property_subtype(PropertyRNA *prop); PropertyUnit RNA_property_unit(PropertyRNA *prop); int RNA_property_flag(PropertyRNA *prop); +int RNA_property_tags(PropertyRNA *prop); bool RNA_property_builtin(PropertyRNA *prop); void *RNA_property_py_data_get(PropertyRNA *prop); @@ -835,6 +837,7 @@ bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **description); int RNA_enum_from_value(const EnumPropertyItem *item, const int value); int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier); +unsigned int RNA_enum_items_count(const EnumPropertyItem *item); void RNA_property_enum_items_ex( struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static, |