forked from bartvdbraak/blender
Patch from Charlie:
Cleared the python dictionary at the end of the game engine, should fix some issues, also reverted the python controller changes, related to this This should fix the following bugs: [ #3789 ] [ #3815 ] possiblyy fixes: [ #3834 ]
This commit is contained in:
parent
d790049639
commit
4a5826fa83
@ -311,7 +311,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
|
|||||||
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest);
|
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest);
|
||||||
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
||||||
initRasterizer(rasterizer, canvas);
|
initRasterizer(rasterizer, canvas);
|
||||||
initGameLogic(startscene);
|
PyObject *gameLogic = initGameLogic(startscene);
|
||||||
initGameKeys();
|
initGameKeys();
|
||||||
initPythonConstraintBinding();
|
initPythonConstraintBinding();
|
||||||
|
|
||||||
@ -370,11 +370,11 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
|
|||||||
exitstring = ketsjiengine->GetExitString();
|
exitstring = ketsjiengine->GetExitString();
|
||||||
|
|
||||||
// when exiting the mainloop
|
// when exiting the mainloop
|
||||||
|
dictionaryClearByHand(gameLogic);
|
||||||
exitGamePythonScripting();
|
exitGamePythonScripting();
|
||||||
ketsjiengine->StopEngine();
|
ketsjiengine->StopEngine();
|
||||||
networkdevice->Disconnect();
|
networkdevice->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sceneconverter)
|
if (sceneconverter)
|
||||||
{
|
{
|
||||||
delete sceneconverter;
|
delete sceneconverter;
|
||||||
|
@ -278,7 +278,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
|||||||
Py_DECREF(excdict);*/
|
Py_DECREF(excdict);*/
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
PyObject *excdict= PyDict_Copy(m_pythondictionary);
|
PyObject *excdict= PyDict_Copy(m_pythondictionary);
|
||||||
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
||||||
excdict,
|
excdict,
|
||||||
@ -286,13 +286,13 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
|||||||
);
|
);
|
||||||
PyDict_Clear(excdict);
|
PyDict_Clear(excdict);
|
||||||
Py_DECREF(excdict);
|
Py_DECREF(excdict);
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#if 0
|
|
||||||
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
||||||
m_pythondictionary,
|
m_pythondictionary,
|
||||||
m_pythondictionary
|
m_pythondictionary
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (resultobj)
|
if (resultobj)
|
||||||
|
@ -96,12 +96,14 @@ private:
|
|||||||
int m_activecam;
|
int m_activecam;
|
||||||
bool m_bFixedTime;
|
bool m_bFixedTime;
|
||||||
|
|
||||||
|
|
||||||
bool m_firstframe;
|
bool m_firstframe;
|
||||||
int m_currentFrame;
|
int m_currentFrame;
|
||||||
|
|
||||||
double m_frameTime;//discrete timestamp of the 'game logic frame'
|
double m_frameTime;//discrete timestamp of the 'game logic frame'
|
||||||
double m_clockTime;//current time
|
double m_clockTime;//current time
|
||||||
double m_previousClockTime;//previous clock time
|
double m_previousClockTime;//previous clock time
|
||||||
|
double m_remainingTime;
|
||||||
|
|
||||||
static double m_ticrate;
|
static double m_ticrate;
|
||||||
|
|
||||||
|
@ -784,6 +784,15 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dictionaryClearByHand(PyObject *dict)
|
||||||
|
{
|
||||||
|
// Clears the dictionary by hand:
|
||||||
|
// This prevents, extra references to global variables
|
||||||
|
// inside the GameLogic dictionary when the python interpreter is finalized.
|
||||||
|
// which allows the scene to safely delete them :)
|
||||||
|
// see: (space.c)->start_game
|
||||||
|
if(dict) PyDict_Clear(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Python Sandbox code
|
// Python Sandbox code
|
||||||
|
@ -50,6 +50,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
|
|||||||
void exitGamePlayerPythonScripting();
|
void exitGamePlayerPythonScripting();
|
||||||
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
|
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
|
||||||
void exitGamePythonScripting();
|
void exitGamePythonScripting();
|
||||||
|
void dictionaryClearByHand(PyObject *dict);
|
||||||
|
|
||||||
void PHY_SetActiveScene(class KX_Scene* scene);
|
void PHY_SetActiveScene(class KX_Scene* scene);
|
||||||
#include "MT_Vector3.h"
|
#include "MT_Vector3.h"
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ KX_Scene::~KX_Scene()
|
|||||||
|
|
||||||
if(m_objectlist)
|
if(m_objectlist)
|
||||||
m_objectlist->Release();
|
m_objectlist->Release();
|
||||||
|
|
||||||
if (m_parentlist)
|
if (m_parentlist)
|
||||||
m_parentlist->Release();
|
m_parentlist->Release();
|
||||||
|
|
||||||
@ -210,6 +210,7 @@ KX_Scene::~KX_Scene()
|
|||||||
{
|
{
|
||||||
delete m_bucketmanager;
|
delete m_bucketmanager;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Py_DECREF(m_attrlist);
|
//Py_DECREF(m_attrlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,6 +528,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
|||||||
|
|
||||||
if (!SimdFuzzyZero(timeStep))
|
if (!SimdFuzzyZero(timeStep))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// define this in blender, the stepsize is 30 hertz, 60 hertz works much better
|
// define this in blender, the stepsize is 30 hertz, 60 hertz works much better
|
||||||
//#define SPLIT_TIMESTEP 1
|
//#define SPLIT_TIMESTEP 1
|
||||||
|
Loading…
Reference in New Issue
Block a user