diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-11-18 14:37:39 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-11-18 14:38:18 +0300 |
commit | fffb1a4cfbd25cccc5df2a113907b6aa29d0f204 (patch) | |
tree | 54ae7f398b80c7ca1842f9b3f8314c0897f2273f | |
parent | 841c4deed7a8a98761cb3f154a6581f10841eb35 (diff) |
Implement multi-view stereo support for image empties
Empty images were implemented to expand (and eventually replace)
the background images functionalities. If we are ever to drop
background images "image empties" should support stereo/multi-view as well.
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index dd282c427f6..90d33dc5995 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -631,10 +631,20 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype) /* Function to draw an Image on an empty Object */ -static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4]) +static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4], StereoViews sview) { Image *ima = ob->data; - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, ob->iuser, NULL); + ImBuf *ibuf; + ImageUser iuser = *ob->iuser; + + /* Support multi-view */ + if (ima && (sview == STEREO_RIGHT_ID)) { + iuser.multiview_eye = sview; + iuser.flag |= IMA_SHOW_STEREO; + BKE_image_multiview_index(ima, &iuser); + } + + ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL); if (ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) { IMB_rect_from_float(ibuf); @@ -7708,7 +7718,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short case OB_EMPTY: if (!render_override) { if (ob->empty_drawtype == OB_EMPTY_IMAGE) { - draw_empty_image(ob, dflag, ob_wire_col); + draw_empty_image(ob, dflag, ob_wire_col, v3d->multiview_eye); } else { drawaxes(rv3d->viewmatob, ob->empty_drawsize, ob->empty_drawtype); @@ -8488,7 +8498,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object case OB_EMPTY: if (ob->empty_drawtype == OB_EMPTY_IMAGE) { /* CONSTCOLOR == no wire outline */ - draw_empty_image(ob, DRAW_CONSTCOLOR, NULL); + draw_empty_image(ob, DRAW_CONSTCOLOR, NULL, v3d->multiview_eye); } else { drawaxes(rv3d->viewmatob, ob->empty_drawsize, ob->empty_drawtype); |