diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-07-29 08:11:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-07-30 04:57:43 +0300 |
commit | ddcb6b1023bf3089cd6d2db3012b68b9ec2b980f (patch) | |
tree | 3b6f98987a5f8ab1b09edb628d2c346cb51fcf82 /source/blender/python/intern/bpy_rna.h | |
parent | 5280d4bf0bf6e76d370bdf17d85299bcec608607 (diff) |
Cleanup: replace macros with converter callbacks for bpy.props
Macros were used for expanding shared logic for some properties.
Replace this with Python converters & a funciton that handles
deferred registration.
Add generic converter functions for RNA enums:
- pyrna_enum_value_parse_string
- pyrna_enum_bitfield_parse_set
Diffstat (limited to 'source/blender/python/intern/bpy_rna.h')
-rw-r--r-- | source/blender/python/intern/bpy_rna.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 75534c05d6c..23a6b19c22c 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -213,6 +213,18 @@ int pyrna_set_to_enum_bitfield(const struct EnumPropertyItem *items, int *r_value, const char *error_prefix); +/** + * Data for #pyrna_enum_value_parse_string & #pyrna_enum_bitfield_parse_set parsing utilities. + * Use with #PyArg_ParseTuple's `O&` formatting. + */ +struct BPy_EnumProperty_Parse { + const EnumPropertyItem *items; + int value; + bool is_set; +}; +int pyrna_enum_value_parse_string(PyObject *o, void *p); +int pyrna_enum_bitfield_parse_set(PyObject *o, void *p); + int pyrna_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *value, |