diff options
Diffstat (limited to 'source/blender/sequencer/intern/effects.c')
-rw-r--r-- | source/blender/sequencer/intern/effects.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index 0e5e56908b0..368c00534be 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -2475,8 +2475,8 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl * frame is static after end of strip). This is how most strips behave. This way transition * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */ timeline_frame = clamp_i(timeline_frame, - SEQ_time_left_handle_frame_get(seq), - SEQ_time_right_handle_frame_get(seq) - 1); + SEQ_time_left_handle_frame_get(context->scene, seq), + SEQ_time_right_handle_frame_get(context->scene, seq) - 1); if (seq->machine > 1) { i = seq_render_give_ibuf_seqbase( @@ -2583,13 +2583,14 @@ static int early_out_speed(Sequence *UNUSED(seq), float UNUSED(fac)) * useful to use speed effect on these strips because they can be animated. This can be done by * using their length as is on timeline as content length. See T82698. */ -static int seq_effect_speed_get_strip_content_length(const Sequence *seq) +static int seq_effect_speed_get_strip_content_length(Scene *scene, const Sequence *seq) { if ((seq->type & SEQ_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(seq->type) == 0) { - return SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq); + return SEQ_time_right_handle_frame_get(scene, seq) - + SEQ_time_left_handle_frame_get(scene, seq); } - return seq->len; + return SEQ_time_strip_length_get(scene, seq); } static FCurve *seq_effect_speed_speed_factor_curve_get(Scene *scene, Sequence *seq) @@ -2613,14 +2614,14 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq) MEM_freeN(v->frameMap); } - const int effect_strip_length = SEQ_time_right_handle_frame_get(seq) - - SEQ_time_left_handle_frame_get(seq); + const int effect_strip_length = SEQ_time_right_handle_frame_get(scene, seq) - + SEQ_time_left_handle_frame_get(scene, seq); v->frameMap = MEM_mallocN(sizeof(float) * effect_strip_length, __func__); v->frameMap[0] = 0.0f; float target_frame = 0; for (int frame_index = 1; frame_index < effect_strip_length; frame_index++) { - target_frame += evaluate_fcurve(fcu, SEQ_time_left_handle_frame_get(seq) + frame_index); + target_frame += evaluate_fcurve(fcu, SEQ_time_left_handle_frame_get(scene, seq) + frame_index); CLAMP(target_frame, 0, seq->seq1->len); v->frameMap[frame_index] = target_frame; } @@ -2646,7 +2647,7 @@ float seq_speed_effect_target_frame_get(Scene *scene, } SEQ_effect_handle_get(seq_speed); /* Ensure, that data are initialized. */ - int frame_index = seq_give_frame_index(seq_speed, timeline_frame); + int frame_index = seq_give_frame_index(scene, seq_speed, timeline_frame); SpeedControlVars *s = (SpeedControlVars *)seq_speed->effectdata; const Sequence *source = seq_speed->seq1; @@ -2654,10 +2655,11 @@ float seq_speed_effect_target_frame_get(Scene *scene, switch (s->speed_control_type) { case SEQ_SPEED_STRETCH: { /* Only right handle controls effect speed! */ - const float target_content_length = seq_effect_speed_get_strip_content_length(source) - + const float target_content_length = seq_effect_speed_get_strip_content_length(scene, + source) - source->startofs; - const float speed_effetct_length = SEQ_time_right_handle_frame_get(seq_speed) - - SEQ_time_left_handle_frame_get(seq_speed); + const float speed_effetct_length = SEQ_time_right_handle_frame_get(scene, seq_speed) - + SEQ_time_left_handle_frame_get(scene, seq_speed); const float ratio = frame_index / speed_effetct_length; target_frame = target_content_length * ratio; break; @@ -2674,7 +2676,7 @@ float seq_speed_effect_target_frame_get(Scene *scene, break; } case SEQ_SPEED_LENGTH: - target_frame = seq_effect_speed_get_strip_content_length(source) * + target_frame = seq_effect_speed_get_strip_content_length(scene, source) * (s->speed_fader_length / 100.0f); break; case SEQ_SPEED_FRAME_NUMBER: @@ -2682,7 +2684,7 @@ float seq_speed_effect_target_frame_get(Scene *scene, break; } - CLAMP(target_frame, 0, seq_effect_speed_get_strip_content_length(source)); + CLAMP(target_frame, 0, seq_effect_speed_get_strip_content_length(scene, source)); target_frame += seq_speed->start; /* No interpolation. */ @@ -3507,15 +3509,21 @@ static int early_out_mul_input1(Sequence *UNUSED(seq), float fac) return EARLY_DO_EFFECT; } -static void get_default_fac_noop(Sequence *UNUSED(seq), float UNUSED(timeline_frame), float *fac) +static void get_default_fac_noop(const Scene *UNUSED(scene), + Sequence *UNUSED(seq), + float UNUSED(timeline_frame), + float *fac) { *fac = 1.0f; } -static void get_default_fac_fade(Sequence *seq, float timeline_frame, float *fac) +static void get_default_fac_fade(const Scene *scene, + Sequence *seq, + float timeline_frame, + float *fac) { - *fac = (float)(timeline_frame - SEQ_time_left_handle_frame_get(seq)); - *fac /= seq->len; + *fac = (float)(timeline_frame - SEQ_time_left_handle_frame_get(scene, seq)); + *fac /= SEQ_time_strip_length_get(scene, seq); } static struct ImBuf *init_execution(const SeqRenderData *context, |