diff options
Diffstat (limited to 'source/blender/blenloader/intern/versioning_260.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 96 |
1 files changed, 52 insertions, 44 deletions
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 7c644fa3b55..b71dd5a27bb 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -663,6 +663,53 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro } } +static bool seq_colorbalance_update_cb(Sequence *seq, void *UNUSED(user_data)) +{ + Strip *strip = seq->strip; + + if (strip && strip->color_balance) { + SequenceModifierData *smd; + ColorBalanceModifierData *cbmd; + + smd = SEQ_modifier_new(seq, NULL, seqModifierType_ColorBalance); + cbmd = (ColorBalanceModifierData *)smd; + + cbmd->color_balance = *strip->color_balance; + + /* multiplication with color balance used is handled differently, + * so we need to move multiplication to modifier so files would be + * compatible + */ + cbmd->color_multiply = seq->mul; + seq->mul = 1.0f; + + MEM_freeN(strip->color_balance); + strip->color_balance = NULL; + } + return true; +} + +static bool seq_set_alpha_mode_cb(Sequence *seq, void *UNUSED(user_data)) +{ + enum { SEQ_MAKE_PREMUL = (1 << 6) }; + if (seq->flag & SEQ_MAKE_PREMUL) { + seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + } + else { + SEQ_alpha_mode_from_file_extension(seq); + } + return true; +} + +static bool seq_set_wipe_angle_cb(Sequence *seq, void *UNUSED(user_data)) +{ + if (seq->type == SEQ_TYPE_WIPE) { + WipeVars *wv = seq->effectdata; + wv->angle = DEG2RADF(wv->angle); + } + return true; +} + /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) { @@ -1492,32 +1539,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (scene = bmain->scenes.first; scene; scene = scene->id.next) { if (scene->ed) { - Sequence *seq; - - SEQ_ALL_BEGIN (scene->ed, seq) { - Strip *strip = seq->strip; - - if (strip && strip->color_balance) { - SequenceModifierData *smd; - ColorBalanceModifierData *cbmd; - - smd = SEQ_modifier_new(seq, NULL, seqModifierType_ColorBalance); - cbmd = (ColorBalanceModifierData *)smd; - - cbmd->color_balance = *strip->color_balance; - - /* multiplication with color balance used is handled differently, - * so we need to move multiplication to modifier so files would be - * compatible - */ - cbmd->color_multiply = seq->mul; - seq->mul = 1.0f; - - MEM_freeN(strip->color_balance); - strip->color_balance = NULL; - } - } - SEQ_ALL_END; + SEQ_for_each_callback(&scene->ed->seqbase, seq_colorbalance_update_cb, NULL); } } } @@ -1807,18 +1829,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) Tex *tex; for (scene = bmain->scenes.first; scene; scene = scene->id.next) { - Sequence *seq; - - SEQ_ALL_BEGIN (scene->ed, seq) { - enum { SEQ_MAKE_PREMUL = (1 << 6) }; - if (seq->flag & SEQ_MAKE_PREMUL) { - seq->alpha_mode = SEQ_ALPHA_STRAIGHT; - } - else { - SEQ_alpha_mode_from_file_extension(seq); - } + if (scene->ed) { + SEQ_for_each_callback(&scene->ed->seqbase, seq_set_alpha_mode_cb, NULL); } - SEQ_ALL_END; if (scene->r.bake_samples == 0) { scene->r.bake_samples = 256; @@ -2450,14 +2463,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) } for (scene = bmain->scenes.first; scene; scene = scene->id.next) { - Sequence *seq; - SEQ_ALL_BEGIN (scene->ed, seq) { - if (seq->type == SEQ_TYPE_WIPE) { - WipeVars *wv = seq->effectdata; - wv->angle = DEG2RADF(wv->angle); - } + if (scene->ed) { + SEQ_for_each_callback(&scene->ed->seqbase, seq_set_wipe_angle_cb, NULL); } - SEQ_ALL_END; } FOREACH_NODETREE_BEGIN (bmain, ntree, id) { |