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:
authorJoshua Leung <aligorith@gmail.com>2009-09-04 08:27:06 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-04 08:27:06 +0400
commita819ef1bf2222b2e1132c0a3d9b6b133c8263348 (patch)
tree0302e8fef8f5db846429df8b07c56f2fdd50d738 /source/blender/editors/space_graph
parentd577e0d986651ee28c6c1031df7db966430f218f (diff)
2.5 - Keyframing Bugfixes + Code Cleanups
* DopeSheet + Graph Editor - 'Sample Keyframes' option now tags newly created keyframes as being breakdowns. Also moved reduced the code duplication here by moving the core code for this to the animation module. * Keyframing (Standard/Auto) - Added proper 'replace' option Keyframes can now be rekeyed non-destructively when the INSERTKEY_REPLACE flag is provided to the keyframing API functions, since this option will make sure that only the values of the handles get altered. For the Auto-Keyframing 'Replace/Edit Keys' option, this means that it truly works as it describes now, since it will now only replace the values of the keyframes on the current frame, and won't create new keyframes in the process or destroy the tangents already created for those keys. For things like the sliders in animation editors, keyframes changing the value won't destroy existing tangents.
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_edit.c69
1 files changed, 3 insertions, 66 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 37389b32b3a..d718ef28e99 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -430,7 +430,7 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
/* init keyframing flag */
if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
- // if (IS_AUTOKEY_MODE(EDITKEYS)) flag |= INSERTKEY_REPLACE;
+ if (IS_AUTOKEY_MODE(scene, EDITKEYS)) flag |= INSERTKEY_REPLACE;
/* insert keyframes */
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -989,13 +989,6 @@ void GRAPH_OT_bake (wmOperatorType *ot)
* of selected keyframes. It is useful for creating keyframes for tweaking overlap.
*/
-// XXX some of the common parts (with DopeSheet) should be unified in animation module...
-
-/* little cache for values... */
-typedef struct tempFrameValCache {
- float frame, val;
-} tempFrameValCache;
-
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
static void sample_graph_keys (bAnimContext *ac)
{
@@ -1008,64 +1001,8 @@ static void sample_graph_keys (bAnimContext *ac)
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
- for (ale= anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->key_data;
- BezTriple *bezt, *start=NULL, *end=NULL;
- tempFrameValCache *value_cache, *fp;
- int sfra, range;
- int i, n;
-
- /* find selected keyframes... once pair has been found, add keyframes */
- for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
- /* check if selected, and which end this is */
- if (BEZSELECTED(bezt)) {
- if (start) {
- /* set end */
- end= bezt;
-
- /* cache values then add keyframes using these values, as adding
- * keyframes while sampling will affect the outcome...
- */
- range= (int)( ceil(end->vec[1][0] - start->vec[1][0]) );
- sfra= (int)( floor(start->vec[1][0]) );
-
- if (range) {
- value_cache= MEM_callocN(sizeof(tempFrameValCache)*range, "IcuFrameValCache");
-
- /* sample values */
- for (n=0, fp=value_cache; n<range && fp; n++, fp++) {
- fp->frame= (float)(sfra + n);
- fp->val= evaluate_fcurve(fcu, fp->frame);
- }
-
- /* add keyframes with these */
- for (n=0, fp=value_cache; n<range && fp; n++, fp++) {
- insert_vert_fcurve(fcu, fp->frame, fp->val, 1);
- }
-
- /* free temp cache */
- MEM_freeN(value_cache);
-
- /* as we added keyframes, we need to compensate so that bezt is at the right place */
- bezt = fcu->bezt + i + range - 1;
- i += (range - 1);
- }
-
- /* bezt was selected, so it now marks the start of a whole new chain to search */
- start= bezt;
- end= NULL;
- }
- else {
- /* just set start keyframe */
- start= bezt;
- end= NULL;
- }
- }
- }
-
- /* recalculate channel's handles? */
- calchandles_fcurve(fcu);
- }
+ for (ale= anim_data.first; ale; ale= ale->next)
+ sample_fcurve((FCurve *)ale->key_data);
/* admin and redraws */
BLI_freelistN(&anim_data);