Graph editor:
Normalization feature now uses the full range of the data instead of just one semiaxis for the maximum size.
This commit is contained in:
@@ -481,7 +481,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
|
||||
ChannelDriver *driver;
|
||||
float samplefreq;
|
||||
float stime, etime;
|
||||
float unitFac;
|
||||
float unitFac, offset;
|
||||
float dx, dy;
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
int i, n;
|
||||
@@ -498,7 +498,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
|
||||
fcu->driver = NULL;
|
||||
|
||||
/* compute unit correction factor */
|
||||
unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
||||
unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
|
||||
|
||||
/* Note about sampling frequency:
|
||||
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
|
||||
@@ -550,7 +550,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
|
||||
n = (etime - stime) / samplefreq + 0.5f;
|
||||
for (i = 0; i <= n; i++) {
|
||||
float ctime = stime + i * samplefreq;
|
||||
glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
|
||||
glVertex2f(ctime, (evaluate_fcurve(fcu, ctime) + offset) * unitFac);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
@@ -566,13 +566,14 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
|
||||
FPoint *fpt = prevfpt + 1;
|
||||
float fac, v[2];
|
||||
int b = fcu->totvert - 1;
|
||||
float unit_scale;
|
||||
float unit_scale, offset;
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
|
||||
/* apply unit mapping */
|
||||
glPushMatrix();
|
||||
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
||||
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
|
||||
glScalef(1.0f, unit_scale, 1.0f);
|
||||
glTranslatef(0.0f, offset, 0.0f);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
@@ -665,14 +666,15 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
|
||||
float fac = 0.0f;
|
||||
int b = fcu->totvert - 1;
|
||||
int resol;
|
||||
float unit_scale;
|
||||
float unit_scale, offset;
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
|
||||
/* apply unit mapping */
|
||||
glPushMatrix();
|
||||
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
||||
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
|
||||
glScalef(1.0f, unit_scale, 1.0f);
|
||||
|
||||
glTranslatef(0.0f, offset, 0.0f);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
/* extrapolate to left? */
|
||||
@@ -826,7 +828,8 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
|
||||
ChannelDriver *driver = fcu->driver;
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
||||
float offset;
|
||||
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
|
||||
|
||||
/* for now, only show when debugging driver... */
|
||||
//if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
|
||||
@@ -850,10 +853,10 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
|
||||
glBegin(GL_LINES);
|
||||
{
|
||||
t = v2d->cur.xmin;
|
||||
glVertex2f(t, t * unitfac);
|
||||
glVertex2f(t, (t + offset) * unitfac);
|
||||
|
||||
t = v2d->cur.xmax;
|
||||
glVertex2f(t, t * unitfac);
|
||||
glVertex2f(t, (t + offset) * unitfac);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
@@ -1067,10 +1070,12 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
|
||||
}
|
||||
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
|
||||
float offset;
|
||||
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(1.0f, unit_scale, 1.0f);
|
||||
glTranslatef(0.0f, offset, 0.0f);
|
||||
|
||||
if (fcu->bezt) {
|
||||
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
|
||||
|
||||
Reference in New Issue
Block a user