diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-29 09:03:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-29 09:03:21 +0400 |
commit | 5bbd0decfdbcb716064726b75949263a57b02d89 (patch) | |
tree | 658af0e44d5880026305b0e75d475ed1eaf5848d /source/blender/editors | |
parent | 45b74dcf2cd787841459ac7cb133ca6ecca83e19 (diff) |
fix [#28765] keyframe handles do not move with curves in graph editor when hidden, resulting in bad curves.
hide handles wasn't properly respected by transform function testhandles_fcurve().
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 29 |
3 files changed, 24 insertions, 17 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index fa619e4cf44..af78fe739cc 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -51,6 +51,7 @@ #include "DNA_node_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" +#include "DNA_space_types.h" #include "DNA_world_types.h" #include "BKE_fcurve.h" @@ -386,6 +387,9 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + /* when not in graph view, don't use handles */ + SpaceIpo *sipo= (ac->spacetype == SPACE_IPO) ? (SpaceIpo *)ac->sl : NULL; + const short use_handle = sipo ? !(sipo->flag & SIPO_NOHANDLES) : FALSE; /* filter animation data */ filter= ANIMFILTER_DATA_VISIBLE; @@ -397,7 +401,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) /* make sure keyframes in F-Curve are all in order, and handles are in valid positions */ sort_time_fcurve(fcu); - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* free temp data */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 28fd1cd3304..f1593105d5b 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -245,13 +245,15 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT } /* update callback for active keyframe properties - base updates stuff */ -static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr)) +static void graphedit_activekey_update_cb(bContext *C, void *fcu_ptr, void *UNUSED(bezt_ptr)) { + SpaceIpo *sipo= CTX_wm_space_graph(C); + const short use_handle = !(sipo->flag & SIPO_NOHANDLES); FCurve *fcu = (FCurve *)fcu_ptr; /* make sure F-Curve and its handles are still valid after this editing */ sort_time_fcurve(fcu); - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* update callback for active keyframe properties - handle-editing wrapper */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index db9be369761..c2d63fa8246 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2785,7 +2785,7 @@ static void posttrans_gpd_clean (bGPdata *gpd) /* Called during special_aftertrans_update to make sure selected keyframes replace * any other keyframes which may reside on that frame (that is not selected). */ -static void posttrans_fcurve_clean (FCurve *fcu) +static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) { float *selcache; /* cache for frame numbers of selected frames (fcu->totvert*sizeof(float)) */ int len, index, i; /* number of frames in cache, item index */ @@ -2834,7 +2834,7 @@ static void posttrans_fcurve_clean (FCurve *fcu) } } - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* free cache */ @@ -2865,11 +2865,11 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act) if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); - posttrans_fcurve_clean(ale->key_data); + posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else - posttrans_fcurve_clean(ale->key_data); + posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ } /* free temp data */ @@ -3320,9 +3320,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel1= use_handle ? bezt->f1 & SELECT : 0; const char sel2= bezt->f2 & SELECT; - const char sel3= use_handle ? bezt->f3 & SELECT : 0; + const char sel1= use_handle ? bezt->f1 & SELECT : sel2; + const char sel3= use_handle ? bezt->f3 & SELECT : sel2; if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { /* for 'normal' pivots - just include anything that is selected. @@ -3413,9 +3413,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */ for (i=0, bezt= fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel1= use_handle ? bezt->f1 & SELECT : 0; const char sel2= bezt->f2 & SELECT; - const char sel3= use_handle ? bezt->f3 & SELECT : 0; + const char sel1= use_handle ? bezt->f1 & SELECT : sel2; + const char sel3= use_handle ? bezt->f3 & SELECT : sel2; TransDataCurveHandleFlags *hdata = NULL; /* short h1=1, h2=1; */ /* UNUSED */ @@ -3475,7 +3475,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* Sets handles based on the selection */ - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* cleanup temp list */ @@ -3679,7 +3679,7 @@ void remake_graph_transdata (TransInfo *t, ListBase *anim_data) sort_time_fcurve(fcu); /* make sure handles are all set correctly */ - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } } } @@ -4832,11 +4832,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t) { if (adt) { ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1); - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } else - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ } } @@ -4916,6 +4916,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if (t->spacetype == SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; bAnimContext ac; + const short use_handle = !(sipo->flag & SIPO_NOHANDLES); /* initialise relevant anim-context 'context' data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -4944,11 +4945,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t) { if (adt) { ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0); - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, use_handle); ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0); } else - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, use_handle); } } |