diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-22 23:57:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-22 23:57:18 +0400 |
commit | 230eec99173f186065c176d2d0e8ffed18e40495 (patch) | |
tree | 8f1fc913e11842681de6616410535c186522575f /source/blender/blenkernel/intern/screen.c | |
parent | 5b666c95ce1fb6baf286a982a66c9e500a84de45 (diff) |
chaning the camera from the scene buttons didnt update the views. moved some scene/view functions from view3d_view.c into BKE_screen since they need to be accessed when changing cameras from outside the view.
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index de5f018673f..a8140cb815d 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -330,3 +330,67 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type) } return NULL; } + +void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene) +{ + int bit; + + if(v3d->scenelock && v3d->localvd==NULL) { + v3d->lay= scene->lay; + v3d->camera= scene->camera; + + if(v3d->camera==NULL) { + ARegion *ar; + + for(ar=v3d->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) { + RegionView3D *rv3d= ar->regiondata; + if(rv3d->persp==RV3D_CAMOB) + rv3d->persp= RV3D_PERSP; + } + } + } + + if((v3d->lay & v3d->layact) == 0) { + for(bit= 0; bit<32; bit++) { + if(v3d->lay & (1<<bit)) { + v3d->layact= 1<<bit; + break; + } + } + } + } +} + +void BKE_screen_view3d_scene_sync(bScreen *sc) +{ + /* are there cameras in the views that are not in the scene? */ + ScrArea *sa; + for(sa= sc->areabase.first; sa; sa= sa->next) { + SpaceLink *sl; + for(sl= sa->spacedata.first; sl; sl= sl->next) { + if(sl->spacetype==SPACE_VIEW3D) { + View3D *v3d= (View3D*) sl; + BKE_screen_view3d_sync(v3d, sc->scene); + } + } + } +} + +void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene) +{ + bScreen *sc; + ScrArea *sa; + SpaceLink *sl; + + /* from scene copy to the other views */ + for(sc=screen_lb->first; sc; sc=sc->id.next) { + if(sc->scene!=scene) + continue; + + for(sa=sc->areabase.first; sa; sa=sa->next) + for(sl=sa->spacedata.first; sl; sl=sl->next) + if(sl->spacetype==SPACE_VIEW3D) + BKE_screen_view3d_sync((View3D*)sl, scene); + } +} |