diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-22 01:44:12 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-22 01:44:12 +0300 |
commit | 7e031b7a39f8cf1b8bf9d415449f177e7991e9bd (patch) | |
tree | 2b377b809a44d80a8f3d2f47d7c8d86218f7f75b | |
parent | 4e8f06604fa2d3f300968151021ac937409a103e (diff) |
Correction on BGE fixes:
- check that an object has been created before setting the physics environment
- check that there is an active camera before using it
- when a camera is deleted, remove it from m_cameras list
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 5 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 5a7423e00b1..743aabcd821 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1670,7 +1670,8 @@ static KX_GameObject *gameobject_from_blenderobject( break; } } - gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment()); + if (gameobj) + gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment()); return gameobj; } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index b879dd2ebee..03ad5109adc 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -617,7 +617,7 @@ void KX_KetsjiEngine::Render() SetWorldSettings(scene->GetWorldInfo()); // Avoid drawing the scene with the active camera twice when it's viewport is enabled - if(!cam->GetViewport()) + if(cam && !cam->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -854,6 +854,9 @@ void KX_KetsjiEngine::SetupRenderFrame(KX_Scene *scene, KX_Camera* cam) RAS_Rect viewport; + if (!cam) + return; + if (cam->GetViewport()) { viewport.SetLeft(cam->GetViewportLeft()); viewport.SetBottom(cam->GetViewportBottom()); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 526f893df5a..2d86e23f5ce 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -794,6 +794,9 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) //m_active_camera->Release(); m_active_camera = NULL; } + // in case this is a camera + m_cameras.remove((KX_Camera*)newobj); + if (m_sceneConverter) m_sceneConverter->UnregisterGameObject(newobj); // return value will be 0 if the object is actually deleted (all reference gone) @@ -942,6 +945,7 @@ void KX_Scene::AddCamera(KX_Camera* cam) m_cameras.push_back(cam); } + KX_Camera* KX_Scene::GetActiveCamera() { // NULL if not defined |