From 2e6d57618232b8b4ce8e5afe84fd278041cbbbfe Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Fri, 6 Jan 2006 03:46:54 +0000 Subject: Sorry to break the cvs-closed status, so if you really need to make a new 2.40 build, just disable the game engine if it doesn't compile for a platform. Again, sorry if this breaks non-windows platforms, but I hope people help to get this amazing fix working for all platforms. Armature-fixing contribution from Snailrose. Also lots of cool things from Snailrose and Lagan. Armatures are back Split screen Double sided lightning Ambient lighting Alpha test Material IPO support (one per object atm) Blender materials GLSL shaders - Python access Up to three texture samplers from the material panel ( 2D & Cube map ) Python access to a second set of uv coordinates See http://www.elysiun.com/forum/viewtopic.php?t=58057 --- .../gameengine/GameLogic/SCA_PythonController.cpp | 44 ++++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'source/gameengine/GameLogic/SCA_PythonController.cpp') diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 01afd16e963..a5360d99a8b 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -144,8 +144,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject* self, #if 0 static char* sPyAddActiveActuator__doc__; #endif - - + PyObject* SCA_PythonController::sPyAddActiveActuator( PyObject* self, @@ -156,18 +155,27 @@ PyObject* SCA_PythonController::sPyAddActiveActuator( PyObject* ob1; int activate; if (!PyArg_ParseTuple(args, "Oi", &ob1,&activate)) - { return NULL; - - } + // for safety, todo: only allow for registered actuators (pointertable) // we don't want to crash gameengine/blender by python scripts + std::vector lacts = m_sCurrentController->GetLinkedActuators(); - CValue* ac = (CValue*)ob1; - CValue* boolval = new CBoolValue(activate!=0); - m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)ac,boolval); - boolval->Release(); - + std::vector::iterator it; + bool found = false; + CValue* act = (CValue*)ob1; + + for(it = lacts.begin(); it!= lacts.end(); it++) { + if( static_cast(act) == (*it) ) { + found=true; + break; + } + } + if(found){ + CValue* boolval = new CBoolValue(activate!=0); + m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)act,boolval); + boolval->Release(); + } Py_INCREF(Py_None); return Py_None; } @@ -268,12 +276,24 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) ); PyDict_Clear(excdict); Py_DECREF(excdict);*/ - + +// FIXME:: still happining, will try to fix. snailrose... + PyObject *excdict= PyDict_Copy(m_pythondictionary); + PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode, + excdict, + excdict + ); + PyDict_Clear(excdict); + Py_DECREF(excdict); + + +#if 0 PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode, m_pythondictionary, m_pythondictionary ); - +#endif + if (resultobj) { Py_DECREF(resultobj); -- cgit v1.2.3