BGE Python API
Use each types dictionary to store attributes PyAttributeDef's so it uses pythons hash lookup (which it was already doing for methods) rather then doing a string lookup on the array each time. This also means attributes can be found in the type without having to do a dir() on the instance.
This commit is contained in:
@@ -1037,21 +1037,14 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* BL_ActionActuator::py_getattro(PyObject *attr) {
|
PyObject* BL_ActionActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BL_ActionActuator::py_setattro(PyObject *attr, PyObject* value) {
|
int BL_ActionActuator::py_setattro(PyObject *attr, PyObject* value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
{
|
{
|
||||||
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
|
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
|
||||||
|
|||||||
@@ -486,17 +486,11 @@ PyAttributeDef BL_ShapeActionActuator::Attributes[] = {
|
|||||||
|
|
||||||
|
|
||||||
PyObject* BL_ShapeActionActuator::py_getattro(PyObject* attr) {
|
PyObject* BL_ShapeActionActuator::py_getattro(PyObject* attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BL_ShapeActionActuator::py_setattro(PyObject *attr, PyObject* value) {
|
int BL_ShapeActionActuator::py_setattro(PyObject *attr, PyObject* value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setStart */
|
/* setStart */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -99,20 +99,42 @@ static inline void Py_Fatal(const char *M) {
|
|||||||
// to be properly passed up the hierarchy.
|
// to be properly passed up the hierarchy.
|
||||||
|
|
||||||
#define py_getattro_up(Parent) \
|
#define py_getattro_up(Parent) \
|
||||||
PyObject *rvalue; \
|
\
|
||||||
PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
|
PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
|
||||||
\
|
\
|
||||||
if (descr == NULL) { \
|
if(descr) { \
|
||||||
PyErr_Clear(); \
|
if (PyCObject_Check(descr)) { \
|
||||||
rvalue = Parent::py_getattro(attr); \
|
return py_get_attrdef((void *)this, (const PyAttributeDef*)PyCObject_AsVoidPtr(descr)); \
|
||||||
|
} else { \
|
||||||
|
return PyCFunction_New(((PyMethodDescrObject *)descr)->d_method, (PyObject *)this); \
|
||||||
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
rvalue= PyCFunction_New(((PyMethodDescrObject *)descr)->d_method, (PyObject *)this); \
|
PyErr_Clear(); \
|
||||||
|
PyObject *rvalue= Parent::py_getattro(attr); \
|
||||||
|
\
|
||||||
|
if (strcmp(PyString_AsString(attr), "__dict__")==0) { \
|
||||||
|
return py_getattr_dict(rvalue, Methods, Attributes); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
return rvalue; \
|
||||||
} \
|
} \
|
||||||
\
|
return NULL;
|
||||||
if (strcmp(PyString_AsString(attr), "__dict__")==0) {\
|
|
||||||
rvalue = py_getattr_dict(rvalue, Methods, Attributes); \
|
|
||||||
} \
|
#define py_setattro_up(Parent) \
|
||||||
return rvalue; \
|
PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
|
||||||
|
\
|
||||||
|
if(descr) { \
|
||||||
|
if (PyCObject_Check(descr)) { \
|
||||||
|
return py_set_attrdef((void *)this, (const PyAttributeDef*)PyCObject_AsVoidPtr(descr), value); \
|
||||||
|
} else { \
|
||||||
|
PyErr_Format(PyExc_AttributeError, "\"%s\" cannot be set", PyString_AsString(attr)); \
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
PyErr_Clear(); \
|
||||||
|
return Parent::py_setattro(attr, value); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,8 +398,14 @@ public:
|
|||||||
{
|
{
|
||||||
return ((PyObjectPlus*) PyObj)->py_getattro(attr);
|
return ((PyObjectPlus*) PyObj)->py_getattro(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject* py_get_attrdef(void *self, const PyAttributeDef *attrdef);
|
||||||
|
static int py_set_attrdef(void *self, const PyAttributeDef *attrdef, PyObject *value);
|
||||||
|
|
||||||
|
#if 0
|
||||||
static PyObject *py_getattro_self(const PyAttributeDef attrlist[], void *self, PyObject *attr);
|
static PyObject *py_getattro_self(const PyAttributeDef attrlist[], void *self, PyObject *attr);
|
||||||
static int py_setattro_self(const PyAttributeDef attrlist[], void *self, PyObject *attr, PyObject *value);
|
static int py_setattro_self(const PyAttributeDef attrlist[], void *self, PyObject *attr, PyObject *value);
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual int py_delattro(PyObject *attr);
|
virtual int py_delattro(PyObject *attr);
|
||||||
virtual int py_setattro(PyObject *attr, PyObject *value); // py_setattro method
|
virtual int py_setattro(PyObject *attr, PyObject *value); // py_setattro method
|
||||||
|
|||||||
@@ -162,10 +162,11 @@ PyAttributeDef SCA_ActuatorSensor::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* SCA_ActuatorSensor::py_getattro(PyObject *attr) {
|
PyObject* SCA_ActuatorSensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
py_getattro_up(SCA_ISensor);
|
||||||
if (object != NULL)
|
}
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor); /* implicit return! */
|
int SCA_ActuatorSensor::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
|
py_setattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
|
int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
|
||||||
@@ -180,13 +181,6 @@ int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_ActuatorSensor::py_setattro(PyObject *attr, PyObject *value) {
|
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 3. getActuator */
|
/* 3. getActuator */
|
||||||
const char SCA_ActuatorSensor::GetActuator_doc[] =
|
const char SCA_ActuatorSensor::GetActuator_doc[] =
|
||||||
"getActuator()\n"
|
"getActuator()\n"
|
||||||
|
|||||||
@@ -179,17 +179,11 @@ PyAttributeDef SCA_DelaySensor::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* SCA_DelaySensor::py_getattro(PyObject *attr) {
|
PyObject* SCA_DelaySensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_DelaySensor::py_setattro(PyObject *attr, PyObject *value) {
|
int SCA_DelaySensor::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -280,18 +280,12 @@ int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef)
|
|||||||
PyObject*
|
PyObject*
|
||||||
SCA_ILogicBrick::py_getattro(PyObject *attr)
|
SCA_ILogicBrick::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(CValue);
|
py_getattro_up(CValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_ILogicBrick::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_ILogicBrick::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(CValue);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return CValue::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -462,18 +462,12 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
|
|||||||
PyObject*
|
PyObject*
|
||||||
SCA_ISensor::py_getattro(PyObject *attr)
|
SCA_ISensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ILogicBrick);
|
py_getattro_up(SCA_ILogicBrick);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_ISensor::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_ISensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ILogicBrick);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ILogicBrick::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
|
|||||||
@@ -336,18 +336,12 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* SCA_JoystickSensor::py_getattro(PyObject *attr)
|
PyObject* SCA_JoystickSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_JoystickSensor::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_JoystickSensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -833,16 +833,10 @@ PyAttributeDef SCA_KeyboardSensor::Attributes[] = {
|
|||||||
PyObject*
|
PyObject*
|
||||||
SCA_KeyboardSensor::py_getattro(PyObject *attr)
|
SCA_KeyboardSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_KeyboardSensor::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_KeyboardSensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,18 +343,12 @@ PyAttributeDef SCA_MouseSensor::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* SCA_MouseSensor::py_getattro(PyObject *attr)
|
PyObject* SCA_MouseSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_MouseSensor::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_MouseSensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eof */
|
/* eof */
|
||||||
|
|||||||
@@ -261,17 +261,11 @@ PyAttributeDef SCA_PropertyActuator::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* SCA_PropertyActuator::py_getattro(PyObject *attr) {
|
PyObject* SCA_PropertyActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_PropertyActuator::py_setattro(PyObject *attr, PyObject *value) {
|
int SCA_PropertyActuator::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. setProperty */
|
/* 1. setProperty */
|
||||||
|
|||||||
@@ -353,17 +353,11 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
|
|||||||
|
|
||||||
|
|
||||||
PyObject* SCA_PropertySensor::py_getattro(PyObject *attr) {
|
PyObject* SCA_PropertySensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
py_getattro_up(SCA_ISensor);
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor); /* implicit return! */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_PropertySensor::py_setattro(PyObject *attr, PyObject *value) {
|
int SCA_PropertySensor::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. getType */
|
/* 1. getType */
|
||||||
|
|||||||
@@ -376,20 +376,12 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
|||||||
|
|
||||||
PyObject* SCA_PythonController::py_getattro(PyObject *attr)
|
PyObject* SCA_PythonController::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(SCA_IController);
|
py_getattro_up(SCA_IController);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_PythonController::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_PythonController::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IController);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return SCA_IController::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SCA_PythonController::PyActivate(PyObject* self, PyObject *value)
|
PyObject* SCA_PythonController::PyActivate(PyObject* self, PyObject *value)
|
||||||
|
|||||||
@@ -392,18 +392,12 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SCA_RandomActuator::py_getattro(PyObject *attr) {
|
PyObject* SCA_RandomActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_RandomActuator::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_RandomActuator::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. setSeed */
|
/* 1. setSeed */
|
||||||
|
|||||||
@@ -167,18 +167,12 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* SCA_RandomSensor::py_getattro(PyObject *attr) {
|
PyObject* SCA_RandomSensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCA_RandomSensor::py_setattro(PyObject *attr, PyObject *value)
|
int SCA_RandomSensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. setSeed */
|
/* 1. setSeed */
|
||||||
|
|||||||
@@ -154,17 +154,11 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_NetworkMessageActuator::py_getattro(PyObject *attr) {
|
PyObject* KX_NetworkMessageActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_NetworkMessageActuator::py_setattro(PyObject *attr, PyObject *value) {
|
int KX_NetworkMessageActuator::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated ----->
|
// Deprecated ----->
|
||||||
|
|||||||
@@ -224,16 +224,10 @@ PyAttributeDef KX_NetworkMessageSensor::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_NetworkMessageSensor::py_getattro(PyObject *attr) {
|
PyObject* KX_NetworkMessageSensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_NetworkMessageSensor::py_setattro(PyObject *attr, PyObject *value) {
|
int KX_NetworkMessageSensor::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
return SCA_ISensor::py_setattro(attr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,18 +217,12 @@ int KX_CDActuator::pyattr_setGain(void *self, const struct KX_PYATTRIBUTE_DEF *a
|
|||||||
|
|
||||||
PyObject* KX_CDActuator::py_getattro(PyObject *attr)
|
PyObject* KX_CDActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_CDActuator::py_setattro(PyObject *attr, PyObject *value)
|
int KX_CDActuator::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -534,20 +534,12 @@ PyParentObject KX_Camera::Parents[] = {
|
|||||||
|
|
||||||
PyObject* KX_Camera::py_getattro(PyObject *attr)
|
PyObject* KX_Camera::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(KX_GameObject);
|
py_getattro_up(KX_GameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_Camera::py_setattro(PyObject *attr, PyObject *value)
|
int KX_Camera::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(KX_GameObject);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return KX_GameObject::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
|
KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
|
||||||
|
|||||||
@@ -422,18 +422,11 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_CameraActuator::py_getattro(PyObject *attr) {
|
PyObject* KX_CameraActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_CameraActuator::py_setattro(PyObject *attr, PyObject* value) {
|
int KX_CameraActuator::py_setattro(PyObject *attr, PyObject* value) {
|
||||||
int ret;
|
py_setattro_up(SCA_IActuator);
|
||||||
ret = py_setattro_self(Attributes, this, attr, value);
|
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get obj ---------------------------------------------------------- */
|
/* get obj ---------------------------------------------------------- */
|
||||||
|
|||||||
@@ -256,18 +256,12 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
|
|||||||
PyObject*
|
PyObject*
|
||||||
KX_GameActuator::py_getattro(PyObject *attr)
|
KX_GameActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_GameActuator::py_setattro(PyObject *attr, PyObject *value)
|
int KX_GameActuator::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1511,20 +1511,12 @@ PyObject* KX_GameObject::pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_
|
|||||||
|
|
||||||
PyObject* KX_GameObject::py_getattro(PyObject *attr)
|
PyObject* KX_GameObject::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(SCA_IObject);
|
py_getattro_up(SCA_IObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_GameObject::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
|
int KX_GameObject::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IObject);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return SCA_IObject::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* KX_GameObject::PyApplyForce(PyObject* self, PyObject* args)
|
PyObject* KX_GameObject::PyApplyForce(PyObject* self, PyObject* args)
|
||||||
|
|||||||
@@ -474,20 +474,12 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_IpoActuator::py_getattro(PyObject *attr) {
|
PyObject* KX_IpoActuator::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_IpoActuator::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
|
int KX_IpoActuator::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set --------------------------------------------------------------------- */
|
/* set --------------------------------------------------------------------- */
|
||||||
|
|||||||
@@ -99,10 +99,6 @@ void KX_MeshProxy::SetMeshModified(bool v)
|
|||||||
|
|
||||||
PyObject* KX_MeshProxy::py_getattro(PyObject *attr)
|
PyObject* KX_MeshProxy::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(SCA_IObject);
|
py_getattro_up(SCA_IObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,18 +332,10 @@ PyAttributeDef KX_NearSensor::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_NearSensor::py_getattro(PyObject *attr)
|
PyObject* KX_NearSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(KX_TouchSensor);
|
py_getattro_up(KX_TouchSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_NearSensor::py_setattro(PyObject*attr, PyObject* value)
|
int KX_NearSensor::py_setattro(PyObject*attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(KX_TouchSensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return KX_TouchSensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,19 +208,11 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE
|
|||||||
|
|
||||||
|
|
||||||
PyObject* KX_ParentActuator::py_getattro(PyObject *attr) {
|
PyObject* KX_ParentActuator::py_getattro(PyObject *attr) {
|
||||||
|
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_ParentActuator::py_setattro(PyObject *attr, PyObject* value) {
|
int KX_ParentActuator::py_setattro(PyObject *attr, PyObject* value) {
|
||||||
|
py_setattro_up(SCA_IActuator);
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deprecated -----> */
|
/* Deprecated -----> */
|
||||||
|
|||||||
@@ -232,21 +232,13 @@ PyParentObject KX_PolygonMaterial::Parents[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_PolygonMaterial::py_getattro(PyObject *attr)
|
PyObject* KX_PolygonMaterial::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(PyObjectPlus);
|
py_getattro_up(PyObjectPlus);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_PolygonMaterial::py_setattro(PyObject *attr, PyObject *value)
|
int KX_PolygonMaterial::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(PyObjectPlus);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return PyObjectPlus::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)")
|
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)")
|
||||||
|
|||||||
@@ -129,13 +129,26 @@ void initPyObjectPlusType(PyTypeObject **parents)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void PyType_Ready_ADD(PyObject *dict, PyTypeObject * tp)
|
static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *attributes)
|
||||||
{
|
{
|
||||||
|
PyAttributeDef *attr;
|
||||||
|
PyObject *item;
|
||||||
|
|
||||||
PyType_Ready(tp);
|
PyType_Ready(tp);
|
||||||
PyDict_SetItemString(dict, tp->tp_name, (PyObject *)tp);
|
PyDict_SetItemString(dict, tp->tp_name, (PyObject *)tp);
|
||||||
|
|
||||||
|
/* store attr defs in the tp_dict for to avoid string lookups */
|
||||||
|
for(attr= attributes; attr->m_name; attr++) {
|
||||||
|
item= PyCObject_FromVoidPtr(attr, NULL);
|
||||||
|
PyDict_SetItemString(tp->tp_dict, attr->m_name, item);
|
||||||
|
Py_DECREF(item);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define PyType_Ready_Attr(d, n) PyType_Ready_ADD(d, &n::Type, n::Attributes)
|
||||||
|
|
||||||
void initPyTypes(void)
|
void initPyTypes(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -150,68 +163,68 @@ void initPyTypes(void)
|
|||||||
PyDict_SetItemString(PySys_GetObject("modules"), "GameTypes", mod);
|
PyDict_SetItemString(PySys_GetObject("modules"), "GameTypes", mod);
|
||||||
Py_DECREF(mod);
|
Py_DECREF(mod);
|
||||||
|
|
||||||
PyType_Ready_ADD(dict, &BL_ActionActuator::Type);
|
PyType_Ready_Attr(dict, BL_ActionActuator);
|
||||||
PyType_Ready_ADD(dict, &BL_Shader::Type);
|
PyType_Ready_Attr(dict, BL_Shader);
|
||||||
PyType_Ready_ADD(dict, &BL_ShapeActionActuator::Type);
|
PyType_Ready_Attr(dict, BL_ShapeActionActuator);
|
||||||
PyType_Ready_ADD(dict, &CListValue::Type);
|
PyType_Ready_Attr(dict, CListValue);
|
||||||
PyType_Ready_ADD(dict, &CValue::Type);
|
PyType_Ready_Attr(dict, CValue);
|
||||||
PyType_Ready_ADD(dict, &KX_BlenderMaterial::Type);
|
PyType_Ready_Attr(dict, KX_BlenderMaterial);
|
||||||
PyType_Ready_ADD(dict, &KX_CDActuator::Type);
|
PyType_Ready_Attr(dict, KX_CDActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_Camera::Type);
|
PyType_Ready_Attr(dict, KX_Camera);
|
||||||
PyType_Ready_ADD(dict, &KX_CameraActuator::Type);
|
PyType_Ready_Attr(dict, KX_CameraActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_ConstraintActuator::Type);
|
PyType_Ready_Attr(dict, KX_ConstraintActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_ConstraintWrapper::Type);
|
PyType_Ready_Attr(dict, KX_ConstraintWrapper);
|
||||||
PyType_Ready_ADD(dict, &KX_GameActuator::Type);
|
PyType_Ready_Attr(dict, KX_GameActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_GameObject::Type);
|
PyType_Ready_Attr(dict, KX_GameObject);
|
||||||
PyType_Ready_ADD(dict, &KX_IpoActuator::Type);
|
PyType_Ready_Attr(dict, KX_IpoActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_LightObject::Type);
|
PyType_Ready_Attr(dict, KX_LightObject);
|
||||||
PyType_Ready_ADD(dict, &KX_MeshProxy::Type);
|
PyType_Ready_Attr(dict, KX_MeshProxy);
|
||||||
PyType_Ready_ADD(dict, &KX_MouseFocusSensor::Type);
|
PyType_Ready_Attr(dict, KX_MouseFocusSensor);
|
||||||
PyType_Ready_ADD(dict, &KX_NearSensor::Type);
|
PyType_Ready_Attr(dict, KX_NearSensor);
|
||||||
PyType_Ready_ADD(dict, &KX_NetworkMessageActuator::Type);
|
PyType_Ready_Attr(dict, KX_NetworkMessageActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_NetworkMessageSensor::Type);
|
PyType_Ready_Attr(dict, KX_NetworkMessageSensor);
|
||||||
PyType_Ready_ADD(dict, &KX_ObjectActuator::Type);
|
PyType_Ready_Attr(dict, KX_ObjectActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_ParentActuator::Type);
|
PyType_Ready_Attr(dict, KX_ParentActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_PhysicsObjectWrapper::Type);
|
PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper);
|
||||||
PyType_Ready_ADD(dict, &KX_PolyProxy::Type);
|
PyType_Ready_Attr(dict, KX_PolyProxy);
|
||||||
PyType_Ready_ADD(dict, &KX_PolygonMaterial::Type);
|
PyType_Ready_Attr(dict, KX_PolygonMaterial);
|
||||||
PyType_Ready_ADD(dict, &KX_RadarSensor::Type);
|
PyType_Ready_Attr(dict, KX_RadarSensor);
|
||||||
PyType_Ready_ADD(dict, &KX_RaySensor::Type);
|
PyType_Ready_Attr(dict, KX_RaySensor);
|
||||||
PyType_Ready_ADD(dict, &KX_SCA_AddObjectActuator::Type);
|
PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_SCA_DynamicActuator::Type);
|
PyType_Ready_Attr(dict, KX_SCA_DynamicActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_SCA_EndObjectActuator::Type);
|
PyType_Ready_Attr(dict, KX_SCA_EndObjectActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_SCA_ReplaceMeshActuator::Type);
|
PyType_Ready_Attr(dict, KX_SCA_ReplaceMeshActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_Scene::Type);
|
PyType_Ready_Attr(dict, KX_Scene);
|
||||||
PyType_Ready_ADD(dict, &KX_SceneActuator::Type);
|
PyType_Ready_Attr(dict, KX_SceneActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_SoundActuator::Type);
|
PyType_Ready_Attr(dict, KX_SoundActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_StateActuator::Type);
|
PyType_Ready_Attr(dict, KX_StateActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_TouchSensor::Type);
|
PyType_Ready_Attr(dict, KX_TouchSensor);
|
||||||
PyType_Ready_ADD(dict, &KX_TrackToActuator::Type);
|
PyType_Ready_Attr(dict, KX_TrackToActuator);
|
||||||
PyType_Ready_ADD(dict, &KX_VehicleWrapper::Type);
|
PyType_Ready_Attr(dict, KX_VehicleWrapper);
|
||||||
PyType_Ready_ADD(dict, &KX_VertexProxy::Type);
|
PyType_Ready_Attr(dict, KX_VertexProxy);
|
||||||
PyType_Ready_ADD(dict, &KX_VisibilityActuator::Type);
|
PyType_Ready_Attr(dict, KX_VisibilityActuator);
|
||||||
PyType_Ready_ADD(dict, &PyObjectPlus::Type);
|
PyType_Ready_Attr(dict, PyObjectPlus);
|
||||||
PyType_Ready_ADD(dict, &SCA_2DFilterActuator::Type);
|
PyType_Ready_Attr(dict, SCA_2DFilterActuator);
|
||||||
PyType_Ready_ADD(dict, &SCA_ANDController::Type);
|
PyType_Ready_Attr(dict, SCA_ANDController);
|
||||||
PyType_Ready_ADD(dict, &SCA_ActuatorSensor::Type);
|
PyType_Ready_Attr(dict, SCA_ActuatorSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_AlwaysSensor::Type);
|
PyType_Ready_Attr(dict, SCA_AlwaysSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_DelaySensor::Type);
|
PyType_Ready_Attr(dict, SCA_DelaySensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_ILogicBrick::Type);
|
PyType_Ready_Attr(dict, SCA_ILogicBrick);
|
||||||
PyType_Ready_ADD(dict, &SCA_IObject::Type);
|
PyType_Ready_Attr(dict, SCA_IObject);
|
||||||
PyType_Ready_ADD(dict, &SCA_ISensor::Type);
|
PyType_Ready_Attr(dict, SCA_ISensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_JoystickSensor::Type);
|
PyType_Ready_Attr(dict, SCA_JoystickSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_KeyboardSensor::Type);
|
PyType_Ready_Attr(dict, SCA_KeyboardSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_MouseSensor::Type);
|
PyType_Ready_Attr(dict, SCA_MouseSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_NANDController::Type);
|
PyType_Ready_Attr(dict, SCA_NANDController);
|
||||||
PyType_Ready_ADD(dict, &SCA_NORController::Type);
|
PyType_Ready_Attr(dict, SCA_NORController);
|
||||||
PyType_Ready_ADD(dict, &SCA_ORController::Type);
|
PyType_Ready_Attr(dict, SCA_ORController);
|
||||||
PyType_Ready_ADD(dict, &SCA_PropertyActuator::Type);
|
PyType_Ready_Attr(dict, SCA_PropertyActuator);
|
||||||
PyType_Ready_ADD(dict, &SCA_PropertySensor::Type);
|
PyType_Ready_Attr(dict, SCA_PropertySensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_PythonController::Type);
|
PyType_Ready_Attr(dict, SCA_PythonController);
|
||||||
PyType_Ready_ADD(dict, &SCA_RandomActuator::Type);
|
PyType_Ready_Attr(dict, SCA_RandomActuator);
|
||||||
PyType_Ready_ADD(dict, &SCA_RandomSensor::Type);
|
PyType_Ready_Attr(dict, SCA_RandomSensor);
|
||||||
PyType_Ready_ADD(dict, &SCA_XNORController::Type);
|
PyType_Ready_Attr(dict, SCA_XNORController);
|
||||||
PyType_Ready_ADD(dict, &SCA_XORController::Type);
|
PyType_Ready_Attr(dict, SCA_XORController);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -300,18 +300,10 @@ PyAttributeDef KX_RadarSensor::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_RadarSensor::py_getattro(PyObject *attr)
|
PyObject* KX_RadarSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
py_getattro_up(KX_NearSensor);
|
py_getattro_up(KX_NearSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_RadarSensor::py_setattro(PyObject *attr, PyObject* value)
|
int KX_RadarSensor::py_setattro(PyObject *attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(KX_NearSensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return KX_NearSensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -446,17 +446,11 @@ PyObject* KX_RaySensor::PyGetHitNormal(PyObject* self)
|
|||||||
|
|
||||||
|
|
||||||
PyObject* KX_RaySensor::py_getattro(PyObject *attr) {
|
PyObject* KX_RaySensor::py_getattro(PyObject *attr) {
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_RaySensor::py_setattro(PyObject *attr, PyObject *value) {
|
int KX_RaySensor::py_setattro(PyObject *attr, PyObject *value) {
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// <----- Deprecated
|
// <----- Deprecated
|
||||||
|
|||||||
@@ -257,18 +257,12 @@ PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, con
|
|||||||
|
|
||||||
PyObject* KX_SCA_AddObjectActuator::py_getattro(PyObject *attr)
|
PyObject* KX_SCA_AddObjectActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_SCA_AddObjectActuator::py_setattro(PyObject *attr, PyObject* value)
|
int KX_SCA_AddObjectActuator::py_setattro(PyObject *attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. setObject */
|
/* 1. setObject */
|
||||||
|
|||||||
@@ -94,18 +94,12 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_SCA_DynamicActuator::py_getattro(PyObject *attr)
|
PyObject* KX_SCA_DynamicActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_SCA_DynamicActuator::py_setattro(PyObject *attr, PyObject* value)
|
int KX_SCA_DynamicActuator::py_setattro(PyObject *attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,18 +96,12 @@ PyAttributeDef KX_SCA_ReplaceMeshActuator::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_SCA_ReplaceMeshActuator::py_getattro(PyObject *attr)
|
PyObject* KX_SCA_ReplaceMeshActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_SCA_ReplaceMeshActuator::py_setattro(PyObject *attr, PyObject* value)
|
int KX_SCA_ReplaceMeshActuator::py_setattro(PyObject *attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* KX_SCA_ReplaceMeshActuator::pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
|
PyObject* KX_SCA_ReplaceMeshActuator::pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
|
|||||||
@@ -1594,11 +1594,7 @@ PyAttributeDef KX_Scene::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_Scene::py_getattro(PyObject *attr)
|
PyObject* KX_Scene::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
PyObject *object = PyDict_GetItem(m_attrlist, attr);
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
|
|
||||||
object = PyDict_GetItem(m_attrlist, attr);
|
|
||||||
if (object)
|
if (object)
|
||||||
{
|
{
|
||||||
Py_INCREF(object);
|
Py_INCREF(object);
|
||||||
|
|||||||
@@ -278,18 +278,12 @@ PyAttributeDef KX_SceneActuator::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_SceneActuator::py_getattro(PyObject *attr)
|
PyObject* KX_SceneActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_SceneActuator::py_setattro(PyObject *attr, PyObject *value)
|
int KX_SceneActuator::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
|
PyObject* KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
|
|||||||
@@ -292,20 +292,13 @@ PyAttributeDef KX_TouchSensor::Attributes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyObject* KX_TouchSensor::py_getattro(PyObject *attr)
|
PyObject* KX_TouchSensor::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object= py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_ISensor);
|
py_getattro_up(SCA_ISensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_TouchSensor::py_setattro(PyObject *attr, PyObject *value)
|
int KX_TouchSensor::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_ISensor);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return SCA_ISensor::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Python API */
|
/* Python API */
|
||||||
|
|||||||
@@ -506,18 +506,12 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT
|
|||||||
|
|
||||||
PyObject* KX_TrackToActuator::py_getattro(PyObject *attr)
|
PyObject* KX_TrackToActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_TrackToActuator::py_setattro(PyObject *attr, PyObject* value)
|
int KX_TrackToActuator::py_setattro(PyObject *attr, PyObject* value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1. setObject */
|
/* 1. setObject */
|
||||||
|
|||||||
@@ -136,18 +136,12 @@ PyAttributeDef KX_VisibilityActuator::Attributes[] = {
|
|||||||
|
|
||||||
PyObject* KX_VisibilityActuator::py_getattro(PyObject *attr)
|
PyObject* KX_VisibilityActuator::py_getattro(PyObject *attr)
|
||||||
{
|
{
|
||||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
|
||||||
if (object != NULL)
|
|
||||||
return object;
|
|
||||||
py_getattro_up(SCA_IActuator);
|
py_getattro_up(SCA_IActuator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_VisibilityActuator::py_setattro(PyObject *attr, PyObject *value)
|
int KX_VisibilityActuator::py_setattro(PyObject *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
py_setattro_up(SCA_IActuator);
|
||||||
if (ret >= 0)
|
|
||||||
return ret;
|
|
||||||
return SCA_IActuator::py_setattro(attr, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user