Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-05-14 03:31:36 +0400
committerErwin Coumans <blender@erwincoumans.com>2006-05-14 03:31:36 +0400
commit4a5826fa83f15dad702a65438b36ec6d1f0f30df (patch)
tree9a85a95403f3669c335316eb90734cf3c3698c29 /source/gameengine
parentd790049639eb4b2517cfaf3d7a3e1fe2e2b21281 (diff)
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 ]
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp3
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp1
7 files changed, 21 insertions, 6 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index e24ade47783..f59faa18d0a 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -311,7 +311,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest);
ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(rasterizer, canvas);
- initGameLogic(startscene);
+ PyObject *gameLogic = initGameLogic(startscene);
initGameKeys();
initPythonConstraintBinding();
@@ -370,11 +370,11 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
exitstring = ketsjiengine->GetExitString();
// when exiting the mainloop
+ dictionaryClearByHand(gameLogic);
exitGamePythonScripting();
ketsjiengine->StopEngine();
networkdevice->Disconnect();
}
-
if (sceneconverter)
{
delete sceneconverter;
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 48d24bef623..47723c60592 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -278,7 +278,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
Py_DECREF(excdict);*/
-#if 1
+#if 0
PyObject *excdict= PyDict_Copy(m_pythondictionary);
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
excdict,
@@ -286,13 +286,13 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
);
PyDict_Clear(excdict);
Py_DECREF(excdict);
-#endif
+#else
-#if 0
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
m_pythondictionary,
m_pythondictionary
);
+
#endif
if (resultobj)
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index c476cdb5894..d78ad955e1a 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -96,12 +96,14 @@ private:
int m_activecam;
bool m_bFixedTime;
+
bool m_firstframe;
int m_currentFrame;
double m_frameTime;//discrete timestamp of the 'game logic frame'
double m_clockTime;//current time
double m_previousClockTime;//previous clock time
+ double m_remainingTime;
static double m_ticrate;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index f86b984c789..65751a995d9 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -784,6 +784,15 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
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
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index 85616e26b6c..a4c2d1453a6 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -50,6 +50,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
void exitGamePlayerPythonScripting();
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
void exitGamePythonScripting();
+void dictionaryClearByHand(PyObject *dict);
+
void PHY_SetActiveScene(class KX_Scene* scene);
#include "MT_Vector3.h"
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index bdeffd79a60..1706937f8df 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -181,7 +181,7 @@ KX_Scene::~KX_Scene()
if(m_objectlist)
m_objectlist->Release();
-
+
if (m_parentlist)
m_parentlist->Release();
@@ -210,6 +210,7 @@ KX_Scene::~KX_Scene()
{
delete m_bucketmanager;
}
+
//Py_DECREF(m_attrlist);
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index cb4adc77d76..e24bc1653af 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -528,6 +528,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
if (!SimdFuzzyZero(timeStep))
{
+
// define this in blender, the stepsize is 30 hertz, 60 hertz works much better
//#define SPLIT_TIMESTEP 1