Fix T45075: "Error, region type 2 missing in - name:"File", id:5"
authorJulian Eisel <eiseljulian@gmail.com>
Sun, 27 Mar 2016 11:36:12 +0000 (13:36 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Sun, 27 Mar 2016 11:45:10 +0000 (13:45 +0200)
Unexpectedly found out what was going wrong here. If a file was saved with a filebrowser open, we searched for the channel region in the wrong list (see 'ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;').

Minor annoyance is that I had to move the loookup to the 2.77.1 version patch now.

source/blender/blenloader/intern/versioning_270.c

index 7d30ca898224f3aeb30479d8b6b48f978015c8c6..b9191d545edd73983db3d2028da05c48b1d2c98a 100644 (file)
@@ -584,34 +584,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                }
        }
 
-       if (!MAIN_VERSION_ATLEAST(main, 273, 7)) {
-               bScreen *scr;
-               ScrArea *sa;
-               SpaceLink *sl;
-               ARegion *ar;
-
-               for (scr = main->screen.first; scr; scr = scr->id.next) {
-                       /* Remove old deprecated region from filebrowsers */
-                       for (sa = scr->areabase.first; sa; sa = sa->next) {
-                               for (sl = sa->spacedata.first; sl; sl = sl->next) {
-                                       if (sl->spacetype == SPACE_FILE) {
-                                               for (ar = sl->regionbase.first; ar; ar = ar->next) {
-                                                       if (ar->regiontype == RGN_TYPE_CHANNELS) {
-                                                               break;
-                                                       }
-                                               }
-
-                                               if (ar) {
-                                                       /* Free old deprecated 'channel' region... */
-                                                       BKE_area_region_free(NULL, ar);
-                                                       BLI_freelinkN(&sl->regionbase, ar);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
        if (!MAIN_VERSION_ATLEAST(main, 273, 8)) {
                Object *ob;
                for (ob = main->object.first; ob != NULL; ob = ob->id.next) {
@@ -1068,16 +1040,15 @@ 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) {
+                                       ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+                                       /* Bug: Was possible to add preview region to sequencer view by using AZones. */
                                        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) {
+                                                       for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
                                                                /* remove preview region for sequencer-only view! */
                                                                if (ar->regiontype == RGN_TYPE_PREVIEW) {
                                                                        ar->flag |= RGN_FLAG_HIDDEN;
@@ -1087,6 +1058,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                                                        }
                                                }
                                        }
+                                       /* Remove old deprecated region from filebrowsers */
+                                       else if (sl->spacetype == SPACE_FILE) {
+                                               for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
+                                                       if (ar->regiontype == RGN_TYPE_CHANNELS) {
+                                                               /* Free old deprecated 'channel' region... */
+                                                               BKE_area_region_free(NULL, ar);
+                                                               BLI_freelinkN(regionbase, ar);
+                                                               break;
+                                                       }
+                                               }
+                                       }
                                }
                        }
                }