weight paint without shading when in wire view. use stipple wire to help show where...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jan 2010 12:51:17 +0000 (12:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jan 2010 12:51:17 +0000 (12:51 +0000)
only way to do this previously was to have a UV layer, be in textured mode, not have any lights or textures and then set weight paint mode.

source/blender/editors/space_view3d/drawobject.c

index a5a82b22e272b20079e7ae7f83f2d8a6bb94bf6c..c3e248c9d7ce1a5a6026a23961fb95a567c2524c 100644 (file)
@@ -2360,44 +2360,70 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                }
        }
        else if(dt==OB_SOLID) {
-               Paint *p;
+               if(ob==OBACT && ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
+                       /* weight paint in solid mode, special case. focus on making the weights clear
+                        * rather then the shading, this is also forced in wire view */
+                       GPU_enable_material(0, NULL);
+                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
 
-               if((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire && !ob->sculpt)
-                       draw_mesh_object_outline(v3d, ob, dm);
+                       bglPolygonOffset(rv3d->dist, 1.0);
+                       glDepthMask(0); // disable write in zbuffer, selected edge wires show better
 
-               glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED );
+                       glEnable(GL_BLEND);
+                       glColor4ub(196, 196, 196, 196);
+                       glEnable(GL_LINE_STIPPLE);
+                       glLineStipple(1, 0x8888);
 
-               glEnable(GL_LIGHTING);
-               glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+                       dm->drawEdges(dm, 1);
 
-               if(ob->sculpt && (p=paint_get_active(scene))) {
-                       float planes[4][4];
-                       float (*fpl)[4] = NULL;
-                       int fast= (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
+                       bglPolygonOffset(rv3d->dist, 0.0);
+                       glDepthMask(1);
+                       glDisable(GL_LINE_STIPPLE);
+
+                       GPU_disable_material();
 
-                       if(ob->sculpt->partial_redraw) {
-                               sculpt_get_redraw_planes(planes, ar, rv3d, ob);
-                               fpl = planes;
-                               ob->sculpt->partial_redraw = 0;
-                       }
 
-                       dm->drawFacesSolid(dm, fpl, fast, GPU_enable_material);
                }
-               else
-                       dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
+               else {
+                       Paint *p;
 
-               GPU_disable_material();
+                       if((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire && !ob->sculpt)
+                               draw_mesh_object_outline(v3d, ob, dm);
 
-               glFrontFace(GL_CCW);
-               glDisable(GL_LIGHTING);
+                       glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED );
 
-               if(base->flag & SELECT) {
-                       UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
-               } else {
-                       UI_ThemeColor(TH_WIRE);
+                       glEnable(GL_LIGHTING);
+                       glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+
+                       if(ob->sculpt && (p=paint_get_active(scene))) {
+                               float planes[4][4];
+                               float (*fpl)[4] = NULL;
+                               int fast= (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
+
+                               if(ob->sculpt->partial_redraw) {
+                                       sculpt_get_redraw_planes(planes, ar, rv3d, ob);
+                                       fpl = planes;
+                                       ob->sculpt->partial_redraw = 0;
+                               }
+
+                               dm->drawFacesSolid(dm, fpl, fast, GPU_enable_material);
+                       }
+                       else
+                               dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
+
+                       GPU_disable_material();
+
+                       glFrontFace(GL_CCW);
+                       glDisable(GL_LIGHTING);
+
+                       if(base->flag & SELECT) {
+                               UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
+                       } else {
+                               UI_ThemeColor(TH_WIRE);
+                       }
+                       if(!ob->sculpt)
+                               dm->drawLooseEdges(dm);
                }
-               if(!ob->sculpt)
-                       dm->drawLooseEdges(dm);
        }
        else if(dt==OB_SHADED) {
                int do_draw= 1; /* to resolve all G.f settings below... */
@@ -5298,10 +5324,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 
                        if(ob->mode & OB_MODE_EDIT);
                        else {
-                               if(dt<OB_SOLID)
+                               if(dt<OB_SOLID) {
                                        zbufoff= 1;
+                                       dt= OB_SOLID;
+                               }
+                               else {
+                                       dt= OB_SHADED;
+                               }
 
-                               dt= OB_SHADED;
                                glEnable(GL_DEPTH_TEST);
                        }
                }