~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_PyConstraintBinding.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: KX_PyConstraintBinding.cpp,v 1.5 2004/03/22 22:01:52 jesterking Exp $
 
2
 * $Id: KX_PyConstraintBinding.cpp,v 1.6 2005/03/25 10:33:37 kester Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
41
41
 
42
42
// nasty glob variable to connect scripting language
43
43
// if there is a better way (without global), please do so!
44
 
static PHY_IPhysicsEnvironment* g_physics_env = NULL;
 
44
static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL;
45
45
 
46
46
static char PhysicsConstraints_module_documentation[] =
47
47
"This is the Python API for the Physics Constraints";
59
59
        int len = PyTuple_Size(args);
60
60
        if ((len == 3) && PyArg_ParseTuple(args,"fff",&x,&y,&z))
61
61
        {
62
 
                if (g_physics_env)
63
 
                        g_physics_env->setGravity(x,y,z);
 
62
                if (PHY_GetActiveEnvironment())
 
63
                        PHY_GetActiveEnvironment()->setGravity(x,y,z);
64
64
        }
65
65
        Py_INCREF(Py_None); return Py_None;
66
66
}
99
99
        
100
100
        if (success)
101
101
        {
102
 
                if (g_physics_env)
 
102
                if (PHY_GetActiveEnvironment())
103
103
                {
104
104
                        
105
105
                        PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) physicsid;
106
106
                        PHY_IPhysicsController* physctrl2 = (PHY_IPhysicsController*) physicsid2;
107
107
                        if (physctrl) //TODO:check for existance of this pointer!
108
108
                        {
109
 
                                int constraintid = g_physics_env->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ);
 
109
                                int constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ);
110
110
                                
111
 
                                KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,g_physics_env);
 
111
                                KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,PHY_GetActiveEnvironment());
112
112
                                
113
113
 
114
114
                                return wrap;
130
130
        
131
131
        if (PyArg_ParseTuple(args,"i",&constraintid))
132
132
        {
133
 
                if (g_physics_env)
 
133
                if (PHY_GetActiveEnvironment())
134
134
                {
135
 
                        g_physics_env->removeConstraint(constraintid);
 
135
                        PHY_GetActiveEnvironment()->removeConstraint(constraintid);
136
136
                }
137
137
        }
138
138
        Py_INCREF(Py_None); return Py_None;
188
188
 
189
189
void    PHY_SetActiveEnvironment(class  PHY_IPhysicsEnvironment* env)
190
190
{
191
 
        g_physics_env = env;
192
 
}
 
191
        g_CurrentActivePhysicsEnvironment = env;
 
192
}
 
193
 
 
194
PHY_IPhysicsEnvironment*        PHY_GetActiveEnvironment()
 
195
{
 
196
        return g_CurrentActivePhysicsEnvironment;
 
197
}
 
198