From cdfffafd209e1b6178a6cd94372e892f7cf0653a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 20 Mar 2012 00:51:37 +0000 Subject: [PATCH] partial fix for bug where booleans were using invalid face/poly normals. the problem remains (though not quite as bad) but think this is because of a bug elsewhere. --- .../blender/modifiers/intern/MOD_boolean_util.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 3fd4119c915..04a2caf0cf8 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -354,9 +354,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( // create a new DerivedMesh result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0); - CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH, + CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~CD_MASK_NORMAL, CD_DEFAULT, face_it->num_elements); - CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH, + CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~CD_MASK_NORMAL, CD_DEFAULT, face_it->num_elements); // step through the vertex iterators: @@ -466,6 +466,17 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( CDDM_calc_edges_tessface(result); CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/ + + /* this fixes shading issues but SHOULD NOT. + * TODO, find out why face normals are wrong & flicker - campbell */ +#if 0 + DM_debug_print(result); + + CustomData_free(&result->faceData, result->numTessFaceData); + result->numTessFaceData = 0; + DM_ensure_tessface(result); +#endif + CDDM_calc_normals(result); return result;