Cleanup: use edit/active objects from view context

Needed to implement multiple edit-objects.
This commit is contained in:
Campbell Barton 2018-03-08 17:26:02 +11:00
parent cb8311fecf
commit 28f86bf117
1 changed files with 14 additions and 13 deletions

View File

@ -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);
}
}
/**