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:
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c6
-rw-r--r--source/blender/blenloader/intern/versioning_250.c80
-rw-r--r--source/blender/blenloader/intern/versioning_260.c96
-rw-r--r--source/blender/blenloader/intern/versioning_270.c79
-rw-r--r--source/blender/blenloader/intern/versioning_280.c21
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c32
6 files changed, 175 insertions, 139 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 49c3497f996..2ee66206878 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2419,7 +2419,7 @@ static void lib_link_seq_clipboard_pt_restore(ID *id, struct IDNameLib_Map *id_m
id->newid = restore_pointer_by_name(id_map, id->newid, USER_REAL);
}
}
-static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt)
+static bool lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt)
{
struct IDNameLib_Map *id_map = arg_pt;
@@ -2428,13 +2428,13 @@ static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt)
lib_link_seq_clipboard_pt_restore((ID *)seq->clip, id_map);
lib_link_seq_clipboard_pt_restore((ID *)seq->mask, id_map);
lib_link_seq_clipboard_pt_restore((ID *)seq->sound, id_map);
- return 1;
+ return true;
}
static void lib_link_clipboard_restore(struct IDNameLib_Map *id_map)
{
/* update IDs stored in sequencer clipboard */
- SEQ_seqbase_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, id_map);
+ SEQ_for_each_callback(&seqbase_clipboard, lib_link_seq_clipboard_cb, id_map);
}
static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
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;
}
}
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) {
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 1d46c0d5790..6492f0d1f69 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -425,6 +425,45 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id),
}
}
+static bool seq_update_proxy_cb(Sequence *seq, void *UNUSED(user_data))
+{
+ seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
+
+#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
+#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
+ if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+ seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
+ }
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
+ seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
+ }
+ }
+#undef SEQ_USE_PROXY_CUSTOM_DIR
+#undef SEQ_USE_PROXY_CUSTOM_FILE
+ return true;
+}
+
+static bool seq_update_effectdata_cb(Sequence *seq, void *UNUSED(user_data))
+{
+
+ if (seq->type != SEQ_TYPE_TEXT) {
+ return true;
+ }
+
+ if (seq->effectdata == NULL) {
+ struct SeqEffectHandle effect_handle = SEQ_effect_handle_get(seq);
+ effect_handle.init(seq);
+ }
+
+ TextVars *data = seq->effectdata;
+ if (data->color[3] == 0.0f) {
+ copy_v4_fl(data->color, 1.0f);
+ data->shadow_color[3] = 1.0f;
+ }
+ return true;
+}
+
/* NOLINTNEXTLINE: readability-function-size */
void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
@@ -908,8 +947,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Image *ima;
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
- Sequence *seq;
-
BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
srv = scene->r.views.first;
BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
@@ -918,23 +955,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
srv = scene->r.views.last;
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
- SEQ_ALL_BEGIN (scene->ed, seq) {
- seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
-
-#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
-#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
- if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
- if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
- seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
- }
- if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
- seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
- }
- }
-#undef SEQ_USE_PROXY_CUSTOM_DIR
-#undef SEQ_USE_PROXY_CUSTOM_FILE
+ if (scene->ed) {
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_update_proxy_cb, NULL);
}
- SEQ_ALL_END;
}
for (screen = bmain->screens.first; screen; screen = screen->id.next) {
@@ -1215,25 +1238,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
- Sequence *seq;
-
- SEQ_ALL_BEGIN (scene->ed, seq) {
- if (seq->type != SEQ_TYPE_TEXT) {
- continue;
- }
-
- if (seq->effectdata == NULL) {
- struct SeqEffectHandle effect_handle = SEQ_effect_handle_get(seq);
- effect_handle.init(seq);
- }
-
- TextVars *data = seq->effectdata;
- if (data->color[3] == 0.0f) {
- copy_v4_fl(data->color, 1.0f);
- data->shadow_color[3] = 1.0f;
- }
+ if (scene->ed) {
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_update_effectdata_cb, NULL);
}
- SEQ_ALL_END;
}
/* Adding "Properties" region to DopeSheet */
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 9d65488e8d4..f77d0361e51 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1772,6 +1772,16 @@ static void do_versions_seq_set_cache_defaults(Editing *ed)
ed->recycle_max_cost = 10.0f;
}
+static bool seq_update_flags_cb(Sequence *seq, void *UNUSED(user_data))
+{
+ seq->flag &= ~(SEQ_FLAG_UNUSED_6 | SEQ_FLAG_UNUSED_18 | SEQ_FLAG_UNUSED_19 | SEQ_FLAG_UNUSED_21);
+ if (seq->type == SEQ_TYPE_SPEED) {
+ SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
+ s->flags &= ~(SEQ_SPEED_UNUSED_1);
+ }
+ return true;
+}
+
/* NOLINTNEXTLINE: readability-function-size */
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
@@ -3447,16 +3457,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (scene->ed) {
- Sequence *seq;
- SEQ_ALL_BEGIN (scene->ed, seq) {
- seq->flag &= ~(SEQ_FLAG_UNUSED_6 | SEQ_FLAG_UNUSED_18 | SEQ_FLAG_UNUSED_19 |
- SEQ_FLAG_UNUSED_21);
- if (seq->type == SEQ_TYPE_SPEED) {
- SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
- s->flags &= ~(SEQ_SPEED_UNUSED_1);
- }
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_update_flags_cb, NULL);
}
}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 6ba27b6ee9e..62cc2aa3662 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -482,6 +482,22 @@ void blo_do_version_old_trackto_to_constraints(Object *ob)
ob->track = NULL;
}
+static bool seq_set_alpha_mode_cb(Sequence *seq, void *UNUSED(user_data))
+{
+ if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) {
+ seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
+ }
+ return true;
+}
+
+static bool seq_set_blend_mode_cb(Sequence *seq, void *UNUSED(user_data))
+{
+ if (seq->blend_mode == 0) {
+ seq->blend_opacity = 100.0f;
+ }
+ return true;
+}
+
/* NOLINTNEXTLINE: readability-function-size */
void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
{
@@ -1228,7 +1244,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 235) {
Tex *tex = bmain->textures.first;
Scene *sce = bmain->scenes.first;
- Sequence *seq;
Editing *ed;
while (tex) {
@@ -1240,12 +1255,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
while (sce) {
ed = sce->ed;
if (ed) {
- SEQ_ALL_BEGIN (sce->ed, seq) {
- if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) {
- seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
- }
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&sce->ed->seqbase, seq_set_alpha_mode_cb, NULL);
}
sce = sce->id.next;
@@ -2404,15 +2414,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 245, 14)) {
Scene *sce;
- Sequence *seq;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
- SEQ_ALL_BEGIN (sce->ed, seq) {
- if (seq->blend_mode == 0) {
- seq->blend_opacity = 100.0f;
- }
+ if (sce->ed) {
+ SEQ_for_each_callback(&sce->ed->seqbase, seq_set_blend_mode_cb, NULL);
}
- SEQ_ALL_END;
}
}