bool BL_ShapeDeformer::ExecuteShapeDrivers(void) { if (!m_shapeDrivers.empty() && PoseUpdated()) { vector<IpoCurve*>::iterator it; // void *poin; // int type; // the shape drivers use the bone matrix as input. Must // update the matrix now m_armobj->ApplyPose(); for (it=m_shapeDrivers.begin(); it!=m_shapeDrivers.end(); it++) { // no need to set a specific time: this curve has a driver // XXX IpoCurve *icu = *it; //calc_icu(icu, 1.0f); //poin = get_ipo_poin((ID*)m_bmesh->key, icu, &type); //if (poin) // write_ipo_poin(poin, type, icu->curval); } ForceUpdate(); m_armobj->RestorePose(); m_bDynamic = true; return true; } return false; }
//void where_is_pose (Object *ob); //void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag); bool BL_SkinDeformer::UpdateInternal(bool shape_applied) { /* See if the armature has been updated for this frame */ if (PoseUpdated()) { float obmat[4][4]; // the original object matrice /* XXX note: where_is_pose() (from BKE_armature.h) calculates all matrices needed to start deforming */ /* but it requires the blender object pointer... */ Object* par_arma = m_armobj->GetArmatureObject(); 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(); // save matrix first Mat4CpyMat4(obmat, m_objMesh->obmat); // set reference matrix Mat4CpyMat4(m_objMesh->obmat, m_obmat); armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL ); // restore matrix Mat4CpyMat4(m_objMesh->obmat, obmat); #ifdef __NLA_DEFNORMALS if (m_recalcNormal) RecalcNormals(); #endif /* Update the current frame */ m_lastArmaUpdate=m_armobj->GetLastFrame(); m_armobj->RestorePose(); /* dynamic vertex, cannot use display list */ m_bDynamic = true; /* indicate that the m_transverts and normals are up to date */ return true; } return false; }
bool BL_ShapeDeformer::ExecuteShapeDrivers(void) { if (m_useShapeDrivers && PoseUpdated()) { // the shape drivers use the bone matrix as input. Must // update the matrix now m_armobj->ApplyPose(); // We don't need an actual time, just use 0 BKE_animsys_evaluate_animdata(NULL, &GetKey()->id, GetKey()->adt, 0.f, ADT_RECALC_DRIVERS); ForceUpdate(); m_armobj->RestorePose(); m_bDynamic = true; return true; } return false; }
bool BL_SkinDeformer::UpdateInternal(bool shape_applied) { /* See if the armature has been updated for this frame */ if (PoseUpdated()) { if (!shape_applied) { /* store verts locally */ VerifyStorage(); /* duplicate */ for (int v =0; v<m_bmesh->totvert; v++) { copy_v3_v3(m_transverts[v], m_bmesh->mvert[v].co); normal_short_to_float_v3(m_transnors[v], m_bmesh->mvert[v].no); } } m_armobj->ApplyPose(); switch (m_armobj->GetVertDeformType()) { case ARM_VDEF_BGE_CPU: BGEDeformVerts(); break; case ARM_VDEF_BLENDER: default: BlenderDeformVerts(); } /* Update the current frame */ m_lastArmaUpdate=m_armobj->GetLastFrame(); m_armobj->RestorePose(); /* dynamic vertex, cannot use display list */ m_bDynamic = true; /* indicate that the m_transverts and normals are up to date */ return true; } return false; }