4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 #include "PyObjectPlus.h"
31 #include "KX_ConstraintWrapper.h"
32 #include "PHY_IPhysicsEnvironment.h"
38 KX_ConstraintWrapper::KX_ConstraintWrapper(
39 PHY_ConstraintType ctype,
41 PHY_IPhysicsEnvironment* physenv,PyTypeObject *T) :
43 m_constraintId(constraintId),
44 m_constraintType(ctype),
48 KX_ConstraintWrapper::~KX_ConstraintWrapper()
51 //python integration methods
52 PyObject* KX_ConstraintWrapper::PyTestMethod(PyObject* self,
60 PyObject* KX_ConstraintWrapper::PyGetConstraintId(PyObject* self,
64 return PyInt_FromLong(m_constraintId);
70 //python specific stuff
71 PyTypeObject KX_ConstraintWrapper::Type = {
72 PyObject_HEAD_INIT(NULL)
74 "KX_ConstraintWrapper",
75 sizeof(KX_ConstraintWrapper),
90 PyParentObject KX_ConstraintWrapper::Parents[] = {
91 &KX_ConstraintWrapper::Type,
95 PyObject* KX_ConstraintWrapper::py_getattro(PyObject *attr)
97 //here you can search for existing data members (like mass,friction etc.)
98 py_getattro_up(PyObjectPlus);
101 int KX_ConstraintWrapper::py_setattro(PyObject *attr,PyObject* pyobj)
104 /* what the heck is this supposed to do?, needs attention */
105 if (PyList_Check(pyobj))
109 if (PyFloat_Check(pyobj))
114 if (PyInt_Check(pyobj))
118 if (PyString_Check(pyobj))
123 result = PyObjectPlus::py_setattro(attr,pyobj);
128 PyMethodDef KX_ConstraintWrapper::Methods[] = {
129 {"testMethod",(PyCFunction) KX_ConstraintWrapper::sPyTestMethod, METH_VARARGS},
130 {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_VARARGS},
131 {NULL,NULL} //Sentinel
134 PyAttributeDef KX_ConstraintWrapper::Attributes[] = {