From 8c0f96cde4e856030d4a2d30720dae23d7e714c2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 28 Aug 2007 09:30:46 +0000 Subject: Another fix for the editmode textured draw commit, subsurf vertex color drawing didn't work. --- source/blender/blenkernel/intern/subsurf_ccg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d30301dc1a4..ea2021430f1 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1744,7 +1744,6 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, char *faceFlags = DM_get_face_data_layer(dm, CD_FLAGS); int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss); int gridFaces = gridSize - 1; - unsigned char *cp; totface = ccgSubSurf_getNumFaces(ss); for(i = 0; i < totface; i++) { @@ -1752,6 +1751,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); int drawSmooth, index = ccgDM_getFaceMapIndex(ccgdm, ss, f); int origIndex = (int)ccgSubSurf_getFaceFaceHandle(ss, f); + unsigned char *cp= NULL; int mat_nr; if(faceFlags) { @@ -1775,7 +1775,10 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } /* flag 1 == use vertex colors */ - cp= (flag==1 && mcol)? (unsigned char*)&mcol[i*4]: NULL; + if(mcol) { + if(flag==1) cp= (unsigned char*)mcol; + mcol += gridFaces*gridFaces*numVerts*4; + } for (S=0; S