fix for fix, was incorrectly looping over regions.

This commit is contained in:
Campbell Barton 2011-04-27 14:53:45 +00:00
parent 2a7e70ba15
commit 9e6cdf54a3

@ -11591,26 +11591,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */ /* put compatibility code here until next subversion bump */
{ {
ARegion *ar; /* screen view2d settings were not properly initialized [#27164]
/* screen view2d settings were not properly initialized [#27164] */ * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
* need to make less ugly - possibly an iterator? */
bScreen *screen; bScreen *screen;
for(screen= main->screen.first; screen; screen= screen->id.next) { for(screen= main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa; ScrArea *sa;
/* add regions */ /* add regions */
for(sa= screen->areabase.first; sa; sa= sa->next) { for(sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl; SpaceLink *sl= sa->spacedata.first;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_IMAGE) { if(sl->spacetype==SPACE_IMAGE) {
ARegion *ar;
for (ar=sa->regionbase.first; ar; ar= ar->next) { for (ar=sa->regionbase.first; ar; ar= ar->next) {
if(ar->regiontype == RGN_TYPE_WINDOW) { if(ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
v2d->minzoom= 0; v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
v2d->maxzoom= 0; }
v2d->scroll= 0; /* cause of bug, but set others just incase */ }
v2d->keeptot= 0; }
v2d->keepzoom= 0; for (sl= sa->spacedata.first; sl; sl= sl->next) {
v2d->keepofs= 0; if(sl->spacetype==SPACE_IMAGE) {
v2d->align= 0; ARegion *ar;
for (ar=sl->regionbase.first; ar; ar= ar->next) {
if(ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d;
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
} }
} }
} }