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:
authorMitchell Stokes <mogurijin@gmail.com>2014-04-10 03:19:13 +0400
committerMitchell Stokes <mogurijin@gmail.com>2014-04-10 03:22:55 +0400
commit19413644dac0f56623c520c5da2039ed0294c220 (patch)
tree1e656fa91ae7396d474159f9f3e4bf8fe34a741f /source/gameengine
parentc3fefebe47b33bfa1debb9425c8f0411a87bc5fd (diff)
BGE: Fixing a crash when animating objects with modifiers and armatures.
Our deformer system really needs some work. First, there was a crash with shape keys because BL_ModifierDeformer derives from BL_ShapeDeformer, which means we try to execute shape keys even if we do not have them. Also, for some reason BL_ModifierDeformer::Update() does not work if called from the threaded loop, so it is skipped for now. In other words, skinned updates on meshes with modifiers are currently not run in parallel.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp9
2 files changed, 14 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index 43f719d80c4..8bb9f850bcf 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -122,6 +122,12 @@ void BL_ShapeDeformer::ProcessReplica()
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) {
BL_ArmatureObject *arma = (BL_ArmatureObject*)parent;
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index fbd9eeba8ed..e125dec860e 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1601,6 +1601,7 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj)
static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(threadid))
{
KX_GameObject *gameobj, *child;
+ RAS_Deformer *deformer;
CListValue *children;
bool needs_update;
double curtime = *(double*)BLI_task_pool_userdata(pool);
@@ -1648,8 +1649,14 @@ static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(t
for (int j=0; j<children->GetCount(); ++j) {
child = (KX_GameObject*)children->GetValue(j);
- if (child->GetDeformer())
+ deformer = child->GetDeformer();
+
+ // This check is ugly, but the modifier deformer currently doesn't
+ // work if called from here. This is a quick work-around to prevent
+ // crashing, but it really should be fixed.
+ if (deformer && !dynamic_cast<BL_ModifierDeformer*>(deformer)) {
child->GetDeformer()->Update();
+ }
}
children->Release();