Commit: 1a8b17661f61efc743f5e311afa8041015ed7dac Author: Mitchell Stokes Date: Fri May 2 00:08:00 2014 -0700 https://developer.blender.org/rB1a8b17661f61efc743f5e311afa8041015ed7dac
Fix T35552: LibLoading objects with Collision sensors gives an error The collision sensors were not being properly unregistered from the physics system before they were merged into the current scene. =================================================================== M source/gameengine/Ketsji/KX_Scene.cpp =================================================================== diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index b2dca14..5a33a61 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1864,7 +1864,7 @@ short KX_Scene::GetAnimationFPS() return m_blenderScene->r.frs_sec; } -static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) +static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *from, KX_Scene *to) { SCA_LogicManager *logicmgr= to->GetLogicManager(); @@ -1874,7 +1874,10 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) /* near sensors have physics controllers */ KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick); if (touch_sensor) { + KX_TouchEventManager *tmgr = (KX_TouchEventManager*)from->GetLogicManager()->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); + touch_sensor->UnregisterSumo(tmgr); touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); + touch_sensor->RegisterSumo(tmgr); } // If we end up replacing a KX_TouchEventManager, we need to make sure @@ -1912,7 +1915,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene for (ita = actuators.begin(); !(ita==actuators.end()); ++ita) { - MergeScene_LogicBrick(*ita, to); + MergeScene_LogicBrick(*ita, from, to); } } @@ -1923,7 +1926,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene for (its = sensors.begin(); !(its==sensors.end()); ++its) { - MergeScene_LogicBrick(*its, to); + MergeScene_LogicBrick(*its, from, to); } } @@ -1934,17 +1937,17 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene for (itc = controllers.begin(); !(itc==controllers.end()); ++itc) { SCA_IController *cont= *itc; - MergeScene_LogicBrick(cont, to); + MergeScene_LogicBrick(cont, from, to); vector<SCA_ISensor*> linkedsensors = cont->GetLinkedSensors(); vector<SCA_IActuator*> linkedactuators = cont->GetLinkedActuators(); for (vector<SCA_IActuator*>::iterator ita = linkedactuators.begin();!(ita==linkedactuators.end());++ita) { - MergeScene_LogicBrick(*ita, to); + MergeScene_LogicBrick(*ita, from, to); } for (vector<SCA_ISensor*>::iterator its = linkedsensors.begin();!(its==linkedsensors.end());++its) { - MergeScene_LogicBrick(*its, to); + MergeScene_LogicBrick(*its, from, to); } } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs