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:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-03-25 13:33:39 +0300
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-03-25 13:33:39 +0300
commitc844aa265ad4eb50ad0e18661470fa6092052728 (patch)
treec4a778ab1227e4266022fd076e8a0cb709badd13 /source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
parent3dd17cec3bcaa3885e14630e6a71a8486e9b2697 (diff)
Big patches:
Erwin Coumans: Abstract the physics engine Charlie C: Joystick fixes Me: Moved the ray cast (shadows, mouse sensor & ray sensor)
Diffstat (limited to 'source/gameengine/Ketsji/KX_PyConstraintBinding.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 1f810e655ac..0111fd36cb2 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -41,7 +41,7 @@
// nasty glob variable to connect scripting language
// if there is a better way (without global), please do so!
-static PHY_IPhysicsEnvironment* g_physics_env = NULL;
+static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL;
static char PhysicsConstraints_module_documentation[] =
"This is the Python API for the Physics Constraints";
@@ -59,8 +59,8 @@ static PyObject* gPySetGravity(PyObject* self,
int len = PyTuple_Size(args);
if ((len == 3) && PyArg_ParseTuple(args,"fff",&x,&y,&z))
{
- if (g_physics_env)
- g_physics_env->setGravity(x,y,z);
+ if (PHY_GetActiveEnvironment())
+ PHY_GetActiveEnvironment()->setGravity(x,y,z);
}
Py_INCREF(Py_None); return Py_None;
}
@@ -99,16 +99,16 @@ static PyObject* gPyCreateConstraint(PyObject* self,
if (success)
{
- if (g_physics_env)
+ if (PHY_GetActiveEnvironment())
{
PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) physicsid;
PHY_IPhysicsController* physctrl2 = (PHY_IPhysicsController*) physicsid2;
if (physctrl) //TODO:check for existance of this pointer!
{
- int constraintid = g_physics_env->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ);
+ int constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ);
- KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,g_physics_env);
+ KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,PHY_GetActiveEnvironment());
return wrap;
@@ -130,9 +130,9 @@ static PyObject* gPyRemoveConstraint(PyObject* self,
if (PyArg_ParseTuple(args,"i",&constraintid))
{
- if (g_physics_env)
+ if (PHY_GetActiveEnvironment())
{
- g_physics_env->removeConstraint(constraintid);
+ PHY_GetActiveEnvironment()->removeConstraint(constraintid);
}
}
Py_INCREF(Py_None); return Py_None;
@@ -188,5 +188,11 @@ void KX_RemovePythonConstraintBinding()
void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env)
{
- g_physics_env = env;
+ g_CurrentActivePhysicsEnvironment = env;
}
+
+PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment()
+{
+ return g_CurrentActivePhysicsEnvironment;
+}
+