Fix T70281: Changing Default interpolation also changes curve of new drivers

Having a constant FCurve doesn't make sense for drivers; either linear
or Bezier should be used. Since the code is already creating a Bezier
curve, I just added the flag to not look at the user preferences in this
case.

Reviewed by: angavrilov

Differential Revision: https://developer.blender.org/D5921
This commit is contained in:
Sybren A. Stüvel 2019-09-27 17:02:02 +02:00
parent 2746fbc935
commit 3370af2dc1
Notes: blender-bot 2023-02-14 03:13:26 +01:00
Referenced by issue #70281, Changing Default interpolation also changes curve of new drivers
1 changed files with 4 additions and 8 deletions

View File

@ -139,14 +139,10 @@ struct FCurve *alloc_driver_fcurve(const char rna_path[],
* - These are configured to 0,0 and 1,1 to give a 1-1 mapping
* which can be easily tweaked from there.
*/
insert_vert_fcurve(fcu, 0.0f, 0.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST);
insert_vert_fcurve(fcu, 1.0f, 1.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST);
/* configure this curve to extrapolate */
for (i = 0, bezt = fcu->bezt; (i < fcu->totvert) && bezt; i++, bezt++) {
bezt->h1 = bezt->h2 = HD_VECT;
}
insert_vert_fcurve(
fcu, 0.0f, 0.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST | INSERTKEY_NO_USERPREF);
insert_vert_fcurve(
fcu, 1.0f, 1.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST | INSERTKEY_NO_USERPREF);
fcu->extend = FCURVE_EXTRAPOLATE_LINEAR;
calchandles_fcurve(fcu);
}