diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-20 01:40:45 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-20 01:40:45 +0300 |
commit | be323efa3525031bc7b2f255543f4d57e2b5f9cc (patch) | |
tree | 3c12abf70b6c610f88026e0905f077ac50f5dd66 /source | |
parent | ff038161f6ee255b4c60246f24315e8b911f773e (diff) |
Fix preview do_version bug (causing region type missing errors)
The missing region was added to the wrong region base.
Bump the subversion, new code to fix wrong region layouts saved in previous subversion and correct all old files correctly.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 77 |
2 files changed, 64 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 8a7f4da8cbf..8e7e698a986 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,7 +43,7 @@ struct bContext; struct ReportList; #define BLENDER_VERSION 250 -#define BLENDER_SUBVERSION 10 +#define BLENDER_SUBVERSION 11 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9548db3278a..24e5cb67d89 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -139,6 +139,7 @@ #include "BKE_report.h" #include "BKE_sca.h" // for init_actuator #include "BKE_scene.h" +#include "BKE_screen.h" #include "BKE_softbody.h" // sbNew() #include "BKE_bullet.h" // bsbNew() #include "BKE_sequencer.h" @@ -10194,27 +10195,75 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10)) { - { - Object *ob; - - /* properly initialise hair clothsim data on old files */ - for(ob = main->object.first; ob; ob = ob->id.next) { - ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { - if (md->type == eModifierType_Cloth) { - ClothModifierData *clmd = (ClothModifierData *)md; - if (clmd->sim_parms->velocity_smooth < 0.01f) - clmd->sim_parms->velocity_smooth = 0.f; + Object *ob; + + /* properly initialise hair clothsim data on old files */ + for(ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + for(md= ob->modifiers.first; md; md= md->next) { + if (md->type == eModifierType_Cloth) { + ClothModifierData *clmd = (ClothModifierData *)md; + if (clmd->sim_parms->velocity_smooth < 0.01f) + clmd->sim_parms->velocity_smooth = 0.f; + } + } + } + } + + /* fix bad area setup in subversion 10 */ + if (main->versionfile == 250 && main->subversionfile == 10) + { + /* fix for new view type in sequencer */ + bScreen *screen; + ScrArea *sa; + SpaceLink *sl; + + + /* remove all preview window in wrong spaces */ + for(screen= main->screen.first; screen; screen= screen->id.next) { + for(sa= screen->areabase.first; sa; sa= sa->next) { + for(sl= sa->spacedata.first; sl; sl= sl->next) { + if(sl->spacetype!=SPACE_SEQ) { + ARegion *ar; + + for( ar = sl->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_PREVIEW) + break; + } + + if (ar) { + SpaceType *st= BKE_spacetype_from_id(SPACE_SEQ); + BKE_area_region_free(st, ar); + BLI_freelinkN(&sl->regionbase, ar); + } + } + } + if(sa->spacetype!=SPACE_SEQ) { + ARegion *ar; + + for( ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_PREVIEW) + break; + } + + if (ar) { + SpaceType *st= BKE_spacetype_from_id(SPACE_SEQ); + BKE_area_region_free(st, ar); + BLI_freelinkN(&sa->regionbase, ar); } } } } + } + + if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11)) + { { /* fix for new view type in sequencer */ bScreen *screen; ScrArea *sa; SpaceLink *sl; - + for(screen= main->screen.first; screen; screen= screen->id.next) { for(sa= screen->areabase.first; sa; sa= sa->next) { @@ -10222,12 +10271,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(sl->spacetype==SPACE_SEQ) { ARegion *ar; ARegion *ar_main; - ListBase *lb = &sa->regionbase; + ListBase *lb = &sl->regionbase; SpaceSeq *sseq = (SpaceSeq *)sl; if (sseq->view == 0) sseq->view = SEQ_VIEW_SEQUENCE; if (sseq->mainb == 0) sseq->mainb = SEQ_DRAW_IMG_IMBUF; - + ar_main = (ARegion*)lb->first; for (; ar_main; ar_main = ar_main->next) { if (ar_main->regiontype == RGN_TYPE_WINDOW) |