diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-26 21:03:30 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-26 21:03:30 +0400 |
commit | 5d49eff25a7e9425def74b175836ea6302113d90 (patch) | |
tree | 362fe401a4e4d4f96232e7d4cb482efccd074d31 /source/blender/modifiers/intern/MOD_cloth.c | |
parent | de5d5ded7bf34f6f28027f173f781f058287f058 (diff) |
Fix #29957: Texture "Generate" mapping work as global with cloth modifier
Make Cloth modifier deformation only so now it applies on orco dm properly.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_cloth.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_cloth.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 6c9bbd11e9c..7e46d3f0fe3 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -67,11 +67,10 @@ static void initData(ModifierData *md) cloth_init (clmd); } -static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *dm, - int UNUSED(useRenderParams), - int UNUSED(isFinalCalc)) +static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], + int UNUSED(numVerts), int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { + DerivedMesh *dm; ClothModifierData *clmd = (ClothModifierData*) md; DerivedMesh *result=NULL; @@ -79,19 +78,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if(!clmd->sim_parms || !clmd->coll_parms) { initData(md); - + if(!clmd->sim_parms || !clmd->coll_parms) - return dm; + return; } - result = clothModifier_do(clmd, md->scene, ob, dm); + dm = get_dm(ob, NULL, derivedData, NULL, 0); - if(result) - { - CDDM_calc_normals(result); - return result; + clothModifier_do(clmd, md->scene, ob, dm, vertexCos); + + if(result) { + result->getVertCos(result, vertexCos); + result->release(result); } - return dm; + + if(dm != derivedData) + dm->release(dm); } static void updateDepgraph( @@ -206,17 +208,17 @@ ModifierTypeInfo modifierType_Cloth = { /* name */ "Cloth", /* structName */ "ClothModifierData", /* structSize */ sizeof(ClothModifierData), - /* type */ eModifierTypeType_Nonconstructive, + /* type */ eModifierTypeType_OnlyDeform, /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_UsesPointCache | eModifierTypeFlag_Single, /* copyData */ copyData, - /* deformVerts */ NULL, + /* deformVerts */ deformVerts, /* deformMatrices */ NULL, /* deformVertsEM */ NULL, /* deformMatricesEM */ NULL, - /* applyModifier */ applyModifier, + /* applyModifier */ NULL, /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, |