diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-01-15 13:34:39 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-01-15 13:34:39 +0300 |
commit | 39ff5d7eb978d16370c37508c012bd9d319ac348 (patch) | |
tree | c946d43704c1e8122db612da04a488a41fb75aa3 /source/blender | |
parent | aed721e01cc4c0f03b03628f8a5898739c7eaf8e (diff) |
Reverting changes made in r25940 with the NLA unmapping.
The reverted code was just blindly restoring the old state of the keyframes; changes to selection state, value changes, handle type, etc. were overridden, and the cases where keyframes were deliberately retimed or otherwise were also ignored.
I'm not sure what problems these changes were meant to be solving, but will reassess the situation when I get more info on this.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 32 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframes_edit.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 18 | ||||
-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 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 18 |
10 files changed, 47 insertions, 87 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index fbacd22b360..f8a5a9daa06 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -260,14 +260,17 @@ typedef struct NlaMappingApplyBackup { /* helper function for ANIM_nla_mapping_apply_fcurve() -> "restore", i.e. mapping points back to action-time */ static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt) { - ListBase *lb= (ListBase*)bed->data2; - NlaMappingApplyBackup *backup= lb->first; - - /* restore beztriple from backup list. this used to use NLATIME_CONVERT_UNMAP, - but this was not the inverse of NLATIME_CONVERT_MAP and it's not clear how - that is even possible due to repeats - brecht. */ - *bezt= backup->bezt; - BLI_freelinkN(lb, backup); + /* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */ + AnimData *adt= (AnimData *)bed->data; + short only_keys= (short)bed->i1; + + /* adjust BezTriple handles only if allowed to */ + if (only_keys == 0) { + bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_UNMAP); + bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_UNMAP); + } + + bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP); return 0; } @@ -277,14 +280,7 @@ static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt) { /* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */ AnimData *adt= (AnimData*)bed->data; - ListBase *lb= (ListBase*)bed->data2; - NlaMappingApplyBackup *backup; short only_keys= (short)bed->i1; - - /* backup for restore later */ - backup= MEM_callocN(sizeof(NlaMappingApplyBackup), "NlaMappingApplyBackup"); - backup->bezt= *bezt; - BLI_addtail(lb, backup); /* adjust BezTriple handles only if allowed to */ if (only_keys == 0) { @@ -302,7 +298,7 @@ static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt) * - restore = whether to map points back to non-mapped time * - only_keys = whether to only adjust the location of the center point of beztriples */ -void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys, ListBase *backup) +void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys) { BeztEditData bed; BeztEditFunc map_cb; @@ -313,11 +309,7 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s */ memset(&bed, 0, sizeof(BeztEditData)); bed.data= (void *)adt; - bed.data2= (void *)backup; bed.i1= (int)only_keys; - - if(!restore) - backup->first= backup->last= NULL; /* get editing callback */ if (restore) diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 63633468767..3a48aa0b063 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -850,13 +850,12 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree { DLRBT_Tree *beztTree = NULL; BezTriple *bezt; - ListBase nlabackup; int v; if (fcu && fcu->totvert && fcu->bezt) { /* apply NLA-mapping (if applicable) */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1); /* if getting long keyframes too, grab the BezTriples in a BST for * accelerated searching... @@ -893,7 +892,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree /* unapply NLA-mapping if applicable */ if (adt) - ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 6d81131492a..531751a609e 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -453,7 +453,7 @@ void getcolor_fcurve_rainbow(int cur, int tot, float *out); struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */ -void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys, ListBase *backup); +void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys); /* ..... */ diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index d567398209f..9e29d747d4a 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -94,7 +94,6 @@ typedef struct BeztEditData { ListBase list; /* temp list for storing custom list of data to check */ struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */ void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */ - void *data2; /* pointer to more custom data */ float f1, f2; /* storage of times/values as 'decimals' */ int i1, i2; /* storage of times/values/flags as 'whole' numbers */ } BeztEditData; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index b35f9594397..6dcd3049c0e 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1134,11 +1134,9 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *op) for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(&ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); @@ -1216,11 +1214,9 @@ static void snap_action_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } //else if (ale->type == ACTTYPE_GPLAYER) // snap_gplayer_frames(ale->data, mode); @@ -1335,11 +1331,9 @@ static void mirror_action_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } //else if (ale->type == ACTTYPE_GPLAYER) // snap_gplayer_frames(ale->data, mode); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 3f7a568fc00..1881cfbc99c 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -416,12 +416,10 @@ static void markers_selectkeys_between (bAnimContext *ac) for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); - if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + if (adt) { + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else { ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); @@ -663,19 +661,15 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short /* select keys on the side where most data occurs */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); - -#if 0 // This does not work even in simple cases I tested - campbell + if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } //else if (ale->type == ANIMTYPE_GPLAYER) // borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD); else -#endif ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 4735950c9d1..9681d20c13b 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -819,11 +819,10 @@ 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); /* draw curve: * - curve line may be result of one or more destructive modifiers or just the raw data, @@ -909,7 +908,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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); } /* 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 1bae3686fe2..2adf783b338 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1557,11 +1557,9 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) AnimData *adt= ANIM_nla_mapping_get(&ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); @@ -1647,11 +1645,9 @@ static void snap_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); @@ -1766,11 +1762,9 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } 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 b732d17e34f..8d2e2921b7f 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -394,11 +394,9 @@ static void markers_selectkeys_between (bAnimContext *ac) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else { ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); @@ -591,11 +589,10 @@ 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); for (i=0; i < fcu->totvert; i++, prevbezt=bezt1, bezt1++) { /* convert beztriple points to screen-space */ @@ -653,7 +650,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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } } @@ -800,11 +797,9 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 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, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2769112e5d5..ebd25271a8a 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3014,11 +3014,9 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act) AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); posttrans_fcurve_clean(ale->key_data); - ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else posttrans_fcurve_clean(ale->key_data); @@ -4785,11 +4783,9 @@ void special_aftertrans_update(bContext *C, TransInfo *t) ((cancelled == 0) || (duplicate)) ) { if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1); posttrans_fcurve_clean(fcu); - ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } else posttrans_fcurve_clean(fcu); @@ -4868,11 +4864,9 @@ void special_aftertrans_update(bContext *C, TransInfo *t) ((cancelled == 0) || (duplicate)) ) { if (adt) { - ListBase nlabackup; - - ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1); posttrans_fcurve_clean(fcu); - ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1, &nlabackup); + ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } else posttrans_fcurve_clean(fcu); |