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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-06-18 15:04:30 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-06-18 15:04:30 +0400
commit00b742cf2079456e48c1c7f706fce4cf91ba016c (patch)
tree533a32e63c6f5d7c425952d50a7af933d2de7317 /source/gameengine/Converter
parentdc8776cafb7dda6e77d4295f60a013b8598b7a4f (diff)
Apricot Branch: svn merge -r 15249:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender/
(game engine shape keys!)
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp37
-rw-r--r--source/gameengine/Converter/BL_DeformableGameObject.cpp47
-rw-r--r--source/gameengine/Converter/BL_DeformableGameObject.h40
-rw-r--r--source/gameengine/Converter/BL_MeshDeformer.cpp2
-rw-r--r--source/gameengine/Converter/BL_MeshDeformer.h4
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.cpp50
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.h35
-rw-r--r--source/gameengine/Converter/BL_SkinMeshObject.cpp58
-rw-r--r--source/gameengine/Converter/BL_SkinMeshObject.h36
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp25
10 files changed, 280 insertions, 54 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 3c76c63544b..be3f40f18fe 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -90,6 +90,7 @@
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BL_SkinMeshObject.h"
+#include "BL_ShapeDeformer.h"
#include "BL_SkinDeformer.h"
#include "BL_MeshDeformer.h"
//#include "BL_ArmatureController.h"
@@ -223,15 +224,16 @@ static unsigned int KX_Mcol2uint_new(MCol col)
static void SetDefaultFaceType(Scene* scene)
{
default_face_mode = TF_DYNAMIC;
- Base *base = static_cast<Base*>(scene->base.first);
- while(base)
+ Scene *sce;
+ Base *base;
+
+ for(SETLOOPER(scene,base))
{
if (base->object->type == OB_LAMP)
{
default_face_mode = TF_DYNAMIC|TF_LIGHT;
return;
}
- base = base->next;
}
}
@@ -805,12 +807,12 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
// Determine if we need to make a skinned mesh
- if (mesh->dvert){
- meshobj = new BL_SkinMeshObject(lightlayer);
+ if (mesh->dvert || mesh->key){
+ meshobj = new BL_SkinMeshObject(mesh, lightlayer);
skinMesh = true;
}
else {
- meshobj = new RAS_MeshObject(lightlayer);
+ meshobj = new RAS_MeshObject(mesh, lightlayer);
}
MT_Vector4 *tangent = 0;
if (tface)
@@ -1650,7 +1652,7 @@ static KX_GameObject *gameobject_from_blenderobject(
// needed for python scripting
kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
- gameobj = new BL_DeformableGameObject(kxscene,KX_Scene::m_callbacks);
+ gameobj = new BL_DeformableGameObject(ob,kxscene,KX_Scene::m_callbacks);
// set transformation
gameobj->AddMesh(meshobj);
@@ -1661,12 +1663,24 @@ static KX_GameObject *gameobject_from_blenderobject(
((ob->gameflag2 & OB_NEVER_DO_ACTIVITY_CULLING)!=0);
gameobj->SetIgnoreActivityCulling(ignoreActivityCulling);
- // If this is a skin object, make Skin Controller
- if (ob->parent && ob->parent->type == OB_ARMATURE && ob->partype==PARSKEL && ((Mesh*)ob->data)->dvert){
+ // two options exists for deform: shape keys and armature
+ // only support relative shape key
+ bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE;
+ bool bHasDvert = mesh->dvert != NULL;
+ bool bHasArmature = (ob->parent && ob->parent->type == OB_ARMATURE && ob->partype==PARSKEL && bHasDvert);
+
+ if (bHasShapeKey) {
+ // not that we can have shape keys without dvert!
+ BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj,
+ ob, (BL_SkinMeshObject*)meshobj);
+ ((BL_DeformableGameObject*)gameobj)->m_pDeformer = dcont;
+ } else if (bHasArmature) {
BL_SkinDeformer *dcont = new BL_SkinDeformer(ob, (BL_SkinMeshObject*)meshobj );
((BL_DeformableGameObject*)gameobj)->m_pDeformer = dcont;
- }
- else if (((Mesh*)ob->data)->dvert){
+ } else if (bHasDvert) {
+ // this case correspond to a mesh that can potentially deform but not with the
+ // object to which it is attached for the moment. A skin mesh was created in
+ // BL_ConvertMesh() so must create a deformer too!
BL_MeshDeformer *dcont = new BL_MeshDeformer(ob, (BL_SkinMeshObject*)meshobj );
((BL_DeformableGameObject*)gameobj)->m_pDeformer = dcont;
}
@@ -1702,6 +1716,7 @@ static KX_GameObject *gameobject_from_blenderobject(
{
gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment());
gameobj->SetLayer(ob->lay);
+ gameobj->SetBlenderObject(ob);
}
return gameobj;
}
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp
index 68a2e41ca47..d23274324ee 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.cpp
+++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp
@@ -28,6 +28,8 @@
*/
#include "BL_DeformableGameObject.h"
+#include "BL_ShapeDeformer.h"
+#include "BL_ShapeActionActuator.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -60,3 +62,48 @@ CValue* BL_DeformableGameObject::GetReplica()
ProcessReplica(replica);
return replica;
}
+
+bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short priority, double curtime)
+{
+ if (curtime != m_lastframe){
+ m_activePriority = 9999;
+ m_lastframe= curtime;
+ m_activeAct = NULL;
+ }
+
+ if (priority<=m_activePriority)
+ {
+ if (m_activeAct && (m_activeAct!=act))
+ m_activeAct->SetBlendTime(0.0f); /* Reset the blend timer */
+ m_activeAct = act;
+ m_activePriority = priority;
+ m_lastframe = curtime;
+
+ return true;
+ }
+ else{
+ act->SetBlendTime(0.0f);
+ return false;
+ }
+}
+
+bool BL_DeformableGameObject::GetShape(vector<float> &shape)
+{
+ shape.clear();
+ if (m_pDeformer)
+ {
+ Mesh* mesh = ((BL_MeshDeformer*)m_pDeformer)->GetMesh();
+ // this check is normally superfluous: a shape deformer can only be created if the mesh
+ // has relative keys
+ if (mesh && mesh->key && mesh->key->type==KEY_RELATIVE)
+ {
+ KeyBlock *kb;
+ for (kb = (KeyBlock*)mesh->key->block.first; kb; kb = (KeyBlock*)kb->next)
+ {
+ shape.push_back(kb->curval);
+ }
+ }
+ }
+ return !shape.empty();
+}
+
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h
index d943cc7388a..57a404ad72b 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.h
+++ b/source/gameengine/Converter/BL_DeformableGameObject.h
@@ -34,15 +34,28 @@
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
#endif //WIN32
+#include "DNA_mesh_types.h"
#include "KX_GameObject.h"
-#include "RAS_Deformer.h"
+#include "BL_MeshDeformer.h"
+#include <vector>
+
+class BL_ShapeActionActuator;
+struct Key;
class BL_DeformableGameObject : public KX_GameObject
{
public:
- RAS_Deformer *m_pDeformer;
CValue* GetReplica();
+
+ double GetLastFrame ()
+ {
+ return m_lastframe;
+ }
+ Object* GetBlendObject()
+ {
+ return m_blendobj;
+ }
virtual void Relink(GEN_Map<GEN_HashedPtr, void*>*map)
{
if (m_pDeformer)
@@ -50,13 +63,32 @@ public:
};
void ProcessReplica(KX_GameObject* replica);
- BL_DeformableGameObject(void* sgReplicationInfo, SG_Callbacks callbacks) :
+ BL_DeformableGameObject(Object* blendobj, void* sgReplicationInfo, SG_Callbacks callbacks) :
KX_GameObject(sgReplicationInfo,callbacks),
- m_pDeformer(NULL)
+ m_pDeformer(NULL),
+ m_activeAct(NULL),
+ m_lastframe(0.),
+ m_blendobj(blendobj),
+ m_activePriority(9999)
{
m_isDeformable = true;
};
virtual ~BL_DeformableGameObject();
+ bool SetActiveAction(class BL_ShapeActionActuator *act, short priority, double curtime);
+
+ bool GetShape(vector<float> &shape);
+ Key* GetKey()
+ {
+ return (m_pDeformer) ? ((BL_MeshDeformer*)m_pDeformer)->GetMesh()->key : NULL;
+ }
+
+public:
+ RAS_Deformer *m_pDeformer;
+protected:
+ class BL_ShapeActionActuator *m_activeAct;
+ double m_lastframe;
+ Object* m_blendobj;
+ short m_activePriority;
};
diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp
index 85ba894f9a5..212827a660f 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.cpp
+++ b/source/gameengine/Converter/BL_MeshDeformer.cpp
@@ -198,7 +198,7 @@ void BL_MeshDeformer::RecalcNormals()
void BL_MeshDeformer::VerifyStorage()
{
/* Ensure that we have the right number of verts assigned */
- if (m_tvtot!=m_bmesh->totvert+m_bmesh->totface) {
+ if (m_tvtot!=m_bmesh->totvert){
if (m_transverts)
delete [] m_transverts;
if (m_transnors)
diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h
index 88dc2500859..8d8b56b1eed 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.h
+++ b/source/gameengine/Converter/BL_MeshDeformer.h
@@ -32,6 +32,7 @@
#include "RAS_Deformer.h"
#include "DNA_object_types.h"
+#include "DNA_key_types.h"
#include "MT_Point3.h"
#include <stdlib.h>
@@ -56,8 +57,9 @@ public:
virtual ~BL_MeshDeformer();
virtual void SetSimulatedTime(double time){};
virtual bool Apply(class RAS_IPolyMaterial *mat);
- virtual void Update(void){};
+ virtual bool Update(void){ return false; };
virtual RAS_Deformer* GetReplica(){return NULL;};
+ struct Mesh* GetMesh() { return m_bmesh; };
// virtual void InitDeform(double time){};
protected:
class BL_SkinMeshObject* m_pMeshObject;
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index 0f884674c09..78fc73f21a1 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -57,6 +57,19 @@ extern "C"{
#define __NLA_DEFNORMALS
//#undef __NLA_DEFNORMALS
+BL_SkinDeformer::BL_SkinDeformer(struct Object *bmeshobj,
+ class BL_SkinMeshObject *mesh,
+ BL_ArmatureObject* arma)
+ : //
+ BL_MeshDeformer(bmeshobj, mesh),
+ m_armobj(arma),
+ m_lastArmaUpdate(-1),
+ m_defbase(&bmeshobj->defbase),
+ m_releaseobject(false)
+{
+ Mat4CpyMat4(m_obmat, bmeshobj->obmat);
+};
+
BL_SkinDeformer::BL_SkinDeformer(
struct Object *bmeshobj_old, // Blender object that owns the new mesh
struct Object *bmeshobj_new, // Blender object that owns the original mesh
@@ -65,25 +78,22 @@ BL_SkinDeformer::BL_SkinDeformer(
BL_ArmatureObject* arma) :
BL_MeshDeformer(bmeshobj_old, mesh),
m_armobj(arma),
- m_lastUpdate(-1),
+ m_lastArmaUpdate(-1),
m_defbase(&bmeshobj_old->defbase),
m_releaseobject(release_object)
{
- Mat4CpyMat4(m_obmat, bmeshobj_old->obmat);
- m_restoremat = true;
// this is needed to ensure correct deformation of mesh:
// the deformation is done with Blender's armature_deform_verts() function
// that takes an object as parameter and not a mesh. The object matrice is used
- // in the calculation, so we must force the same matrice to simulate a pure replacement of mesh
- Mat4CpyMat4(bmeshobj_old->obmat, bmeshobj_new->obmat);
+ // in the calculation, so we must use the matrix of the original object to
+ // simulate a pure replacement of the mesh.
+ Mat4CpyMat4(m_obmat, bmeshobj_new->obmat);
}
BL_SkinDeformer::~BL_SkinDeformer()
{
if(m_releaseobject && m_armobj)
m_armobj->Release();
- if (m_restoremat)
- Mat4CpyMat4(m_objMesh->obmat, m_obmat);
}
bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
@@ -98,15 +108,13 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
MT_Point3 pt;
// float co[3];
- if (!m_armobj)
+ if (!Update())
+ // no need to update the cache
return false;
- Update();
-
array = m_pMeshObject->GetVertexCache(mat);
mvarray = m_pMeshObject->GetMVertCache(mat);
diarray = m_pMeshObject->GetDIndexCache(mat);
-
// For each array
for (i=0; i<array.size(); i++) {
// For each vertex
@@ -140,10 +148,11 @@ 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);
-void BL_SkinDeformer::Update(void)
+bool BL_SkinDeformer::Update(void)
{
/* See if the armature has been updated for this frame */
- if (m_lastUpdate!=m_armobj->GetLastFrame()){
+ if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()){
+ float obmat[4][4]; // the original object matrice
/* Do all of the posing necessary */
m_armobj->ApplyPose();
@@ -161,14 +170,27 @@ void BL_SkinDeformer::Update(void)
for (int v =0; v<m_bmesh->totvert; v++)
VECCOPY(m_transverts[v], m_bmesh->mvert[v].co);
+ // 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
RecalcNormals();
#endif
/* Update the current frame */
- m_lastUpdate=m_armobj->GetLastFrame();
+ m_lastArmaUpdate=m_armobj->GetLastFrame();
+
+ /* indicate that the m_transverts and normals are up to date */
+ return true;
}
+ return false;
}
/* XXX note: I propose to drop this function */
diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h
index 79f6453a25d..603e716fb1e 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.h
+++ b/source/gameengine/Converter/BL_SkinDeformer.h
@@ -52,27 +52,20 @@ public:
// void SetArmatureController (BL_ArmatureController *cont);
virtual void Relink(GEN_Map<class GEN_HashedPtr, void*>*map)
{
- void **h_obj = (*map)[m_armobj];
- if (h_obj){
- SetArmature( (BL_ArmatureObject*)(*h_obj) );
+ if (m_armobj){
+ void **h_obj = (*map)[m_armobj];
+ if (h_obj){
+ SetArmature( (BL_ArmatureObject*)(*h_obj) );
+ }
+ else
+ m_armobj=NULL;
}
- else
- m_armobj=NULL;
}
void SetArmature (class BL_ArmatureObject *armobj);
BL_SkinDeformer(struct Object *bmeshobj,
class BL_SkinMeshObject *mesh,
- BL_ArmatureObject* arma = NULL)
- : //
- BL_MeshDeformer(bmeshobj, mesh),
- m_armobj(arma),
- m_lastUpdate(-1),
- m_defbase(&bmeshobj->defbase),
- m_restoremat(false),
- m_releaseobject(false)
- {
- };
+ BL_ArmatureObject* arma = NULL);
/* this second constructor is needed for making a mesh deformable on the fly. */
BL_SkinDeformer(struct Object *bmeshobj_old,
@@ -84,16 +77,20 @@ public:
virtual void ProcessReplica();
virtual RAS_Deformer *GetReplica();
virtual ~BL_SkinDeformer();
- void Update (void);
+ bool Update (void);
bool Apply (class RAS_IPolyMaterial *polymat);
+ void ForceUpdate()
+ {
+ m_lastArmaUpdate = -1.0;
+ };
+
protected:
BL_ArmatureObject* m_armobj; // Our parent object
float m_time;
- double m_lastUpdate;
+ double m_lastArmaUpdate;
ListBase* m_defbase;
- float m_obmat[4][4]; // the original object matrice in case of dynamic mesh replacement
- bool m_restoremat;
+ float m_obmat[4][4]; // the reference matrix for skeleton deform
bool m_releaseobject;
};
diff --git a/source/gameengine/Converter/BL_SkinMeshObject.cpp b/source/gameengine/Converter/BL_SkinMeshObject.cpp
index 69feb72f5dc..49492923c7c 100644
--- a/source/gameengine/Converter/BL_SkinMeshObject.cpp
+++ b/source/gameengine/Converter/BL_SkinMeshObject.cpp
@@ -150,5 +150,63 @@ void BL_SkinMeshObject::Bucketize(double* oglmatrix,void* clientobj,bool useObje
}
+static int get_def_index(Object* ob, const char* vgroup)
+{
+ bDeformGroup *curdef;
+ int index = 0;
+
+ for (curdef = (bDeformGroup*)ob->defbase.first; curdef; curdef=(bDeformGroup*)curdef->next, index++)
+ if (!strcmp(curdef->name, vgroup))
+ return index;
+ return -1;
+}
+
+void BL_SkinMeshObject::CheckWeightCache(Object* obj)
+{
+ KeyBlock *kb;
+ int kbindex, defindex;
+ MDeformVert *dvert= NULL;
+ int totvert, i, j;
+ float *weights;
+
+ if (!m_mesh->key)
+ return;
+
+ for(kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++)
+ {
+ // first check the cases where the weight must be cleared
+ if (kb->vgroup[0] == 0 ||
+ m_mesh->dvert == NULL ||
+ (defindex = get_def_index(obj, kb->vgroup)) == -1) {
+ if (kb->weights) {
+ MEM_freeN(kb->weights);
+ kb->weights = NULL;
+ }
+ m_cacheWeightIndex[kbindex] = -1;
+ } else if (m_cacheWeightIndex[kbindex] != defindex) {
+ // a weight array is required but the cache is not matching
+ if (kb->weights) {
+ MEM_freeN(kb->weights);
+ kb->weights = NULL;
+ }
+
+ dvert= m_mesh->dvert;
+ totvert= m_mesh->totvert;
+
+ weights= (float*)MEM_callocN(totvert*sizeof(float), "weights");
+
+ for (i=0; i < totvert; i++, dvert++) {
+ for(j=0; j<dvert->totweight; j++) {
+ if (dvert->dw[j].def_nr == defindex) {
+ weights[i]= dvert->dw[j].weight;
+ break;
+ }
+ }
+ }
+ kb->weights = weights;
+ m_cacheWeightIndex[kbindex] = defindex;
+ }
+ }
+}
diff --git a/source/gameengine/Converter/BL_SkinMeshObject.h b/source/gameengine/Converter/BL_SkinMeshObject.h
index 2422d4cd4c9..cc2b8de600e 100644
--- a/source/gameengine/Converter/BL_SkinMeshObject.h
+++ b/source/gameengine/Converter/BL_SkinMeshObject.h
@@ -33,7 +33,7 @@
#ifdef WIN32
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
#endif //WIN32
-
+#include "MEM_guardedalloc.h"
#include "RAS_MeshObject.h"
#include "RAS_Deformer.h"
#include "RAS_IPolygonMaterial.h"
@@ -41,6 +41,7 @@
#include "BL_MeshDeformer.h"
#include "DNA_mesh_types.h"
+#include "DNA_key_types.h"
#include "DNA_meshdata_types.h"
typedef vector<struct MVert*> BL_MVertArray;
@@ -105,6 +106,8 @@ class BL_SkinMeshObject : public RAS_MeshObject
}
protected:
+ vector<int> m_cacheWeightIndex;
+
public:
struct BL_MDVertMap { RAS_IPolyMaterial *mat; int index; };
vector<vector<BL_MDVertMap> > m_mvert_to_dvert_mapping;
@@ -113,10 +116,33 @@ public:
// void Bucketize(double* oglmatrix,void* clientobj,bool useObjectColor,const MT_Vector4& rgbavec,class RAS_BucketManager* bucketmgr);
int FindVertexArray(int numverts,RAS_IPolyMaterial* polymat);
- BL_SkinMeshObject(int lightlayer) : RAS_MeshObject (lightlayer)
- { m_class = 1;};
+ BL_SkinMeshObject(Mesh* mesh, int lightlayer) : RAS_MeshObject (mesh, lightlayer)
+ {
+ m_class = 1;
+ if (m_mesh && m_mesh->key)
+ {
+ KeyBlock *kb;
+ int count=0;
+ // initialize weight cache for shape objects
+ // count how many keys in this mesh
+ for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next)
+ count++;
+ m_cacheWeightIndex.resize(count,-1);
+ }
+ };
- virtual ~BL_SkinMeshObject(){
+ virtual ~BL_SkinMeshObject()
+ {
+ if (m_mesh && m_mesh->key)
+ {
+ KeyBlock *kb;
+ // remove the weight cache to avoid memory leak
+ for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) {
+ if(kb->weights)
+ MEM_freeN(kb->weights);
+ kb->weights= NULL;
+ }
+ }
};
const vecIndexArrays& GetDIndexCache (RAS_IPolyMaterial* mat)
@@ -154,6 +180,8 @@ public:
return index;
}
+ // for shape keys,
+ void CheckWeightCache(struct Object* obj);
};
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 6b594e2e70b..f219c3a1472 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -84,6 +84,7 @@
#include "DNA_actuator_types.h"
#include "DNA_packedFile_types.h"
#include "BL_ActionActuator.h"
+#include "BL_ShapeActionActuator.h"
/* end of blender include block */
#include "BL_BlenderDataConversion.h"
@@ -195,6 +196,30 @@ void BL_ConvertActuators(char* maggiename,
else
printf ("Discarded action actuator from non-armature object [%s]\n", blenderobject->id.name+2);
}
+ case ACT_SHAPEACTION:
+ {
+ if (blenderobject->type==OB_MESH){
+ bActionActuator* actact = (bActionActuator*) bact->data;
+ STR_String propname = (actact->name ? actact->name : "");
+
+ BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
+ gameobj,
+ propname,
+ actact->sta,
+ actact->end,
+ actact->act,
+ actact->type, // + 1, because Blender starts to count at zero,
+ actact->blendin,
+ actact->priority,
+ actact->stridelength
+ // Ketsji at 1, because zero is reserved for "NoDef"
+ );
+ baseact= tmpbaseact;
+ break;
+ }
+ else
+ printf ("Discarded shape action actuator from non-mesh object [%s]\n", blenderobject->id.name+2);
+ }
case ACT_IPO:
{
bIpoActuator* ipoact = (bIpoActuator*) bact->data;