18
18
// You should have received a copy of the GNU General Public License
19
19
// along with this program; if not, write to the Free Software Foundation,
20
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
22
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23
23
// All rights reserved.
49
46
/* Integration hooks ------------------------------------------------------- */
53
KX_SCA_DynamicActuator::Type = {
54
#if (PY_VERSION_HEX >= 0x02060000)
48
PyTypeObject KX_SCA_DynamicActuator::Type = {
55
49
PyVarObject_HEAD_INIT(NULL, 0)
57
/* python 2.5 and below */
58
PyObject_HEAD_INIT( NULL ) /* required py macro */
61
50
"KX_SCA_DynamicActuator",
62
51
sizeof(PyObjectPlus_Proxy),
77
PyParentObject KX_SCA_DynamicActuator::Parents[] = {
78
&KX_SCA_DynamicActuator::Type,
60
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
79
65
&SCA_IActuator::Type,
80
&SCA_ILogicBrick::Type,
86
70
PyMethodDef KX_SCA_DynamicActuator::Methods[] = {
88
KX_PYMETHODTABLE(KX_SCA_DynamicActuator, setOperation),
89
KX_PYMETHODTABLE(KX_SCA_DynamicActuator, getOperation),
90
71
{NULL,NULL} //Sentinel
93
74
PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
94
75
KX_PYATTRIBUTE_SHORT_RW("mode",0,4,false,KX_SCA_DynamicActuator,m_dyn_operation),
95
KX_PYATTRIBUTE_FLOAT_RW("mass",0.0,MAXFLOAT,KX_SCA_DynamicActuator,m_setmass),
76
KX_PYATTRIBUTE_FLOAT_RW("mass",0.0,FLT_MAX,KX_SCA_DynamicActuator,m_setmass),
96
77
{ NULL } //Sentinel
100
PyObject* KX_SCA_DynamicActuator::py_getattro(PyObject *attr)
102
py_getattro_up(SCA_IActuator);
105
PyObject* KX_SCA_DynamicActuator::py_getattro_dict() {
106
py_getattro_dict_up(SCA_IActuator);
109
int KX_SCA_DynamicActuator::py_setattro(PyObject *attr, PyObject* value)
111
py_setattro_up(SCA_IActuator);
115
/* 1. setOperation */
116
KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, setOperation,
117
"setOperation(operation?)\n"
118
"\t - operation? : type of dynamic operation\n"
119
"\t 0 = restore dynamics\n"
120
"\t 1 = disable dynamics\n"
121
"\t 2 = enable rigid body\n"
122
"\t 3 = disable rigid body\n"
123
"Change the dynamic status of the parent object.\n")
125
ShowDeprecationWarning("setOperation()", "the mode property");
128
if (!PyArg_ParseTuple(args, "i:setOperation", &dyn_operation))
132
if (dyn_operation <0 || dyn_operation>3) {
133
PyErr_SetString(PyExc_IndexError, "Dynamic Actuator's setOperation() range must be between 0 and 3");
136
m_dyn_operation= dyn_operation;
140
KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, getOperation,
141
"getOperation() -> integer\n"
142
"Returns the operation type of this actuator.\n"
145
ShowDeprecationWarning("getOperation()", "the mode property");
146
return PyInt_FromLong((long)m_dyn_operation);
150
82
/* ------------------------------------------------------------------------- */
151
83
/* Native functions */