diff options
author | Ton Roosendaal <ton@blender.org> | 2004-11-05 15:58:12 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-11-05 15:58:12 +0300 |
commit | b169abb4cfd675ccf1eed2bcb441797d06fa3abc (patch) | |
tree | 3e5d0198cd45afc3da7abda854d477cbe324ceda /source | |
parent | 5ffb4cb338b42a339720b730de0f2564abe50723 (diff) |
Bug fix #1678
Deformed meshes (by armature for example) didn't get drawn correctly
for vertex paint, weightpaint, UV faceselect. Was OK in 2.34 :)
Additional to that I found out vertex paint doesn't correctly use the
'Area' option, when a mesh was deformed. That was an oldie.
Plus; made tooltips for 'Area' and 'Normals' in Paint Panel clear.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/buttons_editing.c | 4 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 21 | ||||
-rw-r--r-- | source/blender/src/vpaint.c | 16 |
3 files changed, 27 insertions, 14 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 42f7149c821..96239d47341 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -2405,9 +2405,9 @@ static void editing_panel_mesh_paint(void) uiDefButS(block, ROW, B_DIFF, "Filter", 1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor"); uiBlockBeginAlign(block); - uiDefButS(block, TOG|BIT|1, 0, "Area", 979,50,81,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers"); + uiDefButS(block, TOG|BIT|1, 0, "Area", 979,50,81,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint evaluates the area of the face the brush covers (otherwise vertices only)"); uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush"); - uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting"); + uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint applies the vertex normal before painting"); uiBlockBeginAlign(block); uiDefBut(block, BUT, B_VPGAMMA, "Set", 979,30,81,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours"); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 4184026acbb..4a5b54d25fc 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -4600,6 +4600,8 @@ static int bbs_mesh_solid(Object *ob, int facecol) MVert *mvert; MFace *mface; TFace *tface; + DispList *dl; + float *extverts=NULL; int a, totface, hastface, i; mvert= me->mvert; @@ -4607,6 +4609,9 @@ static int bbs_mesh_solid(Object *ob, int facecol) tface= me->tface; hastface = (me->tface != NULL); totface= me->totface; + + dl= find_displist(&ob->disp, DL_VERTS); + if(dl) extverts= dl->verts; glBegin(GL_QUADS); glmode= GL_QUADS; @@ -4622,10 +4627,18 @@ static int bbs_mesh_solid(Object *ob, int facecol) if(mface->v4) {if(glmode==GL_TRIANGLES) {glmode= GL_QUADS; glEnd(); glBegin(GL_QUADS);}} else {if(glmode==GL_QUADS) {glmode= GL_TRIANGLES; glEnd(); glBegin(GL_TRIANGLES);}} - glVertex3fv( (mvert+mface->v1)->co ); - glVertex3fv( (mvert+mface->v2)->co ); - glVertex3fv( (mvert+mface->v3)->co ); - if(mface->v4) glVertex3fv( (mvert+mface->v4)->co ); + if(extverts) { + glVertex3fv( extverts+3*mface->v1 ); + glVertex3fv( extverts+3*mface->v2 ); + glVertex3fv( extverts+3*mface->v3 ); + if(mface->v4) glVertex3fv( extverts+3*mface->v4 ); + } + else { + glVertex3fv( (mvert+mface->v1)->co ); + glVertex3fv( (mvert+mface->v2)->co ); + glVertex3fv( (mvert+mface->v3)->co ); + if(mface->v4) glVertex3fv( (mvert+mface->v4)->co ); + } } } glEnd(); diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 12ca7ad92c8..f24d5e6f1c6 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -110,9 +110,6 @@ int *indexar= NULL; int totwpaintundo; MDeformVert *wpaintundobuf=NULL; -/* Function prototypes */ -int calc_vp_alpha_dl(DispList *disp, MVert *mvert, int vert, short *mval); - /* in contradiction to cpack drawing colors, the MCOL colors (vpaint colors) are per byte! so not endian sensitive. Mcol = ABGR!!! so be cautious with cpack calls */ @@ -690,7 +687,7 @@ static int calc_vp_alpha(MVert *mvert, short *mval) } -int calc_vp_alpha_dl(DispList *disp, MVert *mvert, int vert, short *mval) +static int calc_vp_alpha_dl(DispList *disp, MVert *mvert, int vert, short *mval) /* Lets us do soft vertex painting onto a deformed mesh */ { float fac, dx, dy, nor[3]; @@ -943,6 +940,7 @@ void vertex_paint() Mesh *me; MFace *mface; TFace *tface; + DispList *dl; float mat[4][4], imat[4][4]; unsigned int paintcol=0, *mcol, fcol1, fcol2; int index, alpha, totindex, total; @@ -1031,6 +1029,8 @@ void vertex_paint() } } + dl= find_displist(&ob->disp, DL_VERTS); + for(index=0; index<totindex; index++) { if(indexar[index] && indexar[index]<=me->totface) { @@ -1052,17 +1052,17 @@ void vertex_paint() total= 0; - total+= alpha= calc_vp_alpha(me->mvert+mface->v1, mval); + total+= alpha= calc_vp_alpha_dl(dl, me->mvert, mface->v1, mval); if(alpha) vpaint_blend( mcol, paintcol, alpha); - total+= alpha= calc_vp_alpha(me->mvert+mface->v2, mval); + total+= alpha= calc_vp_alpha_dl(dl, me->mvert, mface->v2, mval); if(alpha) vpaint_blend( mcol+1, paintcol, alpha); - total+= alpha= calc_vp_alpha(me->mvert+mface->v3, mval); + total+= alpha= calc_vp_alpha_dl(dl, me->mvert, mface->v3, mval); if(alpha) vpaint_blend( mcol+2, paintcol, alpha); if(mface->v4) { - total+= alpha= calc_vp_alpha(me->mvert+mface->v4, mval); + total+= alpha= calc_vp_alpha_dl(dl, me->mvert, mface->v4, mval); if(alpha) vpaint_blend( mcol+3, paintcol, alpha); } |