diff options
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 57755231240..d332fb9f8b3 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -48,10 +48,12 @@ #include "BKE_object.h" #include "BKE_screen.h" +#include "ED_render.h" #include "ED_space_api.h" #include "ED_screen.h" #include "ED_object.h" +#include "GPU_extensions.h" #include "GPU_material.h" #include "BIF_gl.h" @@ -350,7 +352,7 @@ static void view3d_free(SpaceLink *sl) /* spacetype; init callback */ -static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) +static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -469,7 +471,22 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar) } -static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static void view3d_main_area_exit(wmWindowManager *UNUSED(wm), ARegion *ar) +{ + RegionView3D *rv3d = ar->regiondata; + + if (rv3d->render_engine) { + RE_engine_free(rv3d->render_engine); + rv3d->render_engine = NULL; + } + + if (rv3d->gpuoffscreen) { + GPU_offscreen_free(rv3d->gpuoffscreen); + rv3d->gpuoffscreen = NULL; + } +} + +static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -479,7 +496,7 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSE return 0; } -static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -489,7 +506,7 @@ static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UN return 0; } -static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -499,7 +516,7 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS return 0; } -static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -513,7 +530,7 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS return 0; } -static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { if (event->ctrl) return false; @@ -524,7 +541,7 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { Base *base = ED_view3d_give_base_under_cursor(C, event->mval); @@ -535,7 +552,7 @@ static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { Base *base = ED_view3d_give_base_under_cursor(C, event->mval); @@ -615,6 +632,10 @@ static void view3d_main_area_free(ARegion *ar) if (rv3d->sms) { MEM_freeN(rv3d->sms); } + if (rv3d->gpuoffscreen) { + GPU_offscreen_free(rv3d->gpuoffscreen); + } + MEM_freeN(rv3d); ar->regiondata = NULL; } @@ -633,6 +654,7 @@ static void *view3d_main_area_duplicate(void *poin) new->clipbb = MEM_dupallocN(rv3d->clipbb); new->depths = NULL; + new->gpuoffscreen = NULL; new->ri = NULL; new->render_engine = NULL; new->gpd = NULL; @@ -1216,6 +1238,7 @@ void ED_spacetype_view3d(void) art->keymapflag = ED_KEYMAP_GPENCIL; art->draw = view3d_main_area_draw; art->init = view3d_main_area_init; + art->exit = view3d_main_area_exit; art->free = view3d_main_area_free; art->duplicate = view3d_main_area_duplicate; art->listener = view3d_main_area_listener; |