Perhaps it should now be named 'Reference Image' instead of 'Background Image'?
2012/4/10 Sergey Sharybin <sergey....@gmail.com> > Revision: 45510 > > http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45510 > Author: nazgul > Date: 2012-04-10 14:59:06 +0000 (Tue, 10 Apr 2012) > Log Message: > ----------- > mango request: option to draw background in front of all objects in the > viewport. > Should be really handy for painting clean plates. > > Modified Paths: > -------------- > trunk/blender/release/scripts/startup/bl_ui/space_view3d.py > trunk/blender/source/blender/editors/space_view3d/view3d_draw.c > trunk/blender/source/blender/makesdna/DNA_view3d_types.h > trunk/blender/source/blender/makesrna/intern/rna_space.c > > Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py > =================================================================== > --- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2012-04-10 > 14:58:21 UTC (rev 45509) > +++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2012-04-10 > 14:59:06 UTC (rev 45510) > @@ -2478,10 +2478,12 @@ > column.prop(bg.clip_user, "use_render_undistorted") > > if has_bg: > - box.prop(bg, "opacity", slider=True) > + col = box.column() > + col.prop(bg, "show_on_foreground") > + col.prop(bg, "opacity", slider=True) > if bg.view_axis != 'CAMERA': > - box.prop(bg, "size") > - row = box.row(align=True) > + col.prop(bg, "size") > + row = col.row(align=True) > row.prop(bg, "offset_x", text="X") > row.prop(bg, "offset_y", text="Y") > > > Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c > =================================================================== > --- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c > 2012-04-10 14:58:21 UTC (rev 45509) > +++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c > 2012-04-10 14:59:06 UTC (rev 45510) > @@ -1515,7 +1515,7 @@ > > /* ************************************************************* */ > > -static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) > +static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, int > foreground) > { > RegionView3D *rv3d = ar->regiondata; > BGpic *bgpic; > @@ -1524,10 +1524,13 @@ > ImBuf *ibuf = NULL, *freeibuf; > float vec[4], fac, asp, zoomx, zoomy; > float x1, y1, x2, y2, cx, cy; > + int fg_flag = foreground ? V3D_BGPIC_FOREGROUND : 0; > > - > for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) { > > + if ((bgpic->flag & V3D_BGPIC_FOREGROUND) != fg_flag) > + continue; > + > if ((bgpic->view == 0) || /* zero for any */ > (bgpic->view & (1 << rv3d->view)) || /* check agaist > flags */ > (rv3d->persp == RV3D_CAMOB && bgpic->view == (1 << > RV3D_VIEW_CAMERA))) > @@ -1680,6 +1683,26 @@ > } > } > > +static void draw_bgpics(Scene *scene, ARegion *ar, View3D *v3d, int > foreground) > +{ > + RegionView3D *rv3d = ar->regiondata; > + > + if ((v3d->flag & V3D_DISPBGPICS) == 0) > + return; > + > + if (v3d->flag2 & V3D_RENDER_OVERRIDE) > + return; > + > + if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) > { > + if (rv3d->persp == RV3D_CAMOB) { > + draw_bgpic(scene, ar, v3d, foreground); > + } > + } > + else { > + draw_bgpic(scene, ar, v3d, foreground); > + } > +} > + > /* ****************** View3d afterdraw *************** */ > > typedef struct View3DAfter { > @@ -2750,13 +2773,16 @@ > > /* render result draw */ > if (v3d->flag & V3D_DISPBGPICS) > - draw_bgpic(scene, ar, v3d); > + draw_bgpic(scene, ar, v3d, FALSE); > else > fdrawcheckerboard(0, 0, ar->winx, ar->winy); > > type = rv3d->render_engine->type; > type->view_draw(rv3d->render_engine, C); > > + if (v3d->flag & V3D_DISPBGPICS) > + draw_bgpic(scene, ar, v3d, TRUE); > + > return 1; > } > > @@ -2837,9 +2863,6 @@ > star_stuff_term_func); > } > } > - if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { > - if (v3d->flag & V3D_DISPBGPICS) > draw_bgpic(scene, ar, v3d); > - } > } > } > else { > @@ -2851,13 +2874,11 @@ > glLoadMatrixf(rv3d->winmat); > glMatrixMode(GL_MODELVIEW); > glLoadMatrixf(rv3d->viewmat); > - > - if (v3d->flag & V3D_DISPBGPICS) { > - draw_bgpic(scene, ar, v3d); > - } > } > } > - > + > + draw_bgpics(scene, ar, v3d, FALSE); > + > if (rv3d->rflag & RV3D_CLIPPING) > ED_view3d_clipping_set(rv3d); > > @@ -2915,6 +2936,8 @@ > } > } > > + draw_bgpics(scene, ar, v3d, TRUE); > + > // REEB_draw(); > > if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { > > Modified: trunk/blender/source/blender/makesdna/DNA_view3d_types.h > =================================================================== > --- trunk/blender/source/blender/makesdna/DNA_view3d_types.h 2012-04-10 > 14:58:21 UTC (rev 45509) > +++ trunk/blender/source/blender/makesdna/DNA_view3d_types.h 2012-04-10 > 14:59:06 UTC (rev 45510) > @@ -314,6 +314,7 @@ > #define V3D_BGPIC_EXPANDED 2 > #define V3D_BGPIC_CAMERACLIP 4 > #define V3D_BGPIC_DISABLED 8 > +#define V3D_BGPIC_FOREGROUND 16 > > /* BGPic->source */ > /* may want to use 1 for select ?*/ > > Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c > =================================================================== > --- trunk/blender/source/blender/makesrna/intern/rna_space.c 2012-04-10 > 14:58:21 UTC (rev 45509) > +++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2012-04-10 > 14:59:06 UTC (rev 45510) > @@ -1350,6 +1350,11 @@ > RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", > V3D_BGPIC_DISABLED); > RNA_def_property_ui_text(prop, "Show Background Image", "Show this > image as background"); > RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); > + > + prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, > PROP_NONE); > + RNA_def_property_boolean_sdna(prop, NULL, "flag", > V3D_BGPIC_FOREGROUND); > + RNA_def_property_ui_text(prop, "Show On Foreground", "Show this > image in fround of objects in viewport"); > + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); > } > > static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop) > > _______________________________________________ > Bf-blender-cvs mailing list > bf-blender-...@blender.org > http://lists.blender.org/mailman/listinfo/bf-blender-cvs > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers