pydrivers: 'frame' is now in the driver namespace,

- no need to link to scenes when using a frame from the pydriver, this made linking rigs for eg, quite messy.
- advantage that we get subframe values (where scenes from was fixed to a whole number).
This commit is contained in:
Campbell Barton
2011-11-17 07:08:09 +00:00
parent 1cfbde0eb4
commit db44a92a11
6 changed files with 43 additions and 25 deletions

View File

@@ -1576,7 +1576,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar)
* - "evaltime" is the frame at which F-Curve is being evaluated
* - has to return a float value
*/
static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
static float evaluate_driver (ChannelDriver *driver, const float evaltime)
{
DriverVar *dvar;
@@ -1663,8 +1663,10 @@ static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
/* this evaluates the expression using Python,and returns its result:
* - on errors it reports, then returns 0.0f
*/
driver->curval= BPY_driver_exec(driver);
driver->curval= BPY_driver_exec(driver, evaltime);
}
#else /* WITH_PYTHON*/
(void)evaltime;
#endif /* WITH_PYTHON*/
}
break;
@@ -2087,7 +2089,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime)
/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime")
* Note: this is also used for drivers
*/
float evaluate_fcurve (FCurve *fcu, float evaltime)
float evaluate_fcurve (FCurve *fcu, float evaltime)
{
float cvalue= 0.0f;
float devaltime;