From 0e1eca2d08035a24067406167aa5cdea0b16d274 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 26 Jan 2010 09:25:32 +0000 Subject: Finishing off the Transform code changes for Degrees/Radians: Added flags for the mapping function offering more control over what values were affected and when. In the WIP code, the values for unselected verts were getting the restoration conversion being repeatedly applied, resulting in the values tending to zero. --- source/blender/editors/space_graph/graph_draw.c | 12 ++++++------ source/blender/editors/space_graph/graph_edit.c | 12 ++++++------ source/blender/editors/space_graph/graph_select.c | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 553e52ae27e..b52fc1b9e6a 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -561,7 +561,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi glBegin(GL_LINE_STRIP); /* apply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0); /* extrapolate to left? - left-side of view comes before first keyframe? */ if (prevfpt->vec[0] > v2d->cur.xmin) { @@ -622,7 +622,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi } /* unapply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 1, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, ANIM_UNITCONV_RESTORE); glEnd(); } @@ -641,7 +641,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View glBegin(GL_LINE_STRIP); /* apply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0); /* extrapolate to left? */ if (prevbezt->vec[1][0] > v2d->cur.xmin) { @@ -775,7 +775,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View } /* unapply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 1, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, ANIM_UNITCONV_RESTORE); glEnd(); } @@ -912,7 +912,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { /* apply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0); if (fcu->bezt) { /* only draw handles/vertices on keyframes */ @@ -928,7 +928,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri } /* unapply unit mapping */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 1, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, ANIM_UNITCONV_RESTORE); } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 9842d2ae9ae..00951db61d3 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1574,7 +1574,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) AnimData *adt= ANIM_nla_mapping_get(&ac, ale); /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, 0, 1); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); @@ -1585,7 +1585,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); /* unapply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, 1, 1); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|ANIM_UNITCONV_ONLYKEYS); } BLI_freelistN(&anim_data); @@ -1667,7 +1667,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); @@ -1678,7 +1678,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE); } BLI_freelistN(&anim_data); @@ -1791,7 +1791,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 1); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); @@ -1802,7 +1802,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); /* unapply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 1); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS|ANIM_UNITCONV_RESTORE); } BLI_freelistN(&anim_data); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index e9b6cb226d0..b90d5a48d9a 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -248,7 +248,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho FCurve *fcu= (FCurve *)ale->key_data; /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 1); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); /* apply NLA mapping to all the keyframes, since it's easier than trying to * guess when a callback might use something different @@ -287,7 +287,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); /* unapply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 1); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|ANIM_UNITCONV_ONLYKEYS); } /* cleanup */ @@ -609,7 +609,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc AnimData *adt= ANIM_nla_mapping_get(ac, ale); /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0); /* try to progressively get closer to the right point... */ if (fcu->bezt) { @@ -679,7 +679,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc } /* unapply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 0); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE); } /* free channels */ -- cgit v1.2.3