Better fix for sequencer crash when text strip doesn't have effect data.
authorSybren A. Stüvel <sybren@stuvel.eu>
Wed, 5 Jul 2017 20:18:36 +0000 (22:18 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Wed, 5 Jul 2017 20:18:41 +0000 (22:18 +0200)
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.

d2f748a222ad19f 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.

source/blender/blenloader/intern/versioning_270.c

index 87ccfedcff3830ed84daf205fad8d5e6a4d7c694..94d335870caa392ede8bfa6f57db2f7c946ce45e 100644 (file)
@@ -1236,12 +1236,19 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 
                        SEQ_BEGIN (scene->ed, seq)
                        {
 
                        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
                                }
                        }
                        SEQ_END