From 28f86bf117e9d9d10089ef758a5ec4ade65084c6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Mar 2018 17:26:02 +1100 Subject: Cleanup: use edit/active objects from view context Needed to implement multiple edit-objects. --- source/blender/editors/space_view3d/view3d_draw.c | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7e613e36119..cc046eebc68 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1318,31 +1318,30 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* *********************** backdraw for selection *************** */ -static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d) +static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d, Object *obact, Object *obedit) { RegionView3D *rv3d = ar->regiondata; - struct Base *base = scene->basact; int multisample_enabled; BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); - if (base && (base->object->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || - BKE_paint_select_face_test(base->object))) + if (obact && (obact->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || + BKE_paint_select_face_test(obact))) { /* do nothing */ } /* texture paint mode sampling */ - else if (base && (base->object->mode & OB_MODE_TEXTURE_PAINT) && + else if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT) && (v3d->drawtype > OB_WIRE)) { /* do nothing */ } - else if ((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && + else if ((obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) && V3D_IS_ZBUF(v3d)) { /* do nothing */ } - else if (scene->obedit && + else if (obedit && V3D_IS_ZBUF(v3d)) { /* do nothing */ @@ -1417,10 +1416,11 @@ static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d ED_view3d_clipping_set(rv3d); G.f |= G_BACKBUFSEL; - - if (base && (base->lay & v3d->lay)) - draw_object_backbufsel(scene, v3d, rv3d, base->object); - + + if (obact && (obact->lay & v3d->lay)) { + draw_object_backbufsel(scene, v3d, rv3d, obact); + } + if (rv3d->gpuoffscreen) GPU_offscreen_unbind(rv3d->gpuoffscreen, true); else @@ -1463,8 +1463,9 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, void ED_view3d_backbuf_validate(ViewContext *vc) { - if (vc->v3d->flag & V3D_INVALID_BACKBUF) - backdrawview3d(vc->scene, vc->win, vc->ar, vc->v3d); + if (vc->v3d->flag & V3D_INVALID_BACKBUF) { + backdrawview3d(vc->scene, vc->win, vc->ar, vc->v3d, vc->obact, vc->obedit); + } } /** -- cgit v1.2.3