diff options
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 7 |
2 files changed, 30 insertions, 29 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 14772cda113..f76580cd44d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1734,18 +1734,17 @@ void KX_KetsjiEngine::AddScheduledScenes() bool KX_KetsjiEngine::ReplaceScene(const STR_String& oldscene,const STR_String& newscene) { - // Don't allow replacement if the new scene doesn't exists. - // Allows smarter game design (used to have no check here). - // Note that it creates a small backward compatbility issue - // for a game that did a replace followed by a lib load with the - // new scene in the lib => it won't work anymore, the lib - // must be loaded before doing the replace. - if (m_sceneconverter->GetBlenderSceneForName(newscene) != NULL) - { - m_replace_scenes.push_back(std::make_pair(oldscene,newscene)); - return true; - } - return false; + // Don't allow replacement if the new scene doesn't exists. + // Allows smarter game design (used to have no check here). + // Note that it creates a small backward compatbility issue + // for a game that did a replace followed by a lib load with the + // new scene in the lib => it won't work anymore, the lib + // must be loaded before doing the replace. + if (m_sceneconverter->GetBlenderSceneForName(newscene) != NULL) { + m_replace_scenes.push_back(std::make_pair(oldscene,newscene)); + return true; + } + return false; } // replace scene is not the same as removing and adding because the @@ -1767,21 +1766,20 @@ void KX_KetsjiEngine::ReplaceScheduledScenes() int i=0; /* Scenes are not supposed to be included twice... I think */ KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - if (scene->GetName() == oldscenename) - { - // avoid crash if the new scene doesn't exist, just do nothing - Scene *blScene = m_sceneconverter->GetBlenderSceneForName(newscenename); - if (blScene) { - m_sceneconverter->RemoveScene(scene); - KX_Scene* tmpscene = CreateScene(blScene); - m_scenes[i]=tmpscene; - PostProcessScene(tmpscene); - } else { - printf("warning: scene %s could not be found, not replaced!\n",newscenename.ReadPtr()); - } + for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) { + KX_Scene* scene = *sceneit; + if (scene->GetName() == oldscenename) { + // avoid crash if the new scene doesn't exist, just do nothing + Scene *blScene = m_sceneconverter->GetBlenderSceneForName(newscenename); + if (blScene) { + m_sceneconverter->RemoveScene(scene); + KX_Scene* tmpscene = CreateScene(blScene); + m_scenes[i]=tmpscene; + PostProcessScene(tmpscene); + } + else { + printf("warning: scene %s could not be found, not replaced!\n",newscenename.ReadPtr()); + } } i++; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 625bbee2c8e..d0eab9de1c1 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1577,7 +1577,7 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj) static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(threadid)) { - KX_GameObject *gameobj, *child; + KX_GameObject *gameobj, *child, *parent; CListValue *children; bool needs_update; double curtime = *(double*)BLI_task_pool_userdata(pool); @@ -1621,8 +1621,11 @@ static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(t if (needs_update) { gameobj->UpdateActionManager(curtime); children = gameobj->GetChildren(); + parent = gameobj->GetParent(); - if (!gameobj->GetParent() && gameobj->GetDeformer()) + // Only do deformers here if they are not parented to an armature, otherwise the armature will + // handle updating its children + if (gameobj->GetDeformer() && (!parent || (parent && parent->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE))) gameobj->GetDeformer()->Update(); for (int j=0; j<children->GetCount(); ++j) { |