[Bf-blender-cvs] [84696d3] fracture_modifier: fix: forgot to accumulate differences of multiple hook modifier changes
Martin Felke
noreply at git.blender.org
Wed Jan 27 22:08:56 CET 2016
Commit: 84696d3c752ecb543d1ea668feaed827e8020f29
Author: Martin Felke
Date: Wed Jan 27 21:58:08 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rB84696d3c752ecb543d1ea668feaed827e8020f29
fix: forgot to accumulate differences of multiple hook modifier changes
===================================================================
M source/blender/blenkernel/intern/rigidbody.c
===================================================================
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 7896b72..eb82929 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -3767,6 +3767,8 @@ static void rigidbody_passive_hook(FractureModifierData *fmd, MeshIsland *mi, Ob
if (dm)
{
int totvert = dm->getNumVerts(dm);
+ float acc[3];
+ dm->getVertCo(dm, mi->vertex_indices[0], acc);
for (md = ob->modifiers.first; md; md = md->next)
{
@@ -3781,7 +3783,7 @@ static void rigidbody_passive_hook(FractureModifierData *fmd, MeshIsland *mi, Ob
//only eval following hookmodifiers, based on our derivedmesh
if (md->type == eModifierType_Hook && found)
{
- float (*vertexCos)[3];
+ float (*vertexCos)[3], old[3], diff[3];
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
HookModifierData *hmd = (HookModifierData*)md;
@@ -3791,13 +3793,17 @@ static void rigidbody_passive_hook(FractureModifierData *fmd, MeshIsland *mi, Ob
vertexCos = MEM_callocN(sizeof(float) * 3 * totvert, "Vertex Cos");
dm->getVertCos(dm, vertexCos);
+ copy_v3_v3(old, vertexCos[mi->vertex_indices[0]]);
mti->deformVerts(md, ob, dm, vertexCos, totvert, 0);
- rigidbody_passive_fake_hook(mi, vertexCos[mi->vertex_indices[0]]);
+ sub_v3_v3v3(diff, vertexCos[mi->vertex_indices[0]], old);
+ add_v3_v3(acc, diff);
MEM_freeN(vertexCos);
}
}
+
+ rigidbody_passive_fake_hook(mi, acc);
}
}
}
More information about the Bf-blender-cvs
mailing list