Fix: allow curve of driver to be evaluated individually

This is necessary when adding a new keyframe to a fcurve
that also has a driver.

Reviewers: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D4278
This commit is contained in:
Jacques Lucke 2019-01-31 12:17:43 +01:00
parent 83f8f44791
commit f4c0dacde7
3 changed files with 10 additions and 1 deletions

View File

@ -297,6 +297,7 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]);
/* evaluate fcurve */
float evaluate_fcurve(struct FCurve *fcu, float evaltime);
float evaluate_fcurve_only_curve(struct FCurve *fcu, float evaltime);
float evaluate_fcurve_driver(struct PathResolvedRNA *anim_rna, struct FCurve *fcu,
struct ChannelDriver *driver_orig, float evaltime);
/* evaluate fcurve and store value */

View File

@ -2799,6 +2799,14 @@ float evaluate_fcurve(FCurve *fcu, float evaltime)
return evaluate_fcurve_ex(fcu, evaltime, 0.0);
}
float evaluate_fcurve_only_curve(FCurve *fcu, float evaltime)
{
/* Can be used to evaluate the (keyframed) fcurve only.
* Also works for driver-fcurves when the driver itself is not relevant.
* E.g. when inserting a keyframe in a driver fcurve. */
return evaluate_fcurve_ex(fcu, evaltime, 0.0);
}
float evaluate_fcurve_driver(PathResolvedRNA *anim_rna, FCurve *fcu, ChannelDriver *driver_orig, float evaltime)
{
BLI_assert(fcu->driver != NULL);

View File

@ -616,7 +616,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
else if (adt)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
const float curval = evaluate_fcurve(fcu, cfra);
const float curval = evaluate_fcurve_only_curve(fcu, cfra);
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
}