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>2017-07-28 19:39:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-07-28 19:39:16 +0300
commit87d5e34453249fbf53d22b63c4f2442e3f8ec32e (patch)
tree15780483384e90243ef4219bebec7daa66efe0d2
parente03883065042412347e7b72a4102532d7b1fc495 (diff)
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.
-rw-r--r--source/blender/python/intern/bpy_rna_driver.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_rna_driver.c b/source/blender/python/intern/bpy_rna_driver.c
index b4c0de51c04..1135ba121e3 100644
--- a/source/blender/python/intern/bpy_rna_driver.c
+++ b/source/blender/python/intern/bpy_rna_driver.c
@@ -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 {