Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-29 09:03:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-29 09:03:21 +0400
commit5bbd0decfdbcb716064726b75949263a57b02d89 (patch)
tree658af0e44d5880026305b0e75d475ed1eaf5848d
parent45b74dcf2cd787841459ac7cb133ca6ecca83e19 (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().
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h2
-rw-r--r--source/blender/blenkernel/intern/fcurve.c13
-rw-r--r--source/blender/editors/animation/keyframes_edit.c6
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c6
-rw-r--r--source/blender/editors/transform/transform_conversions.c29
5 files changed, 35 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 244fda33a52..08798a6ddf0 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -231,7 +231,7 @@ short fcurve_is_keyframable(struct FCurve *fcu);
/* -------- Curve Sanity -------- */
void calchandles_fcurve(struct FCurve *fcu);
-void testhandles_fcurve(struct FCurve *fcu);
+void testhandles_fcurve(struct FCurve *fcu, const short use_handle);
void sort_time_fcurve(struct FCurve *fcu);
short test_time_fcurve(struct FCurve *fcu);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 3916d0ca701..8ea80ae9296 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -818,7 +818,7 @@ void calchandles_fcurve (FCurve *fcu)
* -> Vector handles: become 'nothing' when (one half selected AND other not)
* - PHASE 2: recalculate handles
*/
-void testhandles_fcurve (FCurve *fcu)
+void testhandles_fcurve (FCurve *fcu, const short use_handle)
{
BezTriple *bezt;
unsigned int a;
@@ -834,9 +834,16 @@ void testhandles_fcurve (FCurve *fcu)
/* flag is initialised as selection status
* of beztriple control-points (labelled 0,1,2)
*/
- if (bezt->f1 & SELECT) flag |= (1<<0); // == 1
if (bezt->f2 & SELECT) flag |= (1<<1); // == 2
- if (bezt->f3 & SELECT) flag |= (1<<2); // == 4
+ if(use_handle == FALSE) {
+ if(flag & 2) {
+ flag |= (1<<0) | (1<<2);
+ }
+ }
+ else {
+ if (bezt->f1 & SELECT) flag |= (1<<0); // == 1
+ if (bezt->f3 & SELECT) flag |= (1<<2); // == 4
+ }
/* one or two handles selected only */
if (ELEM(flag, 0, 7)==0) {
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);
}
}