Fix sequencer view in video editing layout containing hidden preview region
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 25 Mar 2016 23:03:43 +0000 (00:03 +0100)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 25 Mar 2016 23:09:34 +0000 (00:09 +0100)
Steps to reproduce were:
* Open default video editing layout
* Drag down or click '+' icon in upper right corner of sequencer view
* A preview region appears, even though the view type is not set to sequencer-preview split mode

Another bug that has been there since ages :/ Reported by @Blendify via IRC, thanks!

source/blender/blenloader/intern/versioning_270.c

index def1eab0eaf41d0c0f345a6bbc72abd6fa6c9f15..049a8b65dabc0725b9c13d1226b1c5a22b6eb685 100644 (file)
@@ -1067,5 +1067,28 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                                }
                        }
                }
+
+               /* Bug: Was possible to add preview region to sequencer view by using AZones.
+                * Caused by redundant preview region stored into startup.blend */
+               for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
+                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+                                       if (sl->spacetype == SPACE_SEQ) {
+                                               SpaceSeq *sseq = (SpaceSeq *)sl;
+                                               if (sseq->view == SEQ_VIEW_SEQUENCE) {
+                                                       ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+                                                       for (ARegion *ar = lb->first; ar; ar = ar->next) {
+                                                               /* remove preview region for sequencer-only view! */
+                                                               if (ar->regiontype == RGN_TYPE_PREVIEW) {
+                                                                       BKE_area_region_free(NULL, ar);
+                                                                       BLI_freelinkN(&sl->regionbase, ar);
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
        }
 }