Revision: 16085 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16085 Author: jaguarandi Date: 2008-08-13 22:18:56 +0200 (Wed, 13 Aug 2008)
Log Message: ----------- Fixed problem of "lack of normal information" Modified Paths: -------------- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/modifier.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c Modified: branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/modifier.c =================================================================== --- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/modifier.c 2008-08-13 19:22:35 UTC (rev 16084) +++ branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/modifier.c 2008-08-13 20:18:56 UTC (rev 16085) @@ -7285,21 +7285,50 @@ static void shrinkwrapModifier_deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, derivedData, vertexCos, numVerts); + DerivedMesh *dm = NULL; + CustomDataMask dataMask = shrinkwrapModifier_requiredDataMask(md); + + /* We implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData or without the modified vertexs applied */ + if(shrinkwrapModifier_requiredDataMask(md)) + { + if(derivedData) dm = CDDM_copy(derivedData); + else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob); + else return; + + if(dataMask & CD_MVERT) + { + CDDM_apply_vert_coords(dm, vertexCos); + CDDM_calc_normals(dm); + } + } + + shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts); + + if(dm) + dm->release(dm); } static void shrinkwrapModifier_deformVertsEM(ModifierData *md, Object *ob, EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm; + DerivedMesh *dm = NULL; + CustomDataMask dataMask = shrinkwrapModifier_requiredDataMask(md); - if(!derivedData && ob->type == OB_MESH) - dm = CDDM_from_editmesh(editData, ob->data); - else - dm = CDDM_copy(derivedData); //TODO: this is only needed if derevedData doenst supports getVertexArray + if(dataMask) + { + if(derivedData) dm = CDDM_copy(derivedData); + else if(ob->type==OB_MESH) dm = CDDM_from_editmesh(editData, ob); + else return; + if(dataMask & CD_MVERT) + { + CDDM_apply_vert_coords(dm, vertexCos); + CDDM_calc_normals(dm); + } + } + shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if(dm) dm->release(dm); } Modified: branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c =================================================================== --- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c 2008-08-13 19:22:35 UTC (rev 16084) +++ branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c 2008-08-13 20:18:56 UTC (rev 16085) @@ -364,7 +364,6 @@ if(calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) { vert = calc->original ? calc->original->getVertDataArray(calc->original, CD_MVERT) : NULL; - if(vert) CDDM_calc_normals(calc->original); //Maybe normals aren't yet calculated } else { _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs