Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-09-01 09:50:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-01 09:50:48 +0300
commit89fa9aada56bae1505d2c803a1b127d2c0c15970 (patch)
tree6d46134c15474c4d5cc5d99e4245decb6d01846b /source/blender/python/generic/py_capi_rna.c
parent1730829592478f584d15f7874fa7e9cade1eb169 (diff)
Cleanup: use "pyrna_enum_*" prefix for RNA utility functions
Diffstat (limited to 'source/blender/python/generic/py_capi_rna.c')
-rw-r--r--source/blender/python/generic/py_capi_rna.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/python/generic/py_capi_rna.c b/source/blender/python/generic/py_capi_rna.c
index c4ec0be088d..f6a556a3fff 100644
--- a/source/blender/python/generic/py_capi_rna.c
+++ b/source/blender/python/generic/py_capi_rna.c
@@ -37,7 +37,11 @@
#include "MEM_guardedalloc.h"
-char *BPy_enum_as_string(const EnumPropertyItem *item)
+/**
+ * Convert all items into a single comma separated string.
+ * Use for creating useful error messages.
+ */
+char *pyrna_enum_repr(const EnumPropertyItem *item)
{
DynStr *dynstr = BLI_dynstr_new();
@@ -64,7 +68,7 @@ int pyrna_enum_value_from_id(const EnumPropertyItem *item,
const char *error_prefix)
{
if (RNA_enum_value_from_id(item, identifier, r_value) == 0) {
- const char *enum_str = BPy_enum_as_string(item);
+ const char *enum_str = pyrna_enum_repr(item);
PyErr_Format(
PyExc_ValueError, "%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
MEM_freeN((void *)enum_str);
@@ -106,7 +110,7 @@ int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
}
struct BPy_EnumProperty_Parse *parse_data = p;
- if (pyrna_set_to_enum_bitfield(
+ if (pyrna_enum_bitfield_from_set(
parse_data->items, o, &parse_data->value, "enum identifier set") == -1) {
return 0;
}
@@ -123,12 +127,12 @@ int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
* \param type_convert_sign: Maps signed to unsigned range,
* needed when we want to use the full range of a signed short/char.
*/
-BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items,
- PyObject *value,
- int type_size,
- bool type_convert_sign,
- int bitmap_size,
- const char *error_prefix)
+BLI_bitmap *pyrna_enum_bitmap_from_set(const EnumPropertyItem *items,
+ PyObject *value,
+ int type_size,
+ bool type_convert_sign,
+ int bitmap_size,
+ const char *error_prefix)
{
/* Set looping. */
Py_ssize_t pos = 0;
@@ -189,10 +193,10 @@ error:
/**
* 'value' _must_ be a set type, error check before calling.
*/
-int pyrna_set_to_enum_bitfield(const EnumPropertyItem *items,
- PyObject *value,
- int *r_value,
- const char *error_prefix)
+int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items,
+ PyObject *value,
+ int *r_value,
+ const char *error_prefix)
{
/* Set of enum items, concatenate all values with OR. */
int ret, flag = 0;
@@ -226,7 +230,7 @@ int pyrna_set_to_enum_bitfield(const EnumPropertyItem *items,
return 0;
}
-PyObject *pyrna_enum_bitfield_to_py(const EnumPropertyItem *items, int value)
+PyObject *pyrna_enum_bitfield_as_set(const EnumPropertyItem *items, int value)
{
PyObject *ret = PySet_New(NULL);
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];