[Bf-blender-cvs] [f4c0dacde7b] master: Fix: allow curve of driver to be evaluated individually
Jacques Lucke
noreply at git.blender.org
Thu Jan 31 12:23:36 CET 2019
Commit: f4c0dacde7bfc9efea9d0cf990325109fa2f4bb0
Author: Jacques Lucke
Date: Thu Jan 31 12:17:43 2019 +0100
Branches: master
https://developer.blender.org/rBf4c0dacde7bfc9efea9d0cf990325109fa2f4bb0
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
===================================================================
M source/blender/blenkernel/BKE_fcurve.h
M source/blender/blenkernel/intern/fcurve.c
M source/blender/editors/space_graph/graph_edit.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 23d812c72ce..c9ff37622f8 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -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 */
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 8ac3c840680..fa8fd9247bb 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -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);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 80f0d03b8ca..735b25393c3 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -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);
}
More information about the Bf-blender-cvs
mailing list