diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-26 15:42:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-26 15:42:25 +0300 |
commit | 53ac50ea8b8aa19d31a22a91ba09a7ac5a9efc67 (patch) | |
tree | dd4c5cacccd6802ea13a4c0222aca9c282309081 /source/blender/editors | |
parent | 7603479b6e86a012f511bba00a0c55fd28e7b160 (diff) |
Bugfix: 3d view with scene layer lock were not updated when the
scene layer or other 3d view layers were changed.
Diffstat (limited to 'source/blender/editors')
5 files changed, 54 insertions, 12 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 2752402fb66..be2822d8c49 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -43,6 +43,7 @@ struct EditFace; struct ImBuf; struct Scene; struct bContext; +struct Main; /* for derivedmesh drawing callbacks, for view3d_select, .... */ typedef struct ViewContext { @@ -136,5 +137,7 @@ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); +void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene); + #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 47806ba7937..f05c652c39d 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -252,6 +252,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_MODE: case ND_RENDER_OPTIONS: case ND_KEYINGSET: + case ND_LAYER: ED_area_tag_redraw(sa); break; diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 826a313217a..93fdc96e9f7 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -121,6 +121,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_KEYINGSET: case ND_FRAME: case ND_RENDER_OPTIONS: + case ND_LAYER: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 695d86bb51b..ae0c73e71cc 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -445,6 +445,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_FRAME: case ND_OB_ACTIVE: case ND_OB_SELECT: + case ND_LAYER: ED_region_tag_redraw(ar); break; case ND_MODE: @@ -551,6 +552,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn) case ND_OB_ACTIVE: case ND_OB_SELECT: case ND_MODE: + case ND_LAYER: ED_region_tag_redraw(ar); break; } @@ -598,6 +600,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) case ND_OB_ACTIVE: case ND_OB_SELECT: case ND_MODE: + case ND_LAYER: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 8a232b71c36..1e11699556a 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -134,7 +134,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event); #define B_VIEWBUT 104 #define B_PERSP 105 #define B_VIEWRENDER 106 -#define B_STARTGAME 107 #define B_MODESELECT 108 #define B_AROUND 109 #define B_SEL_VERT 110 @@ -169,9 +168,50 @@ static RegionView3D *wm_region_view3d(const bContext *C) return NULL; } +static void copy_view3d_lock_space(View3D *vd, Scene *scene) +{ + int bit; + + if(vd->scenelock && vd->localvd==NULL) { + vd->lay= scene->lay; + vd->camera= scene->camera; + + if(vd->camera==0 && vd->persp==V3D_CAMOB) + vd->persp= V3D_PERSP; + + if((vd->lay & vd->layact) == 0) { + for(bit= 0; bit<32; bit++) { + if(vd->lay & (1<<bit)) { + vd->layact= 1<<bit; + break; + } + } + } + } +} + +void ED_view3d_scene_layers_update(Main *bmain, Scene *scene) +{ + bScreen *sc; + ScrArea *sa; + SpaceLink *sl; + + /* from scene copy to the other views */ + for(sc=bmain->screen.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) + copy_view3d_lock_space((View3D*)sl, scene); + } +} + // XXX quickly ported across static void handle_view3d_lock(bContext *C) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= CTX_wm_view3d(C); @@ -181,9 +221,13 @@ static void handle_view3d_lock(bContext *C) /* copy to scene */ scene->lay= v3d->lay; scene->camera= v3d->camera; + + /* not through notifiery, listener don't have context + and non-open screens or spaces need to be updated too */ + ED_view3d_scene_layers_update(bmain, scene); /* notifiers for scene update */ - WM_event_add_notifier(C, NC_SCENE, scene); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER, scene); } } } @@ -1713,21 +1757,11 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } break; - case B_VIEWBUT: - - - case B_PERSP: - - - break; case B_VIEWRENDER: if (sa->spacetype==SPACE_VIEW3D) { // XXX BIF_do_ogl_render(v3d, shift); } break; - case B_STARTGAME: -// XXX start_game(); - break; case B_MODESELECT: WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set"); RNA_enum_set(&props_ptr, "mode", v3d->modeselect); |