Better fix for sequencer crash when text strip doesn't have effect data.

This situation happens when a file with a text effect sequencer strip is
loaded in Blender < 2.76 and saved. This destroys the effect data, causing
a crash in Blender ≥ 2.76.

d2f748a222 prevented the crash when opening such a file, but accessing
the strip still caused a crash. This commit fixes that by actually
initialising the invalid strip. Of course this still causes data loss, but
that already happened by opening & overwriting the file in Blender < 2.76.
This commit is contained in:
Sybren A. Stüvel
2017-07-05 22:18:36 +02:00
parent 31f8ca5034
commit aea4456101

View File

@@ -1236,12 +1236,19 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
SEQ_BEGIN (scene->ed, seq)
{
if (seq->type == SEQ_TYPE_TEXT) {
TextVars *data = seq->effectdata;
if (data != NULL && data->color[3] == 0.0f) {
copy_v4_fl(data->color, 1.0f);
data->shadow_color[3] = 1.0f;
}
if (seq->type != SEQ_TYPE_TEXT) {
continue;
}
if (seq->effectdata == NULL) {
struct SeqEffectHandle effect_handle = BKE_sequence_get_effect(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;
}
}
SEQ_END