diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_ShapeDeformer.cpp | 19 | ||||
-rw-r--r-- | source/gameengine/Converter/BL_SkinDeformer.cpp | 21 | ||||
-rw-r--r-- | source/gameengine/Converter/BL_SkinDeformer.h | 1 |
3 files changed, 23 insertions, 18 deletions
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index 20ca7f07f2b..41ff3cc3274 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -148,10 +148,13 @@ bool BL_ShapeDeformer::Update(void) // make sure the vertex weight cache is in line with this object m_pMeshObject->CheckWeightCache(blendobj); - /* we will blend the key directly in mvert array: it is used by armature as the start position */ + /* we will blend the key directly in m_transverts array: it is used by armature as the start position */ /* m_bmesh->key can be NULL in case of Modifier deformer */ if (m_bmesh->key) { - do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)m_bmesh->mvert->co, m_bmesh->key, 0); + /* store verts locally */ + VerifyStorage(); + + do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, 0); m_bDynamic = true; } @@ -167,18 +170,12 @@ bool BL_ShapeDeformer::Update(void) bShapeUpdate = true; } // check for armature deform - bSkinUpdate = BL_SkinDeformer::Update(); + bSkinUpdate = BL_SkinDeformer::UpdateInternal(bShapeUpdate && m_bDynamic); // non dynamic deformer = Modifer without armature and shape keys, no need to create storage if (!bSkinUpdate && bShapeUpdate && m_bDynamic) { - // this means that there is no armature, we still need to copy the vertex to m_transverts - // and update the normal (was not done after shape key calculation) - - /* store verts locally */ - VerifyStorage(); - - for (int v =0; v<m_bmesh->totvert; v++) - VECCOPY(m_transverts[v], m_bmesh->mvert[v].co); + // this means that there is no armature, we still need to + // update the normal (was not done after shape key calculation) #ifdef __NLA_DEFNORMALS if (m_recalcNormal) diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index a13f78e1b27..f166a7252ad 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -172,7 +172,7 @@ void BL_SkinDeformer::ProcessReplica() //void where_is_pose (Object *ob); //void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag); -bool BL_SkinDeformer::Update(void) +bool BL_SkinDeformer::UpdateInternal(bool shape_applied) { /* See if the armature has been updated for this frame */ if (PoseUpdated()){ @@ -182,12 +182,14 @@ bool BL_SkinDeformer::Update(void) /* but it requires the blender object pointer... */ Object* par_arma = m_armobj->GetArmatureObject(); - /* store verts locally */ - VerifyStorage(); - - /* duplicate */ - for (int v =0; v<m_bmesh->totvert; v++) - VECCOPY(m_transverts[v], m_bmesh->mvert[v].co); + if(!shape_applied) { + /* store verts locally */ + VerifyStorage(); + + /* duplicate */ + for (int v =0; v<m_bmesh->totvert; v++) + VECCOPY(m_transverts[v], m_bmesh->mvert[v].co); + } m_armobj->ApplyPose(); @@ -219,6 +221,11 @@ bool BL_SkinDeformer::Update(void) return false; } +bool BL_SkinDeformer::Update(void) +{ + return UpdateInternal(false); +} + /* XXX note: I propose to drop this function */ void BL_SkinDeformer::SetArmature(BL_ArmatureObject *armobj) { diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h index b83895d5609..9c6f5db2b95 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.h +++ b/source/gameengine/Converter/BL_SkinDeformer.h @@ -72,6 +72,7 @@ public: virtual ~BL_SkinDeformer(); bool Update (void); + bool UpdateInternal (bool shape_applied); bool Apply (class RAS_IPolyMaterial *polymat); bool UpdateBuckets(void) { |