Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_cloth.c')
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 6c9bbd11e9c..fdb584ec592 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,25 @@ 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(dm == derivedData)
+ dm = CDDM_copy(dm);
- if(result)
- {
- CDDM_calc_normals(result);
- return result;
+ CDDM_apply_vert_coords(dm, vertexCos);
+
+ clothModifier_do(clmd, md->scene, ob, dm, vertexCos);
+
+ if(result) {
+ result->getVertCos(result, vertexCos);
+ result->release(result);
}
- return dm;
+
+ dm->release(dm);
}
static void updateDepgraph(
@@ -206,17 +211,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,