diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-11-23 15:58:05 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-11-23 15:58:05 +0300 |
commit | 60cbdb01527e08f9036eb3d577da1c44a9ce30c7 (patch) | |
tree | 555662f7568a87840d5cd5e57ff2d4f90f884977 /source/blender/makesrna/intern/rna_access.c | |
parent | 23d148ecaf923a490c3dd4a22d6dd96ea7cb9654 (diff) |
Support tagging operator properties as 'advanced'
This will later be used to show advanced operator properties separate from
basic (as in non-advanced) ones in the UI.
Tagging a single operator property in C should be done via
`WM_operatortype_prop_tag()`. It does additional checks for type safety
that `RNA_def_property_tags()` doesn't do.
To avoid having to tag each advanced property individually, multiple
ones can be tagged by wrapping them into
`WM_operatortype_props_advanced_bein()` and
`WM_operatortype_props_advanced_end()` calls. It's also possible to only
call `_begin()`, all properties added after this will get tagged then.
In most cases this last approach should be sufficient.
Example of Python usage:
`my_float = bpy.props.FloatProperty(name="Some Float", tags={'ADVANCED'})`
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 4aebcbb0aaf..9c510176bb2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -727,6 +727,23 @@ bool RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test) return found; } +unsigned int RNA_struct_count_properties(StructRNA *srna) +{ + PointerRNA struct_ptr; + unsigned int counter = 0; + + RNA_pointer_create(NULL, srna, NULL, &struct_ptr); + + RNA_STRUCT_BEGIN (&struct_ptr, prop) + { + counter++; + UNUSED_VARS(prop); + } + RNA_STRUCT_END; + + return counter; +} + /* low level direct access to type->properties, note this ignores parent classes so should be used with care */ const struct ListBase *RNA_struct_type_properties(StructRNA *srna) { |