I'll break this commit into two sections in the moto files
[blender-staging.git] / source / gameengine / Converter / KX_BlenderSceneConverter.cpp
index a043291c5d5c7f2cda7aaf3fd867445a618b304c..283710a5d5b434db7542849583aa56ada31ebcad 100644 (file)
  */
 
 #ifdef WIN32
-
        #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
 #endif
 
-
 #include "KX_Scene.h"
 #include "KX_GameObject.h"
+#include "KX_BlenderSceneConverter.h"
 #include "KX_IpoConvert.h"
 #include "RAS_MeshObject.h"
 #include "KX_PhysicsEngineEnums.h"
@@ -114,6 +113,10 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
                delete (*itm);
                itm++;
        }
+       
+#ifdef USE_SUMO_SOLID
+       KX_ClearSumoSharedShapes();
+#endif
 }
 
 
@@ -174,110 +177,78 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
 
        if (blenderscene)
        {
-               int i=0;
-               
+       
                if (blenderscene->world)
                {
-                       
-                       switch (blenderscene->world->pad1)
+                       switch (blenderscene->world->physicsEngine)
                        {
-                               
-                       case 1:
-                               {
-                                       physics_engine = UseNone;
-                                       break;
-                               };
-                       case 2:
+                                
+                               case WOPHY_ODE:
                                {
-                                       physics_engine = UseSumo;
+                                       physics_engine = UseODE;
                                        break;
                                }
-                       case 3:
+                               case WOPHY_DYNAMO:
                                {
-                                       physics_engine = UseODE;
+                                       physics_engine = UseDynamo;
                                        break;
                                }
-                       case 4:
+                               case WOPHY_SUMO:
                                {
-                                       physics_engine = UseDynamo;
+                                       physics_engine = UseSumo;
                                        break;
                                }
-                       default:
+                               case WOPHY_NONE:
                                {
-                                       physics_engine = UseODE;
+                                       physics_engine = UseNone;
                                }
                        }
+                 
                }
        }
 
        switch (physics_engine)
        {
-
-       case UseSumo:
-               {
+       
 #ifdef USE_SUMO_SOLID
-
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new SumoPhysicsEnvironment();
-#else
-                       physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
-#endif
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
+               case UseSumo:
+                       destinationscene ->SetPhysicsEnvironment(new SumoPhysicsEnvironment());
                        break;
-               }
-       case UseODE:
-               {
+#endif
 #ifdef USE_ODE
 
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new ODEPhysicsEnvironment();
-#else
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
-#endif //USE_ODE
-
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
+               case UseODE:
+                       destinationscene ->SetPhysicsEnvironment(new ODEPhysicsEnvironment());
                        break;
-               }
-       case UseDynamo:
+#endif //USE_ODE
+       
+               case UseDynamo:
                {
                }
-
-       case UseNone:
-               {
-               };
-       default:
-               {
+               
+               default:
+               case UseNone:
                        physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
-
-               }
+                       destinationscene ->SetPhysicsEnvironment(new DummyPhysicsEnvironment());
+                       break;
        }
 
        BL_ConvertBlenderObjects(m_maggie,
-                                                        scenename,
-                                                        destinationscene,
-                                                        m_ketsjiEngine,
-                                                        physics_engine,
-                                                        dictobj,
-                                                        keyinputdev,
-                                                        rendertools,
-                                                        canvas,
-                                                        this,
-                                                        m_alwaysUseExpandFraming
-                                                        );
+               scenename,
+               destinationscene,
+               m_ketsjiEngine,
+               physics_engine,
+               dictobj,
+               keyinputdev,
+               rendertools,
+               canvas,
+               this,
+               m_alwaysUseExpandFraming
+               );
 
        m_map_blender_to_gameactuator.clear();
        m_map_blender_to_gamecontroller.clear();
-
+       
        m_map_blender_to_gameobject.clear();
        m_map_mesh_to_gamemesh.clear();
        m_map_gameobject_to_blender.clear();