diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-19 19:54:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-19 19:54:41 +0300 |
commit | bc63213844e723b0c552da446fb7fa9f9e7ea5f6 (patch) | |
tree | 433519ee3526536032e62226a058f6ec4fd17a1a /source/blender/blenloader | |
parent | 9b049d89a1bc36534875c67e097415e034d0624d (diff) |
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 67 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 31 |
2 files changed, 81 insertions, 17 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index eb1693cd22e..13e7bf91c73 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4101,8 +4101,6 @@ static void lib_link_screen(FileData *fd, Main *main) if(v3d->localvd) { v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera); } - v3d->depths= NULL; - v3d->ri= NULL; } else if(sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)sl; @@ -4409,7 +4407,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) } } -static void direct_link_region(FileData *fd, ARegion *ar) +static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) { Panel *pa; @@ -4421,15 +4419,51 @@ static void direct_link_region(FileData *fd, ARegion *ar) pa->sortcounter= 0; pa->activedata= NULL; } - + + ar->regiondata= newdataadr(fd, ar->regiondata); + if(ar->regiondata) { + if(spacetype==SPACE_VIEW3D) { + RegionView3D *rv3d= ar->regiondata; + + rv3d->localvd= newdataadr(fd, rv3d->localvd); + rv3d->clipbb= newdataadr(fd, rv3d->clipbb); + + rv3d->depths= NULL; + rv3d->retopo_view_data= NULL; + rv3d->ri= NULL; + rv3d->sms= NULL; + rv3d->smooth_timer= NULL; + } + } + ar->handlers.first= ar->handlers.last= NULL; ar->uiblocks.first= ar->uiblocks.last= NULL; ar->headerstr= NULL; - ar->regiondata= NULL; ar->swinid= 0; ar->type= NULL; } +/* for the saved 2.50 files without regiondata */ +/* and as patch for 2.48 and older */ +static void view3d_split_250(View3D *v3d, ListBase *regions) +{ + ARegion *ar; + + for(ar= regions->first; ar; ar= ar->next) { + if(ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) { + RegionView3D *rv3d; + + rv3d= ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region v3d"); + rv3d->persp= v3d->persp; + rv3d->view= v3d->view; + rv3d->dist= v3d->dist; + VECCOPY(rv3d->ofs, v3d->ofs); + QUATCOPY(rv3d->viewquat, v3d->viewquat); + Mat4One(rv3d->twmat); + } + } +} + static void direct_link_screen(FileData *fd, bScreen *sc) { ScrArea *sa; @@ -4482,6 +4516,9 @@ static void direct_link_screen(FileData *fd, bScreen *sc) sa->handlers.first= sa->handlers.last= NULL; sa->type= NULL; /* spacetype callbacks */ + for(ar= sa->regionbase.first; ar; ar= ar->next) + direct_link_region(fd, ar, sa->spacetype); + /* accident can happen when read/save new file with older version */ /* 2.50: we now always add spacedata for info */ if(sa->spacedata.first==NULL) { @@ -4489,12 +4526,15 @@ static void direct_link_screen(FileData *fd, bScreen *sc) sa->spacetype= SPACE_INFO; BLI_addtail(&sa->spacedata, sinfo); } + /* add local view3d too */ + else if(sa->spacetype==SPACE_VIEW3D) + view3d_split_250(sa->spacedata.first, &sa->regionbase); for (sl= sa->spacedata.first; sl; sl= sl->next) { link_list(fd, &(sl->regionbase)); for(ar= sl->regionbase.first; ar; ar= ar->next) - direct_link_region(fd, ar); + direct_link_region(fd, ar, sl->spacetype); if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; @@ -4507,11 +4547,9 @@ static void direct_link_screen(FileData *fd, bScreen *sc) } v3d->localvd= newdataadr(fd, v3d->localvd); v3d->afterdraw.first= v3d->afterdraw.last= NULL; - v3d->clipbb= newdataadr(fd, v3d->clipbb); - v3d->retopo_view_data= NULL; v3d->properties_storage= NULL; - v3d->sms= NULL; - v3d->smooth_timer= NULL; + + view3d_split_250(v3d, &sl->regionbase); } else if (sl->spacetype==SPACE_OOPS) { SpaceOops *soops= (SpaceOops*) sl; @@ -4561,9 +4599,6 @@ static void direct_link_screen(FileData *fd, bScreen *sc) } } - for(ar= sa->regionbase.first; ar; ar= ar->next) - direct_link_region(fd, ar); - sa->actionzones.first= sa->actionzones.last= NULL; sa->v1= newdataadr(fd, sa->v1); @@ -5412,7 +5447,12 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) if(sl) { /* if active spacetype has view2d data, copy that over to main region */ + /* and we split view3d */ switch(sl->spacetype) { + case SPACE_VIEW3D: + view3d_split_250((View3D *)sl, lb); + break; + case SPACE_OOPS: { SpaceOops *soops= (SpaceOops *)sl; @@ -8679,7 +8719,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(ma->nodetree && strlen(ma->nodetree->id.name)==0) strcpy(ma->nodetree->id.name, "NTShader Nodetree"); } - /* and composit trees */ for(sce= main->scene.first; sce; sce= sce->id.next) { if(sce->nodetree && strlen(sce->nodetree->id.name)==0) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index a6f470493c8..2f31320444b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1692,6 +1692,32 @@ static void write_windowmanagers(WriteData *wd, ListBase *lb) } } +static void write_region(WriteData *wd, ARegion *ar, int spacetype) +{ + writestruct(wd, DATA, "ARegion", 1, ar); + + if(ar->regiondata) { + switch(spacetype) { + case SPACE_VIEW3D: + if(ar->regiontype==RGN_TYPE_WINDOW) { + RegionView3D *rv3d= ar->regiondata; + writestruct(wd, DATA, "RegionView3D", 1, rv3d); + + if(rv3d->localvd) + writestruct(wd, DATA, "RegionView3D", 1, rv3d->localvd); + if(rv3d->clipbb) + writestruct(wd, DATA, "BoundBox", 1, rv3d->clipbb); + + } + else + printf("regiondata write missing!\n"); + break; + default: + printf("regiondata write missing!\n"); + } + } +} + static void write_screens(WriteData *wd, ListBase *scrbase) { bScreen *sc; @@ -1723,7 +1749,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase) writestruct(wd, DATA, "ScrArea", 1, sa); for(ar= sa->regionbase.first; ar; ar= ar->next) { - writestruct(wd, DATA, "ARegion", 1, ar); + write_region(wd, ar, sa->spacetype); for(pa= ar->panels.first; pa; pa= pa->next) writestruct(wd, DATA, "Panel", 1, pa); @@ -1735,14 +1761,13 @@ static void write_screens(WriteData *wd, ListBase *scrbase) sl= sa->spacedata.first; while(sl) { for(ar= sl->regionbase.first; ar; ar= ar->next) - writestruct(wd, DATA, "ARegion", 1, ar); + write_region(wd, ar, sl->spacetype); if(sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *) sl; writestruct(wd, DATA, "View3D", 1, v3d); if(v3d->bgpic) writestruct(wd, DATA, "BGpic", 1, v3d->bgpic); if(v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd); - if(v3d->clipbb) writestruct(wd, DATA, "BoundBox", 1, v3d->clipbb); if(v3d->gpd) write_gpencil(wd, v3d->gpd); } else if(sl->spacetype==SPACE_IPO) { |