diff options
Diffstat (limited to 'source/blender/blenloader/intern/versioning_250.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_250.c | 80 |
1 files changed, 47 insertions, 33 deletions
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 436645c2241..54e673b51eb 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -638,6 +638,46 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock) } } +static bool seq_sound_proxy_update_cb(Sequence *seq, void *user_data) +{ + Main *bmain = (Main *)user_data; + if (seq->type == SEQ_TYPE_SOUND_HD) { + char str[FILE_MAX]; + BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_abs(str, BKE_main_blendfile_path(bmain)); + seq->sound = BKE_sound_new_file(bmain, str); + } +#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) +#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) + /* don't know, if anybody used that this way, but just in case, upgrade to new way... */ + if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { + BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); + } +#undef SEQ_USE_PROXY_CUSTOM_DIR +#undef SEQ_USE_PROXY_CUSTOM_FILE + return true; +} + +static bool seq_set_volume_cb(Sequence *seq, void *UNUSED(user_data)) +{ + seq->volume = 1.0f; + return true; +} + +static bool seq_set_sat_cb(Sequence *seq, void *UNUSED(user_data)) +{ + if (seq->sat == 0.0f) { + seq->sat = 1.0f; + } + return true; +} + +static bool seq_set_pitch_cb(Sequence *seq, void *UNUSED(user_data)) +{ + seq->pitch = 1.0f; + return true; +} + /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) { @@ -660,7 +700,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) #endif bSound *sound; - Sequence *seq; for (sound = bmain->sounds.first; sound; sound = sound->id.next) { if (sound->newpackedfile) { @@ -671,23 +710,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (scene = bmain->scenes.first; scene; scene = scene->id.next) { if (scene->ed && scene->ed->seqbasep) { - SEQ_ALL_BEGIN (scene->ed, seq) { - if (seq->type == SEQ_TYPE_SOUND_HD) { - char str[FILE_MAX]; - BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(str, BKE_main_blendfile_path(bmain)); - seq->sound = BKE_sound_new_file(bmain, str); - } -#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) -#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) - /* don't know, if anybody used that this way, but just in case, upgrade to new way... */ - if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { - BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); - } -#undef SEQ_USE_PROXY_CUSTOM_DIR -#undef SEQ_USE_PROXY_CUSTOM_FILE - } - SEQ_ALL_END; + SEQ_for_each_callback(&scene->ed->seqbase, seq_sound_proxy_update_cb, bmain); } } @@ -1391,7 +1414,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (!MAIN_VERSION_ATLEAST(bmain, 250, 17)) { Scene *sce; - Sequence *seq; /* initialize to sane default so toggling on border shows something */ for (sce = bmain->scenes.first; sce; sce = sce->id.next) { @@ -1406,11 +1428,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) { sce->r.ffcodecdata.audio_codec = 0x0; /* `CODEC_ID_NONE` */ } - - SEQ_ALL_BEGIN (sce->ed, seq) { - seq->volume = 1.0f; + if (sce->ed) { + SEQ_for_each_callback(&sce->ed->seqbase, seq_set_volume_cb, NULL); } - SEQ_ALL_END; } /* particle brush strength factor was changed from int to float */ @@ -1678,13 +1698,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } for (scene = bmain->scenes.first; scene; scene = scene->id.next) { - Sequence *seq; - SEQ_ALL_BEGIN (scene->ed, seq) { - if (seq->sat == 0.0f) { - seq->sat = 1.0f; - } + if (scene->ed) { + SEQ_for_each_callback(&scene->ed->seqbase, seq_set_sat_cb, NULL); } - SEQ_ALL_END; } /* GSOC 2010 Sculpt - New settings for Brush */ @@ -2159,15 +2175,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (!MAIN_VERSION_ATLEAST(bmain, 259, 1)) { { Scene *scene; - Sequence *seq; for (scene = bmain->scenes.first; scene; scene = scene->id.next) { scene->r.ffcodecdata.audio_channels = 2; scene->audio.volume = 1.0f; - SEQ_ALL_BEGIN (scene->ed, seq) { - seq->pitch = 1.0f; + if (scene->ed) { + SEQ_for_each_callback(&scene->ed->seqbase, seq_set_pitch_cb, NULL); } - SEQ_ALL_END; } } |