Weightpaint fix.

Weight painting was recoded in 2.40 to support all features from vertex
paint. That code uses a 'soft' brush by default, which makes it impossible
to assign exact weight values on a single click (which used to be possible)

I've made that an option now, so you can disable it for single-click setting
of values on vertices within the brush (if 'use vertex distances' is
set, of course).
This commit is contained in:
Ton Roosendaal
2006-06-29 13:46:39 +00:00
parent 0735bf0ae1
commit d90b676bbb
3 changed files with 16 additions and 10 deletions

View File

@@ -415,5 +415,6 @@
#define VP_NORMALS 8
#define VP_SPRAY 16
#define VP_MIRROR_X 32
#define VP_HARD 64
#endif

View File

@@ -3852,7 +3852,7 @@ static void editing_panel_mesh_paint(void)
uiDefBut(block, BUT, B_OPA3_4 , "3/4", 145,100,45,19, 0, 0, 0, 0, 0, "");
uiDefBut(block, BUT, B_OPA1_0 , "1", 190,100,45,19, 0, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, B_NOP, "Size ", 10,80,225,19, &Gwp.size, 2.0, 64.0, 0, 0, "The size of the brush");
uiDefButF(block, NUMSLI, B_NOP, "Size ", 10,80,225,19, &Gwp.size, 2.0, 64.0, 0, 0, "The size of the brush");
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_DIFF, "Mix", 250,160,60,17, &Gwp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colors");
@@ -3862,18 +3862,21 @@ static void editing_panel_mesh_paint(void)
uiDefButS(block, ROW, B_DIFF, "Filter", 250, 88,60,17, &Gwp.mode, 1.0, 4.0, 0, 0, "Mix the colors with an alpha factor");
uiDefButS(block, ROW, B_DIFF, "Lighter", 250, 70,60,17, &Gwp.mode, 1.0, 5.0, 0, 0, "Paint over darker areas only");
uiDefButS(block, ROW, B_DIFF, "Darker", 250, 52,60,17, &Gwp.mode, 1.0, 6.0, 0, 0, "Paint over lighter areas only");
uiBlockEndAlign(block);
uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 160,55,75,19, &Gwp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 10,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Paint on all faces inside brush");
uiDefButBitS(block, TOG, VP_SOFT, 0, "Vertex Dist", 85,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of paint entire faces)");
uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 160,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting");
uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 235,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse");
uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 10,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Paint on all faces inside brush (otherwise only on face under mouse cursor)");
uiDefButBitS(block, TOG, VP_SOFT, 0, "Vertex Dist", 85,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of all vertices of face)");
uiDefButBitS(block, TOGN, VP_HARD, 0, "Soft", 160,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use a soft brush");
uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 235,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting");
if(ob){
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, VP_MIRROR_X, REDRAWVIEW3D, "X-Mirror", 10,0,100,19, &Gwp.flag, 0, 0, 0, 0, "Mirrored Paint, applying on mirrored Weight Group name");
uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 110,0,100,19, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
uiDefBut(block, BUT, B_CLR_WPAINT, "Clear", 210,0,100,19, NULL, 0, 0, 0, 0, "Removes reference to this deform group from all vertices");
uiDefButBitS(block, TOG, VP_MIRROR_X, REDRAWVIEW3D, "X-Mirror", 10,-10,100,19, &Gwp.flag, 0, 0, 0, 0, "Mirrored Paint, applying on mirrored Weight Group name");
uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 110,-10,100,19, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
uiDefBut(block, BUT, B_CLR_WPAINT, "Clear", 210,-10,100,19, NULL, 0, 0, 0, 0, "Removes reference to this deform group from all vertices");
uiBlockEndAlign(block);
}
}

View File

@@ -830,8 +830,10 @@ static int calc_vp_alpha_dl(VPaint *vp, float *vert_nor, short *mval)
fac= sqrt(dx*dx + dy*dy);
if(fac > vp->size) return 0;
alpha= 255.0*vp->a*(1.0-fac/vp->size);
if(vp->flag & VP_HARD)
alpha= 255;
else
alpha= 255.0*vp->a*(1.0-fac/vp->size);
}
else {
alpha= 255.0*vp->a;