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:
parent
e038830650
commit
87d5e34453
Notes:
blender-bot
2024-05-31 15:34:53 +02:00
Referenced by issue #52213, Driver doesn't work with value from rollout
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue