Fix T99133:animating multiply factor on video strips crashes blender
Crash caused by `effect_seq->len` being 0, so frame map was not built. Get length in timeline using handle positions.
This commit is contained in:
parent
92d7f9ac56
commit
547efb6b1e
Notes:
blender-bot
2023-02-13 22:20:49 +01:00
Referenced by issue #99133, Regression: VSE Speed control - animating multiply factor on video strips crashe blender
|
@ -2600,7 +2600,10 @@ static FCurve *seq_effect_speed_speed_factor_curve_get(Scene *scene, Sequence *s
|
|||
|
||||
void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq)
|
||||
{
|
||||
if ((seq->seq1 == NULL) || (seq->len < 1)) {
|
||||
const int effect_strip_length = SEQ_time_right_handle_frame_get(scene, seq) -
|
||||
SEQ_time_left_handle_frame_get(scene, seq);
|
||||
|
||||
if ((seq->seq1 == NULL) || (effect_strip_length < 1)) {
|
||||
return; /* Make coverity happy and check for (CID 598) input strip... */
|
||||
}
|
||||
|
||||
|
@ -2614,15 +2617,13 @@ 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(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(scene, seq) + frame_index);
|
||||
CLAMP(target_frame, 0, seq->seq1->len);
|
||||
CLAMP(target_frame, 0, SEQ_time_strip_length_get(seq->seq1));
|
||||
v->frameMap[frame_index] = target_frame;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue