diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-29 22:10:52 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-29 22:10:52 +0400 |
commit | 16d13e0db9d75566735966d81d213958df3ca7e5 (patch) | |
tree | 90d32baaabc12a690360bea0f9129bd2c2e1b436 /source/blender/editors/space_graph/graph_draw.c | |
parent | f6e504cee9f85867554f5a0ab89b52a66c0f257e (diff) |
Project Pampa request: FCurves normalized display
Added two options to a header of FCurve editor:
- Normalize which makes it so every individual
curve is fit into -1..1 space.
- Auto-normalize, which probably is to be called
"Lock" which "locks" curve normalization scale.
This is useful to prevent curves from jumping
around when tweaking it.
It's debatable whether it need to be a button to
normalize curves n purpose only, and it's fully
depends on animator's workflow.
Here during Project Pampa we've got Francesco
who get used to auto-renormalization and Hjalti
who prefers locked behavior.
Docs are to be ready soon by Francesco.
Thanks Brecht for the review!
Diffstat (limited to 'source/blender/editors/space_graph/graph_draw.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ba619fd9c77..e7c98437b9f 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -490,6 +490,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d float stime, etime; float unitFac; float dx, dy; + short mapping_flag = ANIM_get_normalization_flags(ac); /* when opening a blend file on a different sized screen or while dragging the toolbar this can happen * best just bail out in this case */ @@ -503,7 +504,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, 0); + unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag); /* Note about sampling frequency: * Ideally, this is chosen such that we have 1-2 pixels = 1 segment @@ -551,10 +552,11 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie float fac, v[2]; int b = fcu->totvert - 1; float unit_scale; + short mapping_flag = ANIM_get_normalization_flags(ac); /* apply unit mapping */ glPushMatrix(); - unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0); + unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag); glScalef(1.0f, unit_scale, 1.0f); glBegin(GL_LINE_STRIP); @@ -632,10 +634,11 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 int b = fcu->totvert - 1; int resol; float unit_scale; + short mapping_flag = ANIM_get_normalization_flags(ac); /* apply unit mapping */ glPushMatrix(); - unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0); + unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag); glScalef(1.0f, unit_scale, 1.0f); glBegin(GL_LINE_STRIP); @@ -788,7 +791,8 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) { ChannelDriver *driver = fcu->driver; View2D *v2d = &ac->ar->v2d; - float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, false); + short mapping_flag = ANIM_get_normalization_flags(ac); + float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag); /* for now, only show when debugging driver... */ //if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0) @@ -1019,7 +1023,8 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid } } else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) { - float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0); + short mapping_flag = ANIM_get_normalization_flags(ac); + float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag); glPushMatrix(); glScalef(1.0f, unit_scale, 1.0f); |