diff options
-rw-r--r-- | source/blender/editors/include/ED_render.h | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 43 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 3 |
3 files changed, 29 insertions, 19 deletions
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 73bbd5ffef8..5392ef86ba7 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -37,6 +37,7 @@ struct MTex; struct Render; struct RenderInfo; struct Scene; +struct ScrArea; /* render_ops.c */ @@ -46,6 +47,7 @@ void ED_operatortypes_render(void); void ED_render_id_flush_update(struct Main *bmain, struct ID *id); void ED_render_engine_changed(struct Main *bmain); +void ED_render_engine_area_exit(struct ScrArea *sa); void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated); /* render_preview.c */ diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 35b4126339e..48c35873304 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -116,35 +116,40 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated) CTX_free(C); } -void ED_render_engine_changed(Main *bmain) +void ED_render_engine_area_exit(ScrArea *sa) { - /* on changing the render engine type, clear all running render engines */ - bScreen *sc; - ScrArea *sa; + /* clear all render engines in this area */ ARegion *ar; - for (sc = bmain->screen.first; sc; sc = sc->id.next) { - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (sa->spacetype != SPACE_VIEW3D) - continue; + if (sa->spacetype != SPACE_VIEW3D) + return; - for (ar = sa->regionbase.first; ar; ar = ar->next) { - RegionView3D *rv3d; + for (ar = sa->regionbase.first; ar; ar = ar->next) { + RegionView3D *rv3d; - if (ar->regiontype != RGN_TYPE_WINDOW) - continue; - - rv3d = ar->regiondata; + if (ar->regiontype != RGN_TYPE_WINDOW) + continue; + + rv3d = ar->regiondata; - if (rv3d->render_engine) { - RE_engine_free(rv3d->render_engine); - rv3d->render_engine = NULL; - } - } + if (rv3d->render_engine) { + RE_engine_free(rv3d->render_engine); + rv3d->render_engine = NULL; } } } +void ED_render_engine_changed(Main *bmain) +{ + /* on changing the render engine type, clear all running render engines */ + bScreen *sc; + ScrArea *sa; + + for (sc = bmain->screen.first; sc; sc = sc->id.next) + for (sa = sc->areabase.first; sa; sa = sa->next) + ED_render_engine_area_exit(sa); +} + /***************************** Updates *********************************** * ED_render_id_flush_update gets called from DAG_id_tag_update, to do * * editor level updates when the ID changes. when these ID blocks are in * diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 03d8b3d3e9c..cafa4527c20 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1154,6 +1154,9 @@ void ED_area_exit(bContext *C, ScrArea *sa) ED_fileselect_exit(C, (SpaceFile *)sl); } } + else if (sa->spacetype == SPACE_VIEW3D) { + ED_render_engine_area_exit(sa); + } CTX_wm_area_set(C, sa); for (ar= sa->regionbase.first; ar; ar= ar->next) |