diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-13 00:20:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-13 00:20:09 +0300 |
commit | b39be6007576021fb377343cd880bfcc44b77031 (patch) | |
tree | 90ef38312c85bb513413b41484db98030de07e33 /source/blender/editors/space_graph | |
parent | 63e80e271dd3f9f79fe3a85c10253ee6eea2ba4e (diff) |
NLA: fix keyframes getting messed up when making strips longer. For drawing
and other operations the nla mapping would be applied to the curves, but not
restored correctly. The unmap function was not the inverse of the map function,
and it's not clear to me it's even possible to make it so due to repeat, so
now the old coordinates are backed up in a list and then restored afterwards.
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 17 |
3 files changed, 26 insertions, 14 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 9681d20c13b..4735950c9d1 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -819,10 +819,11 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri FCurve *fcu= (FCurve *)ale->key_data; FModifier *fcm= find_active_fmodifier(&fcu->modifiers); AnimData *adt= ANIM_nla_mapping_get(ac, ale); + ListBase nlabackup; /* map keyframes for drawing if scaled F-Curve */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0, &nlabackup); /* draw curve: * - curve line may be result of one or more destructive modifiers or just the raw data, @@ -908,7 +909,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* undo mapping of keyframes for drawing if scaled F-Curve */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0, &nlabackup); } /* free list of curves */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 2adf783b338..1bae3686fe2 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1557,9 +1557,11 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) AnimData *adt= ANIM_nla_mapping_get(&ac, ale); if (adt) { - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ListBase nlabackup; + + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); @@ -1645,9 +1647,11 @@ static void snap_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ListBase nlabackup; + + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); @@ -1762,9 +1766,11 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ListBase nlabackup; + + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 8d2e2921b7f..b732d17e34f 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -394,9 +394,11 @@ static void markers_selectkeys_between (bAnimContext *ac) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ListBase nlabackup; + + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } else { ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); @@ -589,10 +591,11 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc /* try to progressively get closer to the right point... */ if (fcu->bezt) { BezTriple *bezt1=fcu->bezt, *prevbezt=NULL; + ListBase nlabackup; /* apply NLA mapping to all the keyframes */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); for (i=0; i < fcu->totvert; i++, prevbezt=bezt1, bezt1++) { /* convert beztriple points to screen-space */ @@ -650,7 +653,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc /* un-apply NLA mapping from all the keyframes */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } } @@ -797,9 +800,11 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + ListBase nlabackup; + + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); |