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/gameengine/Converter/BL_ShapeDeformer.cpp')
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index ca5b26079b1..5e31dabfab1 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -51,6 +51,7 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_key.h"
+#include "BKE_fcurve.h"
#include "BKE_ipo.h"
#include "BKE_library.h"
#include "MT_Point3.h"
@@ -119,8 +120,35 @@ void BL_ShapeDeformer::ProcessReplica()
m_key = BKE_key_copy(m_key);
}
-bool BL_ShapeDeformer::LoadShapeDrivers(Object* arma)
+bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* parent)
{
+ // Only load shape drivers if we have a key
+ if (GetKey() == NULL) {
+ m_useShapeDrivers = false;
+ return false;
+ }
+
+ // Fix drivers since BL_ArmatureObject makes copies
+ if (parent->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE && GetKey()->adt) {
+ BL_ArmatureObject *arma = (BL_ArmatureObject*)parent;
+ FCurve *fcu;
+
+ for (fcu = (FCurve*)GetKey()->adt->drivers.first; fcu; fcu = (FCurve*)fcu->next) {
+
+ DriverVar *dvar;
+ for (dvar = (DriverVar*)fcu->driver->variables.first; dvar; dvar = (DriverVar*)dvar->next) {
+ DRIVER_TARGETS_USED_LOOPER(dvar)
+ {
+ if (dtar->id) {
+ if ((Object*)dtar->id == arma->GetOrigArmatureObject())
+ dtar->id = (ID*)arma->GetArmatureObject();
+ }
+ }
+ DRIVER_TARGETS_LOOPER_END
+ }
+ }
+ }
+
// This used to check if we had drivers from this armature,
// now we just assume we want to use shape drivers
// and let the animsys handle things.
@@ -132,15 +160,10 @@ bool BL_ShapeDeformer::LoadShapeDrivers(Object* arma)
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;
}
@@ -199,6 +222,9 @@ bool BL_ShapeDeformer::Update(void)
if (m_recalcNormal)
RecalcNormals();
#endif
+
+ // We also need to handle transverts now (used to be in BL_SkinDeformer::Apply())
+ UpdateTransverts();
bSkinUpdate = true;
}