diff options
Diffstat (limited to 'source/gameengine')
17 files changed, 27 insertions, 62 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 5b825899739..df7f35d7773 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -375,7 +375,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw #ifndef DISABLE_PYTHON // some python things PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata); - ketsjiengine->SetPythonDictionary(dictionaryobject); + ketsjiengine->SetPyNamespace(dictionaryobject); initRasterizer(rasterizer, canvas); PyObject *gameLogic = initGameLogic(ketsjiengine, startscene); PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module. @@ -406,9 +406,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw // convert and add scene sceneconverter->ConvertScene( startscene, -#ifndef DISABLE_PYTHON - dictionaryobject, -#endif rendertools, canvas); ketsjiengine->AddScene(startscene); @@ -702,7 +699,7 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win, #ifndef DISABLE_PYTHON // some python things PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata); - ketsjiengine->SetPythonDictionary(dictionaryobject); + ketsjiengine->SetPyNamespace(dictionaryobject); initRasterizer(rasterizer, canvas); PyObject *gameLogic = initGameLogic(ketsjiengine, startscene); PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module @@ -721,9 +718,6 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win, // convert and add scene sceneconverter->ConvertScene( startscene, -#ifndef DISABLE_PYTHON - dictionaryobject, -#endif rendertools, canvas); ketsjiengine->AddScene(startscene); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 8310294a73a..db32f18f63b 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1897,9 +1897,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie, KX_Scene* kxscene, KX_KetsjiEngine* ketsjiEngine, e_PhysicsEngine physics_engine, -#ifndef DISABLE_PYTHON - PyObject* pythondictionary, -#endif RAS_IRenderTools* rendertools, RAS_ICanvas* canvas, KX_BlenderSceneConverter* converter, @@ -2655,11 +2652,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, struct Object* blenderobj = gameobj->GetBlenderObject(); int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0; bool isInActiveLayer = (blenderobj->lay & layerMask)!=0; - BL_ConvertControllers(blenderobj,gameobj,logicmgr, -#ifndef DISABLE_PYTHON - pythondictionary, -#endif - layerMask,isInActiveLayer,converter); + BL_ConvertControllers(blenderobj,gameobj,logicmgr, layerMask,isInActiveLayer,converter); } for ( i=0;i<logicbrick_conversionlist->GetCount();i++) { diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h index 96ef7d5bc77..218b296b47b 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.h +++ b/source/gameengine/Converter/BL_BlenderDataConversion.h @@ -40,9 +40,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie, class KX_Scene* kxscene, class KX_KetsjiEngine* ketsjiEngine, e_PhysicsEngine physics_engine, -#ifndef DISABLE_PYTHON - PyObject* pythondictionary, -#endif class RAS_IRenderTools* rendertools, class RAS_ICanvas* canvas, class KX_BlenderSceneConverter* sceneconverter, diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index f0f5e1d4f41..26b4514061c 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -243,9 +243,6 @@ struct BlenderDebugDraw : public btIDebugDraw #endif void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene, -#ifndef DISABLE_PYTHON - PyObject* dictobj, -#endif class RAS_IRenderTools* rendertools, class RAS_ICanvas* canvas) { @@ -330,9 +327,6 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene, destinationscene, m_ketsjiEngine, physics_engine, -#ifndef DISABLE_PYTHON - dictobj, -#endif rendertools, canvas, this, @@ -924,3 +918,10 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo() } + +#ifndef DISABLE_PYTHON +PyObject *KX_BlenderSceneConverter::GetPyNamespace() +{ + return m_ketsjiEngine->GetPyNamespace(); +} +#endif diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index fa066aac27e..f74944d3552 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -89,9 +89,6 @@ public: */ virtual void ConvertScene( class KX_Scene* destinationscene, -#ifndef DISABLE_PYTHON - PyObject* dictobj, -#endif class RAS_IRenderTools* rendertools, class RAS_ICanvas* canvas ); @@ -145,6 +142,9 @@ public: struct Main* GetMain() { return m_maggie; }; +#ifndef DISABLE_PYTHON + PyObject *GetPyNamespace(); +#endif #ifdef WITH_CXX_GUARDEDALLOC public: diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp index 1cb15c932ac..faef0feaf48 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ b/source/gameengine/Converter/KX_ConvertControllers.cpp @@ -92,9 +92,6 @@ void BL_ConvertControllers( struct Object* blenderobject, class KX_GameObject* gameobj, SCA_LogicManager* logicmgr, -#ifndef DISABLE_PYTHON - PyObject* pythondictionary, -#endif int activeLayerBitInfo, bool isInActiveLayer, KX_BlenderSceneConverter* converter @@ -160,10 +157,9 @@ void BL_ConvertControllers( bPythonCont* pycont = (bPythonCont*) bcontr->data; SCA_PythonController* pyctrl = new SCA_PythonController(gameobj, pycont->mode); gamecontroller = pyctrl; - #ifndef DISABLE_PYTHON - pyctrl->SetDictionary(pythondictionary); + pyctrl->SetNamespace(converter->GetPyNamespace()); if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { if (pycont->text) diff --git a/source/gameengine/Converter/KX_ConvertControllers.h b/source/gameengine/Converter/KX_ConvertControllers.h index 3895ed2c873..2689ad446bd 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.h +++ b/source/gameengine/Converter/KX_ConvertControllers.h @@ -35,9 +35,6 @@ void BL_ConvertControllers( struct Object* blenderobject, class KX_GameObject* gameobj, class SCA_LogicManager* logicmgr, -#ifndef DISABLE_PYTHON - PyObject* pythondictionary, -#endif int activeLayerBitInfo, bool isInActiveLayer, class KX_BlenderSceneConverter* converter diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h index 60335f8fe01..f078e129378 100644 --- a/source/gameengine/GameLogic/SCA_IObject.h +++ b/source/gameengine/GameLogic/SCA_IObject.h @@ -219,6 +219,7 @@ public: typedef enum ObjectTypes { OBJ_ARMATURE=0, OBJ_CAMERA=1, + OBJ_LIGHT=2, }ObjectTypes; }; diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 3a70d1485dc..ac3e0434d20 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -151,7 +151,7 @@ void SCA_PythonController::SetScriptName(const STR_String& name) #ifndef DISABLE_PYTHON -void SCA_PythonController::SetDictionary(PyObject* pythondictionary) +void SCA_PythonController::SetNamespace(PyObject* pythondictionary) { if (m_pythondictionary) { diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h index f6a1064b77d..eeac710c6ea 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.h +++ b/source/gameengine/GameLogic/SCA_PythonController.h @@ -84,7 +84,7 @@ class SCA_PythonController : public SCA_IController void SetScriptText(const STR_String& text); void SetScriptName(const STR_String& name); #ifndef DISABLE_PYTHON - void SetDictionary(PyObject* pythondictionary); + void SetNamespace(PyObject* pythondictionary); #endif void SetDebug(bool debug) { m_debug = debug; } void AddTriggeredSensor(class SCA_ISensor* sensor) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 8ec41968042..3c989293c94 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -679,7 +679,7 @@ bool GPG_Application::startEngine(void) // some python things PyObject* dictionaryobject = initGamePlayerPythonScripting("Ketsji", psl_Lowest, m_maggie, m_argc, m_argv); - m_ketsjiengine->SetPythonDictionary(dictionaryobject); + m_ketsjiengine->SetPyNamespace(dictionaryobject); initRasterizer(m_rasterizer, m_canvas); PyObject *gameLogic = initGameLogic(m_ketsjiengine, startscene); PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module @@ -702,7 +702,6 @@ bool GPG_Application::startEngine(void) m_sceneconverter->ConvertScene( startscene, - dictionaryobject, m_rendertools, m_canvas); m_ketsjiengine->AddScene(startscene); diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 48ba573e01b..41e04eef91c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -749,14 +749,6 @@ public: ) { return m_bIsNegativeScaling; } /** - * Is this a light? - */ - virtual bool - IsLight( - void - ) { return false; } - - /** * @section Logic bubbling methods. */ diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h index 3c3d1d700c4..e5b7c777fb4 100644 --- a/source/gameengine/Ketsji/KX_ISceneConverter.h +++ b/source/gameengine/Ketsji/KX_ISceneConverter.h @@ -53,9 +53,6 @@ public: */ virtual void ConvertScene( class KX_Scene* destinationscene, -#ifndef DISABLE_PYTHON - PyObject* dictobj, -#endif class RAS_IRenderTools* rendertools, class RAS_ICanvas* canvas)=0; diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 734b74b7456..9f4fa9a7c02 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -238,7 +238,7 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer) * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called. * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand. */ -void KX_KetsjiEngine::SetPythonDictionary(PyObject* pythondictionary) +void KX_KetsjiEngine::SetPyNamespace(PyObject* pythondictionary) { MT_assert(pythondictionary); m_pythondictionary = pythondictionary; @@ -1618,9 +1618,6 @@ KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String& scenename) scene); m_sceneconverter->ConvertScene(tmpscene, -#ifndef DISABLE_PYTHON - m_pythondictionary, -#endif m_rendertools, m_canvas); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 9cfca850bf3..74d683fbad6 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -204,7 +204,8 @@ public: void SetRenderTools(RAS_IRenderTools* rendertools); void SetRasterizer(RAS_IRasterizer* rasterizer); #ifndef DISABLE_PYTHON - void SetPythonDictionary(PyObject* pythondictionary); + void SetPyNamespace(PyObject* pythondictionary); + PyObject* GetPyNamespace(){return m_pythondictionary;}; #endif void SetSceneConverter(KX_ISceneConverter* sceneconverter); void SetGame2IpoMode(bool game2ipo,int startFrame); diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index 74d8abcfeac..0e8484a4fe5 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -64,6 +64,8 @@ public: void BindShadowBuffer(class RAS_IRasterizer *ras, class KX_Camera *cam, class MT_Transform& camtrans); void UnbindShadowBuffer(class RAS_IRasterizer *ras); void Update(); + + virtual int GetGameObjectType() { return OBJ_LIGHT; } #ifndef DISABLE_PYTHON /* attributes */ @@ -73,8 +75,6 @@ public: static PyObject* pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); #endif - - virtual bool IsLight(void) { return true; } }; #endif //__KX_LIGHT diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 94f62b5b4b6..c93ead74182 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -477,7 +477,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal // this is the list of object that are send to the graphics pipeline m_objectlist->Add(newobj->AddRef()); - if (newobj->IsLight()) + if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) m_lightlist->Add(newobj->AddRef()); newobj->AddMeshUser(); @@ -753,7 +753,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) // add the object in the layer of the parent (*git)->SetLayer(groupobj->GetLayer()); // If the object was a light, we need to update it's RAS_LightObject as well - if ((*git)->IsLight()) + if ((*git)->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) { KX_LightObject* lightobj = static_cast<KX_LightObject*>(*git); lightobj->GetLightData()->m_layer = groupobj->GetLayer(); @@ -861,7 +861,7 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, // add the object in the layer of the parent (*git)->SetLayer(parentobj->GetLayer()); // If the object was a light, we need to update it's RAS_LightObject as well - if ((*git)->IsLight()) + if ((*git)->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) { KX_LightObject* lightobj = static_cast<KX_LightObject*>(*git); lightobj->GetLightData()->m_layer = parentobj->GetLayer(); @@ -982,7 +982,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) newobj->RemoveMeshes(); ret = 1; - if (newobj->IsLight() && m_lightlist->RemoveValue(newobj)) + if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT && m_lightlist->RemoveValue(newobj)) ret = newobj->Release(); if (m_objectlist->RemoveValue(newobj)) ret = newobj->Release(); |