Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-06-30 19:26:14 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-06-30 19:33:34 +0300
commit66de653784ab06ccea46413de6b2f086b5a69d30 (patch)
tree28b7f684198cd9f80d0b889979dafacaa9412228 /source/blender/blenloader
parent79fe27b976dde09b83e801a0e80f40010617c256 (diff)
Fix incorrect strip position if pitch was animated
Commit 302b04a5a3fc introduced new retiming system, that unified sound pitch animation with strip speed control. Because sound playback is handled in different way, this did not work as expected and old files were broken. In addition animation was not copied to new property. Revert length position and offset handling for sound strips so their position does not change and remap fcurves to new `speed_factor` property.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_300.c63
1 files changed, 44 insertions, 19 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 35b1367ca1e..f6cc413d220 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -595,6 +595,39 @@ static bNodeTree *add_realize_node_tree(Main *bmain)
return node_tree;
}
+static void seq_speed_factor_fix_rna_path(Sequence *seq, ListBase *fcurves)
+{
+ char name_esc[(sizeof(seq->name) - 2) * 2];
+ BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc));
+ char *path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].pitch", name_esc);
+ FCurve *fcu = BKE_fcurve_find(&fcurves, path, 0);
+ if (fcu != NULL) {
+ MEM_freeN(fcu->rna_path);
+ fcu->rna_path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].speed_factor", name_esc);
+ }
+ MEM_freeN(path);
+}
+
+static bool seq_speed_factor_set(Sequence *seq, void *user_data)
+{
+ const Scene *scene = user_data;
+ if (seq->type == SEQ_TYPE_SOUND_RAM) {
+ /* Move `pitch` animation to `speed_factor` */
+ if (scene->adt && scene->adt->action) {
+ seq_speed_factor_fix_rna_path(seq, &scene->adt->action->curves);
+ }
+ if (scene->adt && !BLI_listbase_is_empty(&scene->adt->drivers)) {
+ seq_speed_factor_fix_rna_path(seq, &scene->adt->drivers);
+ }
+
+ seq->speed_factor = seq->pitch;
+ }
+ else {
+ seq->speed_factor = 1.0f;
+ }
+ return true;
+}
+
void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
{
if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) {
@@ -819,6 +852,17 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
}
}
}
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 303, 5)) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ Editing *ed = SEQ_editing_get(scene);
+ if (ed == NULL) {
+ continue;
+ }
+ SEQ_for_each_callback(&ed->seqbase, seq_speed_factor_set, scene);
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -1235,17 +1279,6 @@ static bool version_merge_still_offsets(Sequence *seq, void *UNUSED(user_data))
return true;
}
-static bool seq_speed_factor_set(Sequence *seq, void *UNUSED(user_data))
-{
- if (seq->type == SEQ_TYPE_SOUND_RAM) {
- seq->speed_factor = seq->pitch;
- }
- else {
- seq->speed_factor = 1.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.
@@ -3223,14 +3256,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
-
- LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
- Editing *ed = SEQ_editing_get(scene);
- if (ed == NULL) {
- continue;
- }
- SEQ_for_each_callback(&ed->seqbase, seq_speed_factor_set, NULL);
- }
}
/**
* Versioning code until next subversion bump goes here.