Fix T41266: Copy and paste operation on f-curves do not respect keyframe tangent handles...
Added an extra option to `insert_bezt_fcurve()`, to allow full override of existing keyframes when pasting (in this case, we do not want to inherit handles from existing curve!).
This commit is contained in:
parent
63b981bf9b
commit
6891f1c9e0
Notes:
blender-bot
2023-02-14 10:16:34 +01:00
Referenced by issue #41630, Edge Split Modifier don't work anymore when a Array Modifier is after the Edge Split Modifier added Referenced by issue #41611, Skin modifier - Slow process with deactivated deform modifiers Referenced by issue #41266, Copy and paste operation on f-curves do not respect keyframe tangent handles...
|
@ -732,9 +732,9 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
|
|||
bezt->vec[2][0] += offset;
|
||||
|
||||
/* insert the keyframe
|
||||
* NOTE: no special flags here for now
|
||||
* NOTE: we do not want to inherit handles from existing keyframes in this case!
|
||||
*/
|
||||
insert_bezt_fcurve(fcu, bezt, 0);
|
||||
insert_bezt_fcurve(fcu, bezt, INSERTKEY_OVERWRITE_FULL);
|
||||
|
||||
/* un-apply offset from src beztriple after copying */
|
||||
bezt->vec[0][0] -= offset;
|
||||
|
|
|
@ -310,20 +310,25 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
|
|||
if (replace) {
|
||||
/* sanity check: 'i' may in rare cases exceed arraylen */
|
||||
if ((i >= 0) && (i < fcu->totvert)) {
|
||||
/* just change the values when replacing, so as to not overwrite handles */
|
||||
BezTriple *dst = (fcu->bezt + i);
|
||||
float dy = bezt->vec[1][1] - dst->vec[1][1];
|
||||
|
||||
/* just apply delta value change to the handle values */
|
||||
dst->vec[0][1] += dy;
|
||||
dst->vec[1][1] += dy;
|
||||
dst->vec[2][1] += dy;
|
||||
|
||||
dst->f1 = bezt->f1;
|
||||
dst->f2 = bezt->f2;
|
||||
dst->f3 = bezt->f3;
|
||||
|
||||
/* TODO: perform some other operations? */
|
||||
if (flag & INSERTKEY_OVERWRITE_FULL) {
|
||||
fcu->bezt[i] = *bezt;
|
||||
}
|
||||
else {
|
||||
/* just change the values when replacing, so as to not overwrite handles */
|
||||
BezTriple *dst = (fcu->bezt + i);
|
||||
float dy = bezt->vec[1][1] - dst->vec[1][1];
|
||||
|
||||
/* just apply delta value change to the handle values */
|
||||
dst->vec[0][1] += dy;
|
||||
dst->vec[1][1] += dy;
|
||||
dst->vec[2][1] += dy;
|
||||
|
||||
dst->f1 = bezt->f1;
|
||||
dst->f2 = bezt->f2;
|
||||
dst->f3 = bezt->f3;
|
||||
|
||||
/* TODO: perform some other operations? */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* keyframing modes allow to not replace keyframe */
|
||||
|
|
|
@ -793,6 +793,9 @@ typedef enum eInsertKeyFlags {
|
|||
INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
|
||||
INSERTKEY_XYZ2RGB = (1<<5), /* transform F-Curves should have XYZ->RGB color mode */
|
||||
INSERTKEY_NO_USERPREF = (1 << 6), /* ignore user-prefs (needed for predictable API use) */
|
||||
/* Allow to make a full copy of new key into existing one, if any, instead of 'reusing' existing handles.
|
||||
* Used by copy/paste code. */
|
||||
INSERTKEY_OVERWRITE_FULL = (1<<7),
|
||||
} eInsertKeyFlags;
|
||||
|
||||
/* ************************************************ */
|
||||
|
|
Loading…
Reference in New Issue