Recent pydriver update missed setting 'curval'

Using PyObject's for drivers (82b0a9e36) still needs to set the 'current value'
for debug info to display in the UI.

Resolves T48251
This commit is contained in:
Campbell Barton
2016-04-25 15:25:32 +10:00
parent 45835e227e
commit fc5a37b94e

View File

@@ -273,6 +273,22 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
if (driver_arg == NULL) {
driver_arg = PyFloat_FromDouble(0.0);
dvar->curval = 0.0f;
}
else {
/* no need to worry about overflow here, values from RNA are within limits. */
if (PyFloat_CheckExact(driver_arg)) {
dvar->curval = (float)PyFloat_AsDouble(driver_arg);
}
else if (PyLong_CheckExact(driver_arg)) {
dvar->curval = (float)PyLong_AsLong(driver_arg);
}
else if (PyBool_Check(driver_arg)) {
dvar->curval = (driver_arg == Py_True);
}
else {
dvar->curval = 0.0f;
}
}
}
else