Fix #125194: Sequence.frame_duration returns incorrect value

`Sequence.frame_duration` returned number of frames in movie, but did
not consider "playback rate" factor (adapting to scene framerate), nor
user level retiming.

Pull Request: https://projects.blender.org/blender/blender/pulls/125243
This commit is contained in:
Andrew Wason
2024-07-29 22:45:52 +02:00
committed by Richard Antalik
parent 4b6ed00b3e
commit 42234e5a8e

View File

@@ -573,6 +573,14 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr)
return SEQ_time_right_handle_frame_get(scene, seq) - SEQ_time_left_handle_frame_get(scene, seq);
}
static int rna_Sequence_frame_duration_get(PointerRNA *ptr)
{
Sequence *seq = static_cast<Sequence *>(ptr->data);
Scene *scene = reinterpret_cast<Scene *>(ptr->owner_id);
return SEQ_time_strip_length_get(scene, seq);
}
static int rna_Sequence_frame_editable(const PointerRNA *ptr, const char ** /*r_info*/)
{
Sequence *seq = (Sequence *)ptr->data;
@@ -2176,7 +2184,7 @@ static void rna_def_sequence(BlenderRNA *brna)
prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update");
prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, nullptr, "len");
RNA_def_property_int_funcs(prop, "rna_Sequence_frame_duration_get", nullptr, nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_ui_text(