[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43641] branches/bmesh/blender/source/ blender/blenkernel/intern: BMesh: Fix for previous own fix ( re-enable DynamicPaint previews in Object mode).

Bastien Montagne montagne29 at wanadoo.fr
Mon Jan 23 18:17:16 CET 2012


Revision: 43641
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43641
Author:   mont29
Date:     2012-01-23 17:17:08 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
BMesh: Fix for previous own fix (re-enable DynamicPaint previews in Object mode).

In fact, we have to add a CD_WEIGHT_MCOL layer (if not yet present) when updating CD_WEIGHT_MLOOPCOL, else with modifiers modifying the topology (like subsurf), it will sigsev.

That step should probably be done at tesselation time, though?\226?\128?\166

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-01-23 16:46:35 UTC (rev 43640)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-01-23 17:17:08 UTC (rev 43641)
@@ -1062,8 +1062,7 @@
 	if (wtcol_f) {
 		unsigned char *wtcol_f_step = wtcol_f;
 # else
-	/* XXX Seems we still need to create a CD_WEIGHT_MCOL, else it sigsev...
-	 *     Strange that we do not have that problem with DPaint VCol preview? */
+	/* XXX We have to create a CD_WEIGHT_MCOL, else it might sigsev (after a SubSurf mod, eg)... */
 	if(!dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL))
 		CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
 

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c	2012-01-23 16:46:35 UTC (rev 43640)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c	2012-01-23 17:17:08 UTC (rev 43641)
@@ -1608,6 +1608,13 @@
 							MPoly *mp = CDDM_get_polys(result);
 							int totpoly = result->numPolyData;
 
+							/* XXX We have to create a CD_WEIGHT_MCOL, else it might sigsev
+							 *     (after a SubSurf mod, eg)... */
+							if(!result->getTessFaceDataArray(result, CD_WEIGHT_MCOL)) {
+								int numFaces = result->getNumTessFaces(result);
+								CustomData_add_layer(&result->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+							}
+
 							/* Save preview results to weight layer to be
 							*   able to share same drawing methods */
 							col = CustomData_get_layer(&result->loopData, CD_WEIGHT_MLOOPCOL);



More information about the Bf-blender-cvs mailing list