From 92aa15805d38810ace8cb5d2210a56abaef32ed0 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 23 Jan 2012 17:17:08 +0000 Subject: BMesh: Fix for previous own fix (re-enable DynamicPaint previews in Object mode). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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… --- source/blender/blenkernel/intern/dynamicpaint.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/blenkernel/intern/dynamicpaint.c') diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 9e30003f9c7..59b7b654a45 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1608,6 +1608,13 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData 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); -- cgit v1.2.3