From 847ff75b359f9996c342709d69a2f82f8398fa38 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 14 Nov 2004 12:56:56 +0000 Subject: Bugfix in undo: localview got stuck after an Undo command, it now restores to normal view when no localviewed objects are there. Please note again; localview is UI, so actually not saved in the undo... --- source/blender/blenloader/intern/readfile.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/blenloader/intern') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 482ec2864fc..ae60f05b96c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2730,12 +2730,10 @@ void lib_link_screen_restore(Main *newmain, char mode, Scene *curscene) for (sl= sa->spacedata.first; sl; sl= sl->next) { if(sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; - + if(mode=='u') v3d->camera= restore_pointer_by_name(newmain, (ID *)v3d->camera, 1); if(v3d->camera==NULL || mode=='n') v3d->camera= sc->scene->camera; - if(v3d->scenelock) v3d->lay= sc->scene->lay; - if(v3d->bgpic) { v3d->bgpic->ima= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->ima, 1); v3d->bgpic->tex= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->tex, 1); @@ -2743,9 +2741,18 @@ void lib_link_screen_restore(Main *newmain, char mode, Scene *curscene) v3d->bgpic->rect= NULL; } if(v3d->localvd) { + Base *base; if(mode=='u') v3d->localvd->camera= restore_pointer_by_name(newmain, (ID *)v3d->localvd->camera, 1); if(v3d->localvd->camera==NULL || mode=='n') v3d->localvd->camera= sc->scene->camera; + + /* localview can become invalid during undo/redo steps, so we exit it when no could be found */ + for(base= sc->scene->base.first; base; base= base->next) { + if(base->lay & v3d->lay) break; + } + if(base==NULL) endlocalview(sa); } + else if(v3d->scenelock) v3d->lay= sc->scene->lay; + } else if(sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)sl; -- cgit v1.2.3