PyAPI: support accessing the original value for RNA enum parsing
Needed in siturations when the input argument is needed for exception messages.
This commit is contained in:
parent
ddcb6b1023
commit
a2b8dad469
|
@ -832,6 +832,8 @@ int pyrna_enum_value_parse_string(PyObject *o, void *p)
|
|||
parse_data->items, identifier, &parse_data->value, "enum identifier") == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
parse_data->value_orig = o;
|
||||
parse_data->is_set = true;
|
||||
return 1;
|
||||
}
|
||||
|
@ -851,6 +853,7 @@ int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
|
|||
parse_data->items, o, &parse_data->value, "enum identifier set") == -1) {
|
||||
return 0;
|
||||
}
|
||||
parse_data->value_orig = o;
|
||||
parse_data->is_set = true;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -219,6 +219,13 @@ int pyrna_set_to_enum_bitfield(const struct EnumPropertyItem *items,
|
|||
*/
|
||||
struct BPy_EnumProperty_Parse {
|
||||
const EnumPropertyItem *items;
|
||||
/**
|
||||
* Set when the value was successfully parsed.
|
||||
* Useful if the input ever needs to be included in an error message.
|
||||
* (if the value is not supported under certain conditions).
|
||||
*/
|
||||
PyObject *value_orig;
|
||||
|
||||
int value;
|
||||
bool is_set;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue