[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26673] trunk/blender/source/blender/ blenkernel/intern/subsurf_ccg.c: Fix #20887: multires sculpt normals not updated correct in solid

Brecht Van Lommel brecht at blender.org
Sun Feb 7 14:22:48 CET 2010


Revision: 26673
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26673
Author:   blendix
Date:     2010-02-07 14:22:46 +0100 (Sun, 07 Feb 2010)

Log Message:
-----------
Fix #20887: multires sculpt normals not updated correct in solid
textured draw mode.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c

Modified: trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c	2010-02-07 13:19:44 UTC (rev 26672)
+++ trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c	2010-02-07 13:22:46 UTC (rev 26673)
@@ -1220,6 +1220,21 @@
 	glNormal3fv(no);
 }
 
+static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
+{
+	if(ccgdm->pbvh) {
+		CCGFace **faces;
+		int totface;
+
+		BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
+		if(totface) {
+			ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
+			ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
+			MEM_freeN(faces);
+		}
+	}
+}
+
 	/* Only used by non-editmesh types */
 static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
@@ -1229,17 +1244,9 @@
 	char *faceFlags = ccgdm->faceFlags;
 	int step = (fast)? gridSize-1: 1;
 
+	ccgdm_pbvh_update(ccgdm);
+
 	if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
-		CCGFace **faces;
-		int totface;
-
-		BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
-		if(totface) {
-			ccgSubSurf_updateFromFaces(ss, 0, faces, totface);
-			ccgSubSurf_updateNormals(ss, faces, totface);
-			MEM_freeN(faces);
-		}
-
 		if(dm->numFaceData) {
 			/* should be per face */
 			if(!setMaterial(faceFlags[1]+1, NULL))
@@ -1330,6 +1337,8 @@
 	char *faceFlags = ccgdm->faceFlags;
 	int a, b, i, doDraw, numVerts, matnr, new_matnr, totface;
 
+	ccgdm_pbvh_update(ccgdm);
+
 	doDraw = 0;
 	numVerts = 0;
 	matnr = -1;
@@ -1484,6 +1493,8 @@
 	unsigned char *cp1, *cp2;
 	int useTwoSide=1;
 
+	ccgdm_pbvh_update(ccgdm);
+
 	cp1= col1;
 	if(col2) {
 		cp2= col2;
@@ -1554,6 +1565,8 @@
 	int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss);
 	int gridFaces = gridSize - 1;
 
+	ccgdm_pbvh_update(ccgdm);
+
 	if(!mcol)
 		mcol = dm->getFaceDataArray(dm, CD_MCOL);
 





More information about the Bf-blender-cvs mailing list