Fix #107289: Sound strips are invisible and overlap

In some cases strips may end up with speed factor of 0 which causes
offsets and position to be invalid. The exact cause is unknown, but
most likely caused by `do_versions_sequencer_init_retiming_tool_data()`.

This could possibly happen if 3.6 file is saved with 3.5 version and
then opened again with 3.6 version.

To fix strips, retiming data is removed, start offset reset and speed
factor is set to 1. Previous versioning code is fixed, so speed factor
is never set to 0.

Pull Request: https://projects.blender.org/blender/blender/pulls/107798
This commit is contained in:
Richard Antalik
2023-05-09 22:14:17 +02:00
committed by Richard Antalik
parent 3a0d17ceea
commit c9be925f7d

View File

@@ -704,7 +704,7 @@ static bool do_versions_sequencer_init_retiming_tool_data(Sequence *seq, void *u
SeqRetimingHandle *handle = &seq->retiming_handles[seq->retiming_handle_num - 1];
handle->strip_frame_index = round_fl_to_int(content_length / seq->speed_factor);
seq->speed_factor = 0.0f;
seq->speed_factor = 1.0f;
return true;
}
@@ -1786,6 +1786,18 @@ static bool version_set_seq_single_frame_content(Sequence *seq, void * /*user_da
return true;
}
static bool version_seq_fix_broken_sound_strips(Sequence *seq, void * /*user_data*/)
{
if (seq->type != SEQ_TYPE_SOUND_RAM || seq->speed_factor != 0.0f) {
return true;
}
seq->speed_factor = 1.0f;
SEQ_retiming_data_clear(seq);
seq->startofs = 0.0f;
return true;
}
/* Those `version_liboverride_rnacollections_*` functions mimic the old, pre-3.0 code to find
* anchor and source items in the given list of modifiers, constraints etc., using only the
* `subitem_local` data of the override property operation.
@@ -4347,5 +4359,13 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
*/
{
/* Keep this block, even when empty. */
/* Fix sound strips with speed factor set to 0. See #107289. */
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
Editing *ed = SEQ_editing_get(scene);
if (ed != nullptr) {
SEQ_for_each_callback(&ed->seqbase, version_seq_fix_broken_sound_strips, nullptr);
}
}
}
}