Fix T52213: Enum drivers no longer work

Regression in D1812: PyDriver variables as Objects

Taking the Python representation is nice in general
but for enums it would convert them into strings,
breaking some existing drivers.
This commit is contained in:
Campbell Barton 2017-07-29 02:39:16 +10:00
parent e038830650
commit 87d5e34453
Notes: blender-bot 2023-02-14 06:45:11 +01:00
Referenced by issue #52213, Driver doesn't work with value from rollout
1 changed files with 9 additions and 1 deletions

View File

@ -63,7 +63,15 @@ PyObject *pyrna_driver_get_variable_value(
}
else {
/* object & property */
driver_arg = pyrna_prop_to_py(&ptr, prop);
PropertyType type = RNA_property_type(prop);
if (type == PROP_ENUM) {
/* Note that enum's are converted to strings by default,
* we want to avoid that, see: T52213 */
driver_arg = PyLong_FromLong(RNA_property_enum_get(&ptr, prop));
}
else {
driver_arg = pyrna_prop_to_py(&ptr, prop);
}
}
}
else {