Refactor: make yet more fcurve evaluation functions take const fcurves

This follows on after #121788.

Pull Request: https://projects.blender.org/blender/blender/pulls/121882
This commit is contained in:
Nathan Vegdahl
2024-05-17 15:56:57 +02:00
committed by Nathan Vegdahl
parent 0a8a11cc9a
commit 98b0bfa9e7
9 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ SingleKeyingResult insert_vert_fcurve(FCurve *fcu,
* \param r_samples: Is expected to be an array large enough to hold `sample_count`.
*/
void sample_fcurve_segment(
FCurve *fcu, float start_frame, float sample_rate, float *samples, int sample_count);
const FCurve *fcu, float start_frame, float sample_rate, float *samples, int sample_count);
enum class BakeCurveRemove {
NONE = 0,
+2 -2
View File
@@ -288,7 +288,7 @@ void initialize_bezt(BezTriple *beztr,
* that, since that's not how the "only insert needed" feature is supposed to
* work.
*/
static bool new_key_needed(FCurve &fcu, const float frame, const float value)
static bool new_key_needed(const FCurve &fcu, const float frame, const float value)
{
if (fcu.totvert == 0) {
return true;
@@ -376,7 +376,7 @@ SingleKeyingResult insert_vert_fcurve(FCurve *fcu,
return SingleKeyingResult::SUCCESS;
}
void sample_fcurve_segment(FCurve *fcu,
void sample_fcurve_segment(const FCurve *fcu,
const float start_frame,
const float sample_rate,
float *samples,
+1 -1
View File
@@ -599,7 +599,7 @@ void BKE_fcurve_correct_bezpart(const float v1[2], float v2[2], float v3[2], con
/* evaluate fcurve */
float evaluate_fcurve(const FCurve *fcu, float evaltime);
float evaluate_fcurve_only_curve(FCurve *fcu, float evaltime);
float evaluate_fcurve_only_curve(const FCurve *fcu, float evaltime);
float evaluate_fcurve_driver(PathResolvedRNA *anim_rna,
FCurve *fcu,
ChannelDriver *driver_orig,
+1 -1
View File
@@ -2449,7 +2449,7 @@ float evaluate_fcurve(const FCurve *fcu, float evaltime)
return evaluate_fcurve_ex(fcu, evaltime, 0.0);
}
float evaluate_fcurve_only_curve(FCurve *fcu, float evaltime)
float evaluate_fcurve_only_curve(const FCurve *fcu, float evaltime)
{
/* Can be used to evaluate the (key-framed) f-curve only.
* Also works for driver-f-curves when the driver itself is not relevant.
@@ -71,7 +71,7 @@ static libmv_Tracks *libmv_tracks_new(MovieClip *clip, ListBase *tracksbase, int
track = static_cast<MovieTrackingTrack *>(tracksbase->first);
while (track) {
FCurve *weight_fcurve = id_data_find_fcurve(
const FCurve *weight_fcurve = id_data_find_fcurve(
&clip->id, track, &RNA_MovieTrackingTrack, "weight", 0, nullptr);
for (int a = 0; a < track->markersnr; a++) {
@@ -137,7 +137,7 @@ static FCurve *retrieve_track_weight_animation(MovieClip *clip, MovieTrackingTra
return id_data_find_fcurve(&clip->id, track, &RNA_MovieTrackingTrack, "weight_stab", 0, nullptr);
}
static float fetch_from_fcurve(FCurve *animationCurve,
static float fetch_from_fcurve(const FCurve *animationCurve,
int framenr,
StabContext *ctx,
float default_value)
@@ -332,7 +332,7 @@ short ANIM_get_normalization_flags(SpaceLink *space_link)
}
static void fcurve_scene_coord_range_get(Scene *scene,
FCurve *fcu,
const FCurve *fcu,
float *r_min_coord,
float *r_max_coord)
{
@@ -331,7 +331,7 @@ static bool pose_frame_range_from_object_get(tPoseSlideOp *pso,
/**
* Helper for apply() - perform sliding for some value.
*/
static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, Object *ob, float *val)
static void pose_slide_apply_val(tPoseSlideOp *pso, const FCurve *fcu, Object *ob, float *val)
{
float prev_frame, next_frame;
float prev_weight, next_weight;
@@ -689,8 +689,11 @@ static short ok_bezier_always_ok(KeyframeEditData * /*ked*/, BezTriple * /*bezt*
#define ABOVE 1
#define INSIDE 0
#define BELOW -1
static int rectf_curve_zone_y(
FCurve *fcu, const rctf *rectf, const float offset, const float unit_scale, const float eval_x)
static int rectf_curve_zone_y(const FCurve *fcu,
const rctf *rectf,
const float offset,
const float unit_scale,
const float eval_x)
{
const float fcurve_y = (evaluate_fcurve(fcu, eval_x) + offset) * unit_scale;
return fcurve_y < rectf->ymin ? BELOW : fcurve_y <= rectf->ymax ? INSIDE : ABOVE;