From ac750cf7a28574f3f03e2d7b3519257dc02dc499 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 9 Mar 2008 03:41:13 +0000 Subject: * Numeric input now works better for TimeSlide * Removed a compiler warning --- source/blender/src/transform.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/src/transform.c') diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 0f0fe4697e0..b7bc6a2f027 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -4397,21 +4397,23 @@ static void applyTimeSlide(TransInfo *t, float sval) int TimeSlide(TransInfo *t, short mval[2]) { float cval[2], sval[2]; + float minx= *((float *)(t->customData)); + float maxx= *((float *)(t->customData) + 1); char str[200]; /* calculate mouse co-ordinates */ areamouseco_to_ipoco(G.v2d, mval, &cval[0], &cval[1]); areamouseco_to_ipoco(G.v2d, t->imval, &sval[0], &sval[1]); - /* calculate fake value to work with */ + /* t->fac stores cval[0], which is the current mouse-pointer location (in frames) */ t->fac= cval[0]; /* handle numeric-input stuff */ - t->vec[0] = t->fac; + t->vec[0] = 2.0*(cval[0]-sval[0]) / (maxx-minx); applyNumInput(&t->num, &t->vec[0]); - t->fac = t->vec[0]; - headerTimeSlide(t, sval[0], str); + t->fac = (maxx-minx) * t->vec[0] / 2.0 + sval[0]; + headerTimeSlide(t, sval[0], str); applyTimeSlide(t, sval[0]); recalcData(t); -- cgit v1.2.3