BGE Python API
authorCampbell Barton <ideasman42@gmail.com>
Sun, 28 Jun 2009 11:22:26 +0000 (11:22 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 28 Jun 2009 11:22:26 +0000 (11:22 +0000)
Remove the last of the odd C++/python wrapper code from http://www.python.org/doc/PyCPP.html (~1998)

* Use python subclasses rather then having fake subclassing through get/set attributes calling parent types.
* PyObject getset arrays are created while initializing the types, converted from our own attribute arrays. This way python deals with subclasses and we dont have to define getattro or setattro functions for each type.
* GameObjects and Scenes no longer have attribute access to properties. only dictionary style access - ob['prop']
* remove each class's get/set/dir functions.
* remove isA() methods, can use PyObject_TypeCheck() in C and issubclass() in python.
* remove Parents[] array for each C++ class, was only used for isA() and wasnt correct in quite a few cases.
* remove PyTypeObject that was being passed as the last argument to each class (the parent classes too).

TODO -
* Light and VertexProxy need to be converted to using attributes.
* memory for getset arrays is never freed, not that bad since its will only allocates once.

132 files changed:
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.h
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Expressions/ListValue.h
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.h
source/gameengine/GameLogic/SCA_ANDController.cpp
source/gameengine/GameLogic/SCA_ANDController.h
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.h
source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
source/gameengine/GameLogic/SCA_AlwaysSensor.h
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.h
source/gameengine/GameLogic/SCA_ExpressionController.cpp
source/gameengine/GameLogic/SCA_ExpressionController.h
source/gameengine/GameLogic/SCA_IActuator.cpp
source/gameengine/GameLogic/SCA_IActuator.h
source/gameengine/GameLogic/SCA_IController.cpp
source/gameengine/GameLogic/SCA_IController.h
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_IObject.cpp
source/gameengine/GameLogic/SCA_IObject.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.h
source/gameengine/GameLogic/SCA_NANDController.cpp
source/gameengine/GameLogic/SCA_NANDController.h
source/gameengine/GameLogic/SCA_NORController.cpp
source/gameengine/GameLogic/SCA_NORController.h
source/gameengine/GameLogic/SCA_ORController.cpp
source/gameengine/GameLogic/SCA_ORController.h
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.h
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PropertySensor.h
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_PythonController.h
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomActuator.h
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_RandomSensor.h
source/gameengine/GameLogic/SCA_XNORController.cpp
source/gameengine/GameLogic/SCA_XNORController.h
source/gameengine/GameLogic/SCA_XORController.cpp
source/gameengine/GameLogic/SCA_XORController.h
source/gameengine/Ketsji/BL_Shader.cpp
source/gameengine/Ketsji/BL_Shader.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/Ketsji/KX_CDActuator.cpp
source/gameengine/Ketsji/KX_CDActuator.h
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_CameraActuator.h
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.h
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.h
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameActuator.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.h
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_Light.h
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MeshProxy.h
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.h
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.h
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_ObjectActuator.h
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_ParentActuator.h
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolyProxy.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_PyMath.h
source/gameengine/Ketsji/KX_PythonInitTypes.cpp
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RadarSensor.h
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_RaySensor.h
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SceneActuator.h
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.h
source/gameengine/Ketsji/KX_StateActuator.cpp
source/gameengine/Ketsji/KX_StateActuator.h
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.h
source/gameengine/Ketsji/KX_VehicleWrapper.cpp
source/gameengine/Ketsji/KX_VehicleWrapper.h
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/Ketsji/KX_VertexProxy.h
source/gameengine/Ketsji/KX_VisibilityActuator.cpp
source/gameengine/Ketsji/KX_VisibilityActuator.h

index ce4311f57bf4ebfb6a8bc5720adf35a252cd3a2e..1787909b06499217ddaa9575a5fd4cab22526867 100644 (file)
@@ -1006,19 +1006,17 @@ PyTypeObject BL_ActionActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-PyParentObject BL_ActionActuator::Parents[] = {
-       &BL_ActionActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
-};
 
 PyMethodDef BL_ActionActuator::Methods[] = {
        //Deprecated ----->
@@ -1065,19 +1063,6 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* BL_ActionActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* BL_ActionActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int BL_ActionActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
-
-
 PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
index 422b16bb3ecf452a99f77902b8eb30be758d98f0..e328ce126ca0b75d983dbd703eb80df5a68caea4 100644 (file)
@@ -49,9 +49,8 @@ public:
                                                short   blendin,
                                                short   priority,
                                                short   end_reset,
-                                               float   stride,
-                                               PyTypeObject* T=&Type) 
-               : SCA_IActuator(gameobj,T),
+                                               float   stride) 
+               : SCA_IActuator(gameobj),
                
                m_lastpos(0, 0, 0),
                m_blendframe(0),
@@ -113,10 +112,6 @@ public:
 
        KX_PYMETHOD_DOC(BL_ActionActuator,setChannel);
 
-       virtual PyObject* py_getattro(PyObject* attr);
-       virtual PyObject*               py_getattro_dict();
-       virtual int py_setattro(PyObject* attr, PyObject* value);
-
        static PyObject*        pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
index 7aa8714de3a432a2bf097fae883377587a4ed5f2..b92e94b6e0448afabc7699d88aef1d2c7592303b 100644 (file)
@@ -428,19 +428,17 @@ PyTypeObject BL_ShapeActionActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-PyParentObject BL_ShapeActionActuator::Parents[] = {
-       &BL_ShapeActionActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
-};
 
 PyMethodDef BL_ShapeActionActuator::Methods[] = {
        {"setAction", (PyCFunction) BL_ShapeActionActuator::sPySetAction, METH_VARARGS, (PY_METHODCHAR)SetAction_doc},
@@ -480,19 +478,6 @@ PyAttributeDef BL_ShapeActionActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-
-PyObject* BL_ShapeActionActuator::py_getattro(PyObject* attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* BL_ShapeActionActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int BL_ShapeActionActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
-
 /*     setStart                                                              */
 const char BL_ShapeActionActuator::GetAction_doc[] = 
 "getAction()\n"
index d268eef6d23c73ae6372d2815a7fddf78daee007..890fe3f9de9dedecf0dd90ff9debcfbdeb3bd293 100644 (file)
@@ -50,9 +50,8 @@ public:
                                                short   playtype,
                                                short   blendin,
                                                short   priority,
-                                               float   stride,
-                                               PyTypeObject* T=&Type) 
-               : SCA_IActuator(gameobj,T),
+                                               float   stride) 
+               : SCA_IActuator(gameobj),
                
                m_lastpos(0, 0, 0),
                m_blendframe(0),
@@ -106,10 +105,6 @@ public:
        KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetType);
        KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetType);
 
-       virtual PyObject* py_getattro(PyObject* attr);
-       virtual PyObject*               py_getattro_dict();
-       virtual int py_setattro(PyObject* attr, PyObject* value);
-
        static PyObject*        pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
index 59344ddb7b7f42bf9f9dc53c8ae6faac28eae6f5..4cad4728521d48fc9dbd02f84462197892b58b28 100644 (file)
@@ -289,25 +289,17 @@ PyTypeObject CListValue::Type = {
        0,                              /*tp_hash*/
        0,                              /*tp_call */
        0,
-       py_base_getattro,
-       py_base_setattro,
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
        0,
-       Py_TPFLAGS_DEFAULT,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        0,0,0,0,0,0,0,
-       Methods
-};
-
-
-
-PyParentObject CListValue::Parents[] = {
-       &CListValue::Type,
-       &CValue::Type,
-               NULL
+       Methods,
+       0,
+       0,
+       &CValue::Type
 };
 
-
-
-
 PyMethodDef CListValue::Methods[] = {
        /* List style access */
        {"append", (PyCFunction)CListValue::sPyappend,METH_O},
@@ -329,21 +321,12 @@ PyAttributeDef CListValue::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* CListValue::py_getattro(PyObject* attr) {
-       py_getattro_up(CValue);
-}
-
-PyObject* CListValue::py_getattro_dict() {
-       py_getattro_dict_up(CValue);
-}
-
-
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-CListValue::CListValue(PyTypeObject *T ) 
-: CPropValue(T)
+CListValue::CListValue()
+: CPropValue()
 {
        m_bReleaseContents=true;        
 }
index 68e900e25e096b66c757a978754394128c1f7036..98e6f216f11c903c82b401781b2ca9bbf9795d89 100644 (file)
@@ -24,7 +24,7 @@ class CListValue : public CPropValue
        //PLUGIN_DECLARE_SERIAL (CListValue,CValue)
 
 public:
-       CListValue(PyTypeObject *T = &Type);
+       CListValue();
        virtual ~CListValue();
 
        void AddConfigurationData(CValue* menuvalue);
@@ -60,8 +60,6 @@ public:
 
        bool CheckEqual(CValue* first,CValue* second);
 
-       virtual PyObject* py_getattro(PyObject* attr);
-       virtual PyObject* py_getattro_dict();
        virtual PyObject* py_repr(void) {
                PyObject *py_proxy= this->GetProxy();
                PyObject *py_list= PySequence_List(py_proxy);
index 2d4cc612aef2e5db90b84001f90b9b1c278fd166..552e839d2b8e46221c50debc68ca19265fc2a5e1 100644 (file)
@@ -75,10 +75,15 @@ PyTypeObject PyObjectPlus::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       NULL // no subtype
 };
 
 
@@ -105,9 +110,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self)                          // python wrapper
        PyObject_DEL( self );
 };
 
-PyObjectPlus::PyObjectPlus(PyTypeObject *T) : SG_QList()                               // constructor
+PyObjectPlus::PyObjectPlus() : SG_QList()                              // constructor
 {
-       MT_assert(T != NULL);
        m_proxy= NULL;
 };
   
@@ -115,77 +119,20 @@ PyObjectPlus::PyObjectPlus(PyTypeObject *T) : SG_QList()                          // constructor
  * PyObjectPlus Methods        -- Every class, even the abstract one should have a Methods
 ------------------------------*/
 PyMethodDef PyObjectPlus::Methods[] = {
-  {"isA",               (PyCFunction) sPyisA,                  METH_O},
   {NULL, NULL}         /* Sentinel */
 };
 
+#define attr_invalid (&(PyObjectPlus::Attributes[0]))
 PyAttributeDef PyObjectPlus::Attributes[] = {
        KX_PYATTRIBUTE_RO_FUNCTION("invalid",           PyObjectPlus, pyattr_get_invalid),
        {NULL} //Sentinel
 };
 
-PyObject* PyObjectPlus::pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{      
-       Py_RETURN_FALSE;
-}
-
-/*------------------------------
- * PyObjectPlus Parents                -- Every class, even the abstract one should have parents
-------------------------------*/
-PyParentObject PyObjectPlus::Parents[] = {&PyObjectPlus::Type, NULL};
-
-/*------------------------------
- * PyObjectPlus attributes     -- attributes
-------------------------------*/
-
 
-/* This should be the entry in Type since it takes the C++ class from PyObjectPlus_Proxy */
-PyObject *PyObjectPlus::py_base_getattro(PyObject * self, PyObject *attr)
-{
-       PyObjectPlus *self_plus= BGE_PROXY_REF(self);
-       if(self_plus==NULL) {
-               if(!strcmp("invalid", PyString_AsString(attr))) {
-                       Py_RETURN_TRUE;
-               }
-               PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
-               return NULL;
-       }
-       
-       PyObject *ret= self_plus->py_getattro(attr);
-       
-       /* Attribute not found, was this a __dict__ lookup?, otherwise set an error if none is set */
-       if(ret==NULL) {
-               char *attr_str= PyString_AsString(attr);
-               
-               if (strcmp(attr_str, "__dict__")==0)
-               {
-                       /* the error string will probably not
-                        * be set but just incase clear it */
-                       PyErr_Clear(); 
-                       ret= self_plus->py_getattro_dict();
-               }
-               else if (!PyErr_Occurred()) {
-                       /* We looked for an attribute but it wasnt found
-                        * since py_getattro didnt set the error, set it here */
-                       PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", self->ob_type->tp_name, attr_str);
-               }
-       }
-       return ret;
-}
 
-/* This should be the entry in Type since it takes the C++ class from PyObjectPlus_Proxy */
-int PyObjectPlus::py_base_setattro(PyObject *self, PyObject *attr, PyObject *value)
-{
-       PyObjectPlus *self_plus= BGE_PROXY_REF(self);
-       if(self_plus==NULL) {
-               PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
-               return -1;
-       }
-       
-       if (value==NULL)
-               return self_plus->py_delattro(attr);
-       
-       return self_plus->py_setattro(attr, value); 
+PyObject* PyObjectPlus::pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{      
+       return PyBool_FromLong(self_v ? 1:0);
 }
 
 PyObject *PyObjectPlus::py_base_repr(PyObject *self)                   // This should be the entry in Type.
@@ -200,42 +147,19 @@ PyObject *PyObjectPlus::py_base_repr(PyObject *self)                      // This should be the ent
        return self_plus->py_repr();  
 }
 
-PyObject *PyObjectPlus::py_getattro(PyObject* attr)
+/* note, this is called as a python 'getset, where the PyAttributeDef is the closure */
+PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef)
 {
-       PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
-       if (descr == NULL) {
-               return NULL; /* py_base_getattro sets the error, this way we can avoid setting the error at many levels */
-       } else {
-               /* Copied from py_getattro_up */
-               if (PyCObject_Check(descr)) {
-                       return py_get_attrdef((void *)this, (const PyAttributeDef*)PyCObject_AsVoidPtr(descr));
-               } else if (descr->ob_type->tp_descr_get) {
-                       return PyCFunction_New(((PyMethodDescrObject *)descr)->d_method, this->m_proxy);
-               } else {
-                       return NULL;
-               }
-               /* end py_getattro_up copy */
-       }
-}
-
-PyObject* PyObjectPlus::py_getattro_dict() {
-       return py_getattr_dict(NULL, Type.tp_dict);
-}
+       void *self= (void *)(BGE_PROXY_REF(self_py));
+       if(self==NULL) {
+               if(attrdef == attr_invalid)
+                       Py_RETURN_TRUE; // dont bother running the function
 
-int PyObjectPlus::py_delattro(PyObject* attr)
-{
-       PyErr_SetString(PyExc_AttributeError, "attribute cant be deleted");
-       return 1;
-}
+               PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
+               return NULL;
+       }
 
-int PyObjectPlus::py_setattro(PyObject *attr, PyObject* value)
-{
-       PyErr_SetString(PyExc_AttributeError, "attribute cant be set");
-       return PY_SET_ATTR_MISSING;
-}
 
-PyObject *PyObjectPlus::py_get_attrdef(void *self, const PyAttributeDef *attrdef)
-{
        if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_DUMMY)
        {
                // fake attribute, ignore
@@ -355,8 +279,15 @@ PyObject *PyObjectPlus::py_get_attrdef(void *self, const PyAttributeDef *attrdef
        }
 }
 
-int PyObjectPlus::py_set_attrdef(void *self, const PyAttributeDef *attrdef, PyObject *value)
+/* note, this is called as a python getset */
+int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef)
 {
+       void *self= (void *)(BGE_PROXY_REF(self_py));
+       if(self==NULL) {
+               PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
+               return PY_SET_ATTR_FAIL;
+       }
+
        void *undoBuffer = NULL;
        void *sourceBuffer = NULL;
        size_t bufferSize = 0;
@@ -834,48 +765,6 @@ PyObject *PyObjectPlus::py_repr(void)
        return NULL;
 }
 
-/*------------------------------
- * PyObjectPlus isA            -- the isA functions
-------------------------------*/
-bool PyObjectPlus::isA(PyTypeObject *T)                // if called with a Type, use "typename"
-{
-       int i;
-       PyParentObject  P;
-       PyParentObject *Ps = GetParents();
-
-       for (P = Ps[i=0]; P != NULL; P = Ps[i++])
-               if (P==T)
-                       return true;
-
-       return false;
-}
-
-
-bool PyObjectPlus::isA(const char *mytypename)         // check typename of each parent
-{
-       int i;
-       PyParentObject  P;
-       PyParentObject *Ps = GetParents();
-  
-       for (P = Ps[i=0]; P != NULL; P = Ps[i++])
-               if (strcmp(P->tp_name, mytypename)==0)
-                       return true;
-
-       return false;
-}
-
-PyObject *PyObjectPlus::PyisA(PyObject *value)         // Python wrapper for isA
-{
-       if (PyType_Check(value)) {
-               return PyBool_FromLong(isA((PyTypeObject *)value));
-       } else if (PyString_Check(value)) {
-               return PyBool_FromLong(isA(PyString_AsString(value)));
-       }
-    PyErr_SetString(PyExc_TypeError, "object.isA(value): expected a type or a string");
-    return NULL;       
-}
-
-
 void PyObjectPlus::ProcessReplica()
 {
        /* Clear the proxy, will be created again if needed with GetProxy()
@@ -900,27 +789,6 @@ void PyObjectPlus::InvalidateProxy()               // check typename of each parent
        }
 }
 
-/* Utility function called by the macro py_getattro_up()
- * for getting ob.__dict__() values from our PyObject
- * this is used by python for doing dir() on an object, so its good
- * if we return a list of attributes and methods.
- * 
- * Other then making dir() useful the value returned from __dict__() is not useful
- * since every value is a Py_None
- * */
-PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict)
-{
-    if(pydict==NULL) { /* incase calling __dict__ on the parent of this object raised an error */
-       PyErr_Clear();
-       pydict = PyDict_New();
-    }
-       
-       PyDict_Update(pydict, tp_dict);
-       return pydict;
-}
-
-
-
 PyObject *PyObjectPlus::GetProxy_Ext(PyObjectPlus *self, PyTypeObject *tp)
 {
        if (self->m_proxy==NULL)
index 3b5eebe9893d3cc42c786996f044557b7fb6202b..0fe3e9f083d6decfcd76385f237250ac09234a83 100644 (file)
@@ -155,41 +155,10 @@ typedef struct {
   static PyTypeObject   Type; \
   static PyMethodDef    Methods[]; \
   static PyAttributeDef Attributes[]; \
-  static PyParentObject Parents[]; \
   virtual PyTypeObject *GetType(void) {return &Type;}; \
-  virtual PyParentObject *GetParents(void) {return Parents;} \
   virtual PyObject *GetProxy() {return GetProxy_Ext(this, &Type);}; \
   virtual PyObject *NewProxy(bool py_owns) {return NewProxy_Ext(this, &Type, py_owns);}; \
 
-
-
-
-                                                               // This defines the py_getattro_up macro
-                                                               // which allows attribute and method calls
-                                                               // to be properly passed up the hierarchy.
-                                                               // 
-                                                               // Note, PyDict_GetItem() WONT set an exception!
-                                                               // let the py_base_getattro function do this.
-
-#define py_getattro_up(Parent) \
-       \
-       PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
-        \
-       if(descr) { \
-               if (PyCObject_Check(descr)) { \
-                       return py_get_attrdef((void *)this, (const PyAttributeDef*)PyCObject_AsVoidPtr(descr)); \
-               } else if (descr->ob_type->tp_descr_get) { \
-                       return PyCFunction_New(((PyMethodDescrObject *)descr)->d_method, this->m_proxy); \
-               } else { \
-                       return NULL; \
-               } \
-       } else { \
-               return Parent::py_getattro(attr); \
-       }
-
-#define py_getattro_dict_up(Parent) \
-       return py_getattr_dict(Parent::py_getattro_dict(), Type.tp_dict);
-
 /*
  * nonzero values are an error for setattr
  * however because of the nested lookups we need to know if the errors
@@ -201,29 +170,6 @@ typedef struct {
 #define PY_SET_ATTR_MISSING            -1
 #define PY_SET_ATTR_SUCCESS             0
 
-#define py_setattro_up(Parent) \
-       PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \
-        \
-       if(descr) { \
-               if (PyCObject_Check(descr)) { \
-                       const PyAttributeDef* attrdef= reinterpret_cast<const PyAttributeDef *>(PyCObject_AsVoidPtr(descr)); \
-                       if (attrdef->m_access == KX_PYATTRIBUTE_RO) { \
-                               PyErr_Format(PyExc_AttributeError, "\"%s\" is read only", PyString_AsString(attr)); \
-                               return PY_SET_ATTR_FAIL; \
-                       } \
-                       else { \
-                               return py_set_attrdef((void *)this, attrdef, value); \
-                       } \
-               } else { \
-                       PyErr_Format(PyExc_AttributeError, "\"%s\" cannot be set", PyString_AsString(attr)); \
-                       return PY_SET_ATTR_FAIL; \
-               } \
-       } else { \
-               PyErr_Clear(); \
-               return Parent::py_setattro(attr, value); \
-       }
-
-
 /**
  * These macros are helpfull when embedding Python routines. The second
  * macro is one that also requires a documentation string
@@ -493,7 +439,7 @@ class PyObjectPlus : public SG_QList
        Py_Header;                                                      // Always start with Py_Header
        
 public:
-       PyObjectPlus(PyTypeObject *T);
+       PyObjectPlus();
 
        PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */
        
@@ -501,30 +447,17 @@ public:
        
        /* These static functions are referenced by ALL PyObjectPlus_Proxy types
         * they take the C++ reference from the PyObjectPlus_Proxy and call
-        * its own virtual py_getattro, py_setattro etc. functions.
+        * its own virtual py_repr, py_base_dealloc ,etc. functions.
         */
        static void                     py_base_dealloc(PyObject *self);
-       static  PyObject*               py_base_getattro(PyObject * self, PyObject *attr);
-       static  int                     py_base_setattro(PyObject *self, PyObject *attr, PyObject *value);
        static PyObject*                py_base_repr(PyObject *self);
 
        /* These are all virtual python methods that are defined in each class
         * Our own fake subclassing calls these on each class, then calls the parent */
-       virtual PyObject*               py_getattro(PyObject *attr);
-       virtual PyObject*               py_getattro_dict();
-       virtual int                     py_delattro(PyObject *attr);
-       virtual int                     py_setattro(PyObject *attr, PyObject *value);
        virtual PyObject*               py_repr(void);
 
-       static PyObject*                py_get_attrdef(void *self, const PyAttributeDef *attrdef);
-       static int                              py_set_attrdef(void *self, const PyAttributeDef *attrdef, PyObject *value);
-       
-       /* isA() methods, shonky replacement for pythons issubclass()
-        * which we cant use because we have our own subclass system  */
-       bool isA(PyTypeObject *T);
-       bool isA(const char *mytypename);
-       
-       KX_PYMETHOD_O(PyObjectPlus,isA);
+       static PyObject*                py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef);
+       static int                              py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef);
        
        /* Kindof dumb, always returns True, the false case is checked for, before this function gets accessed */
        static PyObject*        pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
index 61dabff510b21bfbc786170dc2ae278c566c91ff..45eb15ecd08d31a8981312edc6d169b2a8796c30 100644 (file)
@@ -54,15 +54,15 @@ PyTypeObject CValue::Type = {
        py_base_repr,
        0,
        0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject CValue::Parents[] = {
-       &CValue::Type,
-               NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &PyObjectPlus::Type
 };
 
 PyMethodDef CValue::Methods[] = {
@@ -100,8 +100,8 @@ std::vector<SmartCValueRef> gRefList;
 //int gRefCountValue;
 #endif
 
-CValue::CValue(PyTypeObject *T)
-               : PyObjectPlus(T),
+CValue::CValue()
+               : PyObjectPlus(),
 #else
 CValue::CValue()
 : 
@@ -553,30 +553,6 @@ PyAttributeDef CValue::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-
-PyObject*      CValue::py_getattro(PyObject *attr)
-{      
-       char *attr_str= PyString_AsString(attr);
-       CValue* resultattr = GetProperty(attr_str);
-       if (resultattr)
-       {
-               /* only show the wanting here because python inspects for __class__ and KX_MeshProxy uses CValues name attr */
-               ShowDeprecationWarning("val = ob.attr", "val = ob['attr']");
-               
-               PyObject* pyconvert = resultattr->ConvertValueToPython();
-               
-               if (pyconvert)
-                       return pyconvert;
-               else
-                       return resultattr->GetProxy();
-       }
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* CValue::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
 PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) {
        CValue * self = static_cast<CValue *> (self_v);
        return PyString_FromString(self->GetName());
@@ -637,7 +613,7 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
        } else
        if (BGE_PROXY_CHECK_TYPE(pyobj)) /* Note, dont let these get assigned to GameObject props, must check elsewhere */
        {
-               if (BGE_PROXY_REF(pyobj) && (BGE_PROXY_REF(pyobj))->isA(&CValue::Type))
+               if (BGE_PROXY_REF(pyobj) && PyObject_TypeCheck(BGE_PROXY_REF(pyobj), &CValue::Type))
                {
                        vallie = (static_cast<CValue *>(BGE_PROXY_REF(pyobj)))->AddRef();
                } else {
@@ -656,57 +632,6 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
 
 }
 
-int    CValue::py_delattro(PyObject *attr)
-{
-       ShowDeprecationWarning("del ob.attr", "del ob['attr']");
-       
-       char *attr_str= PyString_AsString(attr);
-       if (RemoveProperty(attr_str))
-               return 0;
-       
-       PyErr_Format(PyExc_AttributeError, "attribute \"%s\" dosnt exist", attr_str);
-       return PY_SET_ATTR_MISSING;
-}
-
-int    CValue::py_setattro(PyObject *attr, PyObject* pyobj)
-{
-       ShowDeprecationWarning("ob.attr = val", "ob['attr'] = val");
-       
-       char *attr_str= PyString_AsString(attr);
-       CValue* oldprop = GetProperty(attr_str);        
-       CValue* vallie;
-
-       /* Dissallow python to assign GameObjects, Scenes etc as values */
-       if ((BGE_PROXY_CHECK_TYPE(pyobj)==0) && (vallie = ConvertPythonToValue(pyobj, "cvalue.attr = value: ")))
-       {
-               if (oldprop)
-                       oldprop->SetValue(vallie);
-               else
-                       SetProperty(attr_str, vallie);
-               
-               vallie->Release();
-       }
-       else {
-               // ConvertPythonToValue sets the error message
-               // must return missing so KX_GameObect knows this
-               // attribute was not a function or bult in attribute,
-               //
-               // CValue attributes override internal attributes
-               // so if it exists as a CValue attribute already,
-               // assume your trying to set it to a differnt CValue attribute
-               // otherwise return PY_SET_ATTR_MISSING so children
-               // classes know they can set it without conflict 
-               
-               if (GetProperty(attr_str))
-                       return PY_SET_ATTR_COERCE_FAIL; /* failed to set an existing attribute */
-               else
-                       return PY_SET_ATTR_MISSING; /* allow the KX_GameObject dict to set */
-       }
-       
-       //PyObjectPlus::py_setattro(attr,value);
-       return PY_SET_ATTR_SUCCESS;
-};
-
 PyObject*      CValue::ConvertKeysToPython( void )
 {
        PyObject *pylist = PyList_New( 0 );
index 29ef19b46c972019fceefc19d6ae8dd745b2c289..9da75b96e789c27d03935789d0774790eeebb9ef 100644 (file)
@@ -215,26 +215,18 @@ public:
        // Construction / Destruction
 #ifndef NO_EXP_PYTHON_EMBEDDING
 
-       CValue(PyTypeObject *T = &Type);
+       CValue();
        //static PyObject*      PyMake(PyObject*,PyObject*);
        virtual PyObject *py_repr(void)
        {
                return PyString_FromString((const char*)GetText());
        }
 
-
-
-       virtual PyObject*                       py_getattro(PyObject *attr);
-       virtual PyObject*                       py_getattro_dict();
        virtual PyObject*       ConvertValueToPython() {
                return NULL;
        }
 
        virtual CValue* ConvertPythonToValue(PyObject* pyobj, const char *error_prefix);
-
-
-       virtual int                             py_delattro(PyObject *attr);
-       virtual int                             py_setattro(PyObject *attr, PyObject* value);
        
        static PyObject * pyattr_get_name(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
        
@@ -417,8 +409,8 @@ class CPropValue : public CValue
 public:
 
 #ifndef NO_EXP_PYTHON_EMBEDDING        
-       CPropValue(PyTypeObject* T=&Type) :
-         CValue(T),
+       CPropValue() :
+         CValue(),
 #else
        CPropValue() :
 #endif //NO_EXP_PYTHON_EMBEDDING
index caed85b993842ccc59a320d744a75b090c2397f5..8e54043a1a25a7c269d853d4d80e6851ceae828f 100644 (file)
@@ -42,9 +42,8 @@ SCA_2DFilterActuator::SCA_2DFilterActuator(
                float float_arg,
                int int_arg,
                RAS_IRasterizer* rasterizer,
-               RAS_IRenderTools* rendertools,
-        PyTypeObject* T)
-    : SCA_IActuator(gameobj, T),
+               RAS_IRenderTools* rendertools)
+    : SCA_IActuator(gameobj),
      m_type(type),
         m_disableMotionBlur(flag),
         m_float_arg(float_arg),
@@ -125,22 +124,17 @@ PyTypeObject SCA_2DFilterActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-PyParentObject SCA_2DFilterActuator::Parents[] = {
-        &SCA_2DFilterActuator::Type,
-        &SCA_IActuator::Type,
-        &SCA_ILogicBrick::Type,
-        &CValue::Type,
-        NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-
 PyMethodDef SCA_2DFilterActuator::Methods[] = {
        /* add python functions to deal with m_msg... */
     {NULL,NULL}
@@ -154,18 +148,3 @@ PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
        KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
        { NULL }        //Sentinel
 };
-
-PyObject* SCA_2DFilterActuator::py_getattro(PyObject *attr) 
-{
-    py_getattro_up(SCA_IActuator);
-}
-
-PyObject* SCA_2DFilterActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int SCA_2DFilterActuator::py_setattro(PyObject *attr, PyObject* value) 
-{
-       py_setattro_up(SCA_IActuator);
-}
-
index 13b9997a0107bce26d6e16324dc102015b0d7e41..c357c4f3e377a5e8b344a1a3e4a0cbed3bd8f328 100644 (file)
@@ -56,23 +56,12 @@ public:
                float float_arg,
                int int_arg,
                RAS_IRasterizer* rasterizer,
-               RAS_IRenderTools* rendertools,
-        PyTypeObject* T=&Type
-        );
+               RAS_IRenderTools* rendertools);
 
        void    SetShaderText(const char *text);
     virtual ~SCA_2DFilterActuator();
     virtual bool Update();
 
     virtual CValue* GetReplica();
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-    virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
 };
 #endif
index 87f7c612e7c1023bbbe87540b80c5957d8bd3d38..fc2f9cdf27d93b07fa6e26ce1f9a755b5e381805 100644 (file)
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_ANDController::SCA_ANDController(SCA_IObject* gameobj,
-                                                                        PyTypeObject* T)
+SCA_ANDController::SCA_ANDController(SCA_IObject* gameobj)
        :
-       SCA_IController(gameobj,T)
+       SCA_IController(gameobj)
 {
 }
 
@@ -117,18 +116,15 @@ PyTypeObject SCA_ANDController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_ANDController::Parents[] = {
-       &SCA_ANDController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_ANDController::Methods[] = {
@@ -139,12 +135,4 @@ PyAttributeDef SCA_ANDController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_ANDController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_ANDController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index 9a359d57cb407864e80b0987f1ec666e4803019a..cb16d7fca01bcc125cb5871be9197f243ec4e8fe 100644 (file)
@@ -39,18 +39,10 @@ class SCA_ANDController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_ANDController(SCA_IObject* gameobj,PyTypeObject* T=&Type);
+       SCA_ANDController(SCA_IObject* gameobj);
        virtual ~SCA_ANDController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-
 };
 
 #endif //__KX_ANDCONTROLLER
index 4dad65c5a250854f48b40bf8bd95496da69700b0..b6a9471f23c28ecff886ed4413fe44aa7ca79e2b 100644 (file)
@@ -40,9 +40,8 @@
 
 SCA_ActuatorSensor::SCA_ActuatorSensor(SCA_EventManager* eventmgr,
                                                                         SCA_IObject* gameobj,
-                                                                        const STR_String& actname,
-                                                                        PyTypeObject* T )
-       : SCA_ISensor(gameobj,eventmgr,T),
+                                                                        const STR_String& actname)
+       : SCA_ISensor(gameobj,eventmgr),
          m_checkactname(actname)
 {
        m_actuator = GetParent()->FindActuator(m_checkactname);
@@ -139,18 +138,15 @@ PyTypeObject SCA_ActuatorSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_ActuatorSensor::Parents[] = {
-       &SCA_ActuatorSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_ActuatorSensor::Methods[] = {
@@ -166,18 +162,6 @@ PyAttributeDef SCA_ActuatorSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_ActuatorSensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_ActuatorSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_ActuatorSensor::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_ISensor);
-}
-
 int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
 {
        SCA_ActuatorSensor* sensor = reinterpret_cast<SCA_ActuatorSensor*>(self);
index 6655e08dc70821b72f7e608aaeba0bca259c4ec9..cf8e735cad4eee41fecb358e02c244f34199adb8 100644 (file)
@@ -46,8 +46,7 @@ class SCA_ActuatorSensor : public SCA_ISensor
 public:
        SCA_ActuatorSensor(class SCA_EventManager* eventmgr,
                                          SCA_IObject* gameobj,
-                                         const STR_String& actname,
-                                         PyTypeObject* T=&Type );
+                                         const STR_String& actname);
        
        virtual ~SCA_ActuatorSensor();
        virtual CValue* GetReplica();
@@ -61,10 +60,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* 3. setProperty */
        KX_PYMETHOD_DOC_VARARGS(SCA_ActuatorSensor,SetActuator);
        /* 4. getProperty */
index ff02680f1914c848460cd1262762e3e106170f42..a14db7debd9ecf8bff14d17ae64567f38e8b02cb 100644 (file)
@@ -48,9 +48,8 @@
 /* ------------------------------------------------------------------------- */
 
 SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
-                                                                SCA_IObject* gameobj,
-                                                                PyTypeObject* T)
-       : SCA_ISensor(gameobj,eventmgr, T)
+                                                                SCA_IObject* gameobj)
+       : SCA_ISensor(gameobj,eventmgr)
 {
        //SetDrawColor(255,0,0);
        Init();
@@ -122,18 +121,15 @@ PyTypeObject SCA_AlwaysSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_AlwaysSensor::Parents[] = {
-       &SCA_AlwaysSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_AlwaysSensor::Methods[] = {
@@ -144,12 +140,4 @@ PyAttributeDef SCA_AlwaysSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_AlwaysSensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_AlwaysSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
 /* eof */
index 0f85a641ef1e0c53e33c866e679e8a6395cff994..d58e05564d14555a6c34726e1de7d8ea738d0079 100644 (file)
@@ -39,22 +39,12 @@ class SCA_AlwaysSensor : public SCA_ISensor
        bool                    m_alwaysresult;
 public:
        SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
-                                       SCA_IObject* gameobj,
-                                       PyTypeObject* T =&Type);
+                                       SCA_IObject* gameobj);
        virtual ~SCA_AlwaysSensor();
        virtual CValue* GetReplica();
        virtual bool Evaluate();
        virtual bool IsPositiveTrigger();
        virtual void Init();
-
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       
 };
 
 #endif //__KX_ALWAYSSENSOR
index dcdae0b4e75bfb6f55c3d5a041a4e8dc2192d2ab..afc9028d95dd35a282acc817caf200270c2d88a9 100644 (file)
@@ -51,9 +51,8 @@ SCA_DelaySensor::SCA_DelaySensor(class SCA_EventManager* eventmgr,
                                                                 SCA_IObject* gameobj,
                                                                 int delay,
                                                                 int duration,
-                                                                bool repeat,
-                                                                PyTypeObject* T)
-       : SCA_ISensor(gameobj,eventmgr, T),
+                                                                bool repeat)
+       : SCA_ISensor(gameobj,eventmgr),
        m_repeat(repeat),
        m_delay(delay),
        m_duration(duration)
@@ -148,18 +147,15 @@ PyTypeObject SCA_DelaySensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_DelaySensor::Parents[] = {
-       &SCA_DelaySensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_DelaySensor::Methods[] = {
@@ -183,19 +179,6 @@ PyAttributeDef SCA_DelaySensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_DelaySensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_DelaySensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_DelaySensor::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_ISensor);
-}
-
-
 const char SCA_DelaySensor::SetDelay_doc[] = 
 "setDelay(delay)\n"
 "\t- delay: length of the initial OFF period as number of frame\n"
index 5ccb33f8a160ff1c9bf08db19258a16fe0724fda..8270e8959b7ac93997c8cdcc724ec1f6d630f14a 100644 (file)
@@ -47,8 +47,7 @@ public:
                                        SCA_IObject* gameobj,
                                        int delay,
                                        int duration,
-                                       bool repeat,
-                                       PyTypeObject* T =&Type);
+                                       bool repeat);
        virtual ~SCA_DelaySensor();
        virtual CValue* GetReplica();
        virtual bool Evaluate();
@@ -59,10 +58,6 @@ public:
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject*               py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
 
        /* setProperty */
        KX_PYMETHOD_DOC_VARARGS(SCA_DelaySensor,SetDelay);
index 8e044b89c71b704743295a24267343f01542647a..609693004748279f4ea15358635465536a847a81 100644 (file)
@@ -46,9 +46,8 @@
 /* ------------------------------------------------------------------------- */
 
 SCA_ExpressionController::SCA_ExpressionController(SCA_IObject* gameobj,
-                                                                                                  const STR_String& exprtext,
-                                                                                                  PyTypeObject* T)
-       :SCA_IController(gameobj,T),
+                                                                                                  const STR_String& exprtext)
+       :SCA_IController(gameobj),
        m_exprText(exprtext),
        m_exprCache(NULL)
 {
index 6a34d7b2dff9e8959425e3ad921bda2b008c97e6..705f6dfc415e4b0a4309a4be38f94e2f1ccce11f 100644 (file)
@@ -42,8 +42,7 @@ class SCA_ExpressionController : public SCA_IController
 
 public:
        SCA_ExpressionController(SCA_IObject* gameobj,
-                                                        const STR_String& exprtext,
-                                                        PyTypeObject* T=&Type );
+                                                        const STR_String& exprtext);
 
        virtual ~SCA_ExpressionController();
        virtual CValue* GetReplica();
@@ -54,14 +53,6 @@ public:
         *  so that self references are removed before the controller itself is released
         */
        virtual void Delete();
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-//     virtual PyObject* py_getattro(PyObject *attr);
-//     virtual PyObject* py_getattro_dict();
-
 };
 
 #endif //__KX_EXPRESSIONCONTROLLER
index be7c265168691a98a21b0986a04fdd56cc57ba63..0fda75590c1dac8674c1b73eaab1b241cf7e262f 100644 (file)
@@ -34,9 +34,8 @@
 
 using namespace std;
 
-SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj,
-                                                        PyTypeObject* T) :
-       SCA_ILogicBrick(gameobj,T),
+SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj) :
+       SCA_ILogicBrick(gameobj),
        m_links(0),
        m_posevent(false),
        m_negevent(false)
index 27afcbc386b2868b9451aaae19c1d64c7955ed87..13c718ee83711e7f8660f17635e70ddc9c0034ab 100644 (file)
@@ -61,8 +61,7 @@ public:
         * This class also inherits the default copy constructors
         */
 
-       SCA_IActuator(SCA_IObject* gameobj,
-                                 PyTypeObject* T =&Type); 
+       SCA_IActuator(SCA_IObject* gameobj); 
 
        /**
         * UnlinkObject(...)
index f2c3c83a2d99f34fc5c60574de6fc1591fda1dba..7880daf0eb426566fca2a6f94130bedf3ac846bf 100644 (file)
 #include <config.h>
 #endif
 
-SCA_IController::SCA_IController(SCA_IObject* gameobj,
-                                                                PyTypeObject* T)
+SCA_IController::SCA_IController(SCA_IObject* gameobj)
        :
-       SCA_ILogicBrick(gameobj,T),
+       SCA_ILogicBrick(gameobj),
        m_statemask(0),
        m_justActivated(false)
 {
@@ -217,16 +216,15 @@ PyTypeObject SCA_IController::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject SCA_IController::Parents[] = {
-       &SCA_IController::Type,
-       &CValue::Type,
-       NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_ILogicBrick::Type
 };
 
 PyMethodDef SCA_IController::Methods[] = {
@@ -248,22 +246,6 @@ PyAttributeDef SCA_IController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_IController::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_ILogicBrick);
-}
-
-PyObject* SCA_IController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ILogicBrick);
-}
-
-int SCA_IController::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ILogicBrick);
-}
-
-
-
 PyObject* SCA_IController::PyGetActuators()
 {
        ShowDeprecationWarning("getActuators()", "the actuators property");
index a52c57ab3ed6a11b8c495ef36ca23eea6ee2a03c..523878bee261d8ac97d966fbd668e9f17abac2ca 100644 (file)
@@ -47,7 +47,7 @@ protected:
        bool                                                            m_justActivated;
        bool                                                            m_bookmark;
 public:
-       SCA_IController(SCA_IObject* gameobj,PyTypeObject* T);
+       SCA_IController(SCA_IObject* gameobj);
        virtual ~SCA_IController();
        virtual void Trigger(class SCA_LogicManager* logicmgr)=0;
        void    LinkToSensor(SCA_ISensor* sensor);
@@ -98,10 +98,6 @@ public:
                }
        }
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-       
        KX_PYMETHOD_NOARGS(SCA_IController,GetSensors);
        KX_PYMETHOD_NOARGS(SCA_IController,GetActuators);
        KX_PYMETHOD_O(SCA_IController,GetSensor);
index 2dc80f54568560466434a2e0b3f37e323222c134..d747daec2b4dcd9b9a366967b45249951cf122ca 100644 (file)
 
 SCA_LogicManager* SCA_ILogicBrick::m_sCurrentLogicManager = NULL;
 
-SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj,
-                                                                PyTypeObject* T)
+SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj)
        :
-       CValue(T),
+       CValue(),
        m_gameobj(gameobj),
        m_Execute_Priority(0),
        m_Execute_Ueber_Priority(0),
@@ -195,22 +194,17 @@ PyTypeObject SCA_ILogicBrick::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-
-
-PyParentObject SCA_ILogicBrick::Parents[] = {
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type
 };
 
-
-
 PyMethodDef SCA_ILogicBrick::Methods[] = {
        // --> Deprecated
   {"getOwner", (PyCFunction) SCA_ILogicBrick::sPyGetOwner, METH_NOARGS},
@@ -245,21 +239,6 @@ int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef)
        return 0;
 }
 
-PyObject* SCA_ILogicBrick::py_getattro(PyObject *attr)
-{
-  py_getattro_up(CValue);
-}
-
-PyObject* SCA_ILogicBrick::py_getattro_dict() {
-       py_getattro_dict_up(CValue);
-}
-
-int SCA_ILogicBrick::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(CValue);
-}
-
-
 PyObject* SCA_ILogicBrick::PyGetOwner()
 {
        ShowDeprecationWarning("getOwner()", "the owner property");
index 779e5397a6aaccebfdce15c4edcd0591ecfd9bdc..5067985680280dd9477e6083a79386cc2db7a240 100644 (file)
@@ -53,7 +53,7 @@ protected:
        CValue* GetEvent();
 
 public:
-       SCA_ILogicBrick(SCA_IObject* gameobj,PyTypeObject* T );
+       SCA_ILogicBrick(SCA_IObject* gameobj);
        virtual ~SCA_ILogicBrick();
 
        void SetExecutePriority(int execute_Priority);
@@ -121,10 +121,6 @@ public:
        }
 
        virtual bool            LessComparedTo(SCA_ILogicBrick* other);
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
 
        static class SCA_LogicManager*  m_sCurrentLogicManager;
 
index 9876f2512c0010523c5a0cf7266641adbdae0813..698e845466a74a2702448256bea5309b966b67ec 100644 (file)
 MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0);
 SG_QList SCA_IObject::m_activeBookmarkedControllers;
 
-SCA_IObject::SCA_IObject(PyTypeObject* T): CValue(T), m_initState(0), m_state(0), m_firstState(NULL)
-
+SCA_IObject::SCA_IObject():
+       CValue(),
+       m_initState(0),
+       m_state(0),
+       m_firstState(NULL)
 {
        m_suspended = false;
 }
@@ -347,22 +350,17 @@ PyTypeObject SCA_IObject::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-
-
-PyParentObject SCA_IObject::Parents[] = {
-       &SCA_IObject::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type
 };
 
-
-
 PyMethodDef SCA_IObject::Methods[] = {
        //{"setOrientation", (PyCFunction) SCA_IObject::sPySetOrientation, METH_VARARGS},
        //{"getOrientation", (PyCFunction) SCA_IObject::sPyGetOrientation, METH_VARARGS},
@@ -372,12 +370,3 @@ PyMethodDef SCA_IObject::Methods[] = {
 PyAttributeDef SCA_IObject::Attributes[] = {
        { NULL }        //Sentinel
 };
-
-
-PyObject* SCA_IObject::py_getattro(PyObject *attr) {
-       py_getattro_up(CValue);
-}
-
-PyObject* SCA_IObject::py_getattro_dict() {
-       py_getattro_dict_up(CValue);
-}
index eae427741ca329956e11468e8b9d7032ad98298e..3060410dc6b467a4c64bf22f5635e8780221d0da 100644 (file)
@@ -105,7 +105,7 @@ protected:
 
 public:
        
-       SCA_IObject(PyTypeObject* T=&Type);
+       SCA_IObject();
        virtual ~SCA_IObject();
 
        SCA_ControllerList& GetControllers()
@@ -199,15 +199,12 @@ public:
        unsigned int GetState(void)     { return m_state; }
 
 //     const class MT_Point3&  ConvertPythonPylist(PyObject* pylist);
-       
-       // here come the python forwarded methods
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
 
        virtual int GetGameObjectType() {return -1;}
        
        typedef enum ObjectTypes {
                OBJ_ARMATURE=0,
+               OBJ_CAMERA=1,
        }ObjectTypes;
 
 };
index 2783bf146004489f701e9b8b0a3877d470a30cac..de7030197b281b6fc4a4ad8595ffadba9effca7a 100644 (file)
@@ -50,9 +50,8 @@ void  SCA_ISensor::ReParent(SCA_IObject* parent)
 
 
 SCA_ISensor::SCA_ISensor(SCA_IObject* gameobj,
-                                                class SCA_EventManager* eventmgr,
-                                                PyTypeObject* T ) :
-       SCA_ILogicBrick(gameobj,T)
+                                                class SCA_EventManager* eventmgr) :
+       SCA_ILogicBrick(gameobj)
 {
        m_links = 0;
        m_suspended = false;
@@ -490,18 +489,17 @@ PyTypeObject SCA_ISensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ILogicBrick::Type
 };
 
-PyParentObject SCA_ISensor::Parents[] = {
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
-};
 PyMethodDef SCA_ISensor::Methods[] = {
        //Deprecated functions ----->
        {"isPositive", (PyCFunction) SCA_ISensor::sPyIsPositive, 
@@ -548,19 +546,6 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_ISensor::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_ILogicBrick);
-}
-
-PyObject* SCA_ISensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ILogicBrick);
-}
-
-int SCA_ISensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ILogicBrick);
-}
 
 PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
index 9bbd6ed41e42d139d75d31a5080f149e29f5da81..81864ab6a3461fd20378642744960db75369fe47 100644 (file)
@@ -101,8 +101,7 @@ public:
        };
 
        SCA_ISensor(SCA_IObject* gameobj,
-                               class SCA_EventManager* eventmgr,
-                               PyTypeObject* T );;
+                               class SCA_EventManager* eventmgr);;
        ~SCA_ISensor();
        virtual void    ReParent(SCA_IObject* parent);
 
@@ -173,10 +172,6 @@ public:
                { return !m_links; }
 
        /* Python functions: */
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
 
        //Deprecated functions ----->
        KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,IsPositive);
index 336529667d7f8b5ab54e16f841add695e4a09237..645c73efaa4e4e721f706d4ffb59ab95986f939a 100644 (file)
@@ -46,9 +46,8 @@ SCA_JoystickSensor::SCA_JoystickSensor(class SCA_JoystickManager* eventmgr,
                                                                           short int joymode,
                                                                           int axis, int axisf,int prec,
                                                                           int button,
-                                                                          int hat, int hatf, bool allevents,
-                                                                          PyTypeObject* T )
-                                                                          :SCA_ISensor(gameobj,eventmgr,T),
+                                                                          int hat, int hatf, bool allevents)
+                                                                          :SCA_ISensor(gameobj,eventmgr),
                                                                           m_pJoystickMgr(eventmgr),
                                                                           m_axis(axis),
                                                                           m_axisf(axisf),
@@ -270,22 +269,17 @@ PyTypeObject SCA_JoystickSensor::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-PyParentObject SCA_JoystickSensor::Parents[] = {
-               &SCA_JoystickSensor::Type,
-               &SCA_ISensor::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_ISensor::Type
 };
 
-
 PyMethodDef SCA_JoystickSensor::Methods[] = {
        //Deprecated functions ------>
        {"getIndex",     (PyCFunction) SCA_JoystickSensor::sPyGetIndex,         METH_NOARGS,    (PY_METHODCHAR)GetIndex_doc},
@@ -328,20 +322,6 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_JoystickSensor::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_JoystickSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_JoystickSensor::py_setattro(PyObject *attr, PyObject *value) 
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 
 /* get index ---------------------------------------------------------- */
 const char SCA_JoystickSensor::GetIndex_doc[] = 
index e6a1d2eef32e25bc8edb9cafabe3844e9136fed7..32f8ce567d28580161b2302591bc911546a8583d 100644 (file)
@@ -106,8 +106,7 @@ public:
                                           short int joymode,
                                           int axis, int axisf,int prec,
                                           int button,
-                                          int hat, int hatf, bool allevents,
-                                          PyTypeObject* T=&Type );
+                                          int hat, int hatf, bool allevents);
        virtual ~SCA_JoystickSensor();
        virtual CValue* GetReplica();
        
@@ -123,10 +122,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* Joystick Index */
        KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetIndex);
        KX_PYMETHOD_DOC_O(SCA_JoystickSensor,SetIndex);
index f8ee8ed8b414c23382108cedde31c8967a3d8ac1..34ade17ffb796bd5c1f6f143be0f7625367b444d 100644 (file)
@@ -48,9 +48,8 @@ SCA_KeyboardSensor::SCA_KeyboardSensor(SCA_KeyboardManager* keybdmgr,
                                                                           bool bAllKeys,
                                                                           const STR_String& targetProp,
                                                                           const STR_String& toggleProp,
-                                                                          SCA_IObject* gameobj,
-                                                                          PyTypeObject* T )
-       :SCA_ISensor(gameobj,keybdmgr,T),
+                                                                          SCA_IObject* gameobj)
+       :SCA_ISensor(gameobj,keybdmgr),
         m_pKeyboardMgr(keybdmgr),
         m_hotkey(hotkey),
         m_qual(qual),
@@ -632,18 +631,15 @@ PyTypeObject SCA_KeyboardSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_KeyboardSensor::Parents[] = {
-       &SCA_KeyboardSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_KeyboardSensor::Methods[] = {
@@ -672,20 +668,6 @@ PyAttributeDef SCA_KeyboardSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_KeyboardSensor::py_getattro(PyObject *attr)
-{
-  py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_KeyboardSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_KeyboardSensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 
 PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
index 033225cd9bea7eb26e16251db3fc0ee51f85b279..3185b386d41e3435edbfd7b2c2fc45d50a8b1e12 100644 (file)
@@ -94,8 +94,7 @@ public:
                                           bool bAllKeys,
                                           const STR_String& targetProp,
                                           const STR_String& toggleProp,
-                                          SCA_IObject* gameobj,
-                                          PyTypeObject* T=&Type );
+                                          SCA_IObject* gameobj);
        virtual ~SCA_KeyboardSensor();
        virtual CValue* GetReplica();
        virtual void Init();
@@ -110,10 +109,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        //Deprecated functions ----->
        /** 1. GetKey : check which key this sensor looks at */
        KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetKey);
index c5e1c3c0441f9086bc8412ea844f2e45b699c567..3a1e6191fdb4891c91a9763fa38450df296767a9 100644 (file)
@@ -49,9 +49,8 @@
 SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, 
                                                                 int startx,int starty,
                                                                 short int mousemode,
-                                                                SCA_IObject* gameobj, 
-                                                                PyTypeObject* T)
-    : SCA_ISensor(gameobj,eventmgr, T),
+                                                                SCA_IObject* gameobj)
+    : SCA_ISensor(gameobj,eventmgr),
        m_pMouseMgr(eventmgr),
        m_x(startx),
        m_y(starty)
@@ -313,18 +312,15 @@ PyTypeObject SCA_MouseSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_MouseSensor::Parents[] = {
-       &SCA_MouseSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_MouseSensor::Methods[] = {
@@ -342,18 +338,4 @@ PyAttributeDef SCA_MouseSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_MouseSensor::py_getattro(PyObject *attr) 
-{
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_MouseSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_MouseSensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 /* eof */
index 6d6302b514ab413ffe6a6ddc3a2d89c9376b01aa..47f0378bf69dd0a18cc4e32ff24dcfebfc956759 100644 (file)
@@ -92,8 +92,7 @@ class SCA_MouseSensor : public SCA_ISensor
        SCA_MouseSensor(class SCA_MouseManager* keybdmgr,
                                        int startx,int starty,
                                   short int mousemode,
-                                  SCA_IObject* gameobj,
-                                  PyTypeObject* T=&Type );
+                                  SCA_IObject* gameobj);
 
        virtual ~SCA_MouseSensor();
        virtual CValue* GetReplica();
@@ -109,10 +108,6 @@ class SCA_MouseSensor : public SCA_ISensor
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        //Deprecated functions ----->
        /* read x-coordinate */
        KX_PYMETHOD_DOC_NOARGS(SCA_MouseSensor,GetXPosition);
index d27aea5e6f74a99f40476c97e3b1e57711194e05..d4a6a444b970e4715820560c816c4566ef69429c 100644 (file)
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_NANDController::SCA_NANDController(SCA_IObject* gameobj,
-                                                                        PyTypeObject* T)
+SCA_NANDController::SCA_NANDController(SCA_IObject* gameobj)
        :
-       SCA_IController(gameobj,T)
+       SCA_IController(gameobj)
 {
 }
 
@@ -117,18 +116,15 @@ PyTypeObject SCA_NANDController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_NANDController::Parents[] = {
-       &SCA_NANDController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_NANDController::Methods[] = {
@@ -139,12 +135,4 @@ PyAttributeDef SCA_NANDController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_NANDController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_NANDController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index 0ae0ff19745ab6e5ca4c1cbae3529a292d540e24..36a145e5f2b114093f1d6de1c729173f1d77ae07 100644 (file)
@@ -39,7 +39,7 @@ class SCA_NANDController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_NANDController(SCA_IObject* gameobj,PyTypeObject* T=&Type);
+       SCA_NANDController(SCA_IObject* gameobj);
        virtual ~SCA_NANDController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
@@ -47,10 +47,6 @@ public:
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-
 };
 
 #endif //__KX_NANDCONTROLLER
index 6c9141636b2b284f70b941f5ee17a734519d97ce..67e0916ecc131e6fa25d936a983b3acbbcdffa31 100644 (file)
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_NORController::SCA_NORController(SCA_IObject* gameobj,
-                                                                        PyTypeObject* T)
+SCA_NORController::SCA_NORController(SCA_IObject* gameobj)
        :
-       SCA_IController(gameobj,T)
+       SCA_IController(gameobj)
 {
 }
 
@@ -117,18 +116,15 @@ PyTypeObject SCA_NORController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_NORController::Parents[] = {
-       &SCA_NORController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_NORController::Methods[] = {
@@ -139,12 +135,4 @@ PyAttributeDef SCA_NORController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_NORController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_NORController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index 06cbb70a489597cbfdab6b89c8797cb8ea4cc79e..b96232375d68fdde5e1ab03197b648a6a9faaeb7 100644 (file)
@@ -39,18 +39,10 @@ class SCA_NORController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_NORController(SCA_IObject* gameobj,PyTypeObject* T=&Type);
+       SCA_NORController(SCA_IObject* gameobj);
        virtual ~SCA_NORController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject*               py_getattro_dict();
-
 };
 
 #endif //__KX_NORCONTROLLER
index 42c0a67d657f7095b6c9dc803e8e0ec1a8dc8150..1dd8166848213061b1762ab6b2a9cb468f24feda 100644 (file)
@@ -42,9 +42,8 @@
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_ORController::SCA_ORController(SCA_IObject* gameobj,
-                                                                  PyTypeObject* T)
-               :SCA_IController(gameobj, T)
+SCA_ORController::SCA_ORController(SCA_IObject* gameobj)
+               :SCA_IController(gameobj)
 {
 }
 
@@ -111,18 +110,15 @@ PyTypeObject SCA_ORController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_ORController::Parents[] = {
-       &SCA_ORController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_ORController::Methods[] = {
@@ -133,13 +129,4 @@ PyAttributeDef SCA_ORController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-
-PyObject* SCA_ORController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_ORController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index 66f772c739edf46e35633cade6773f5645b034db..09d31a8519028690310070004ca713216fd02a8d 100644 (file)
@@ -39,18 +39,11 @@ class SCA_ORController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_ORController(SCA_IObject* gameobj, PyTypeObject* T=&Type);
+       SCA_ORController(SCA_IObject* gameobj);
 
        virtual ~SCA_ORController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
 };
 
 #endif //__KX_ORCONTROLLER
index 4faa4b55d4a7bd1896254cc32e1369c1da84dc0a..7eb088bef98020e5b16da54465b2a26d7ab2f45d 100644 (file)
@@ -42,8 +42,8 @@
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,SCA_IObject* sourceObj,const STR_String& propname,const STR_String& expr,int acttype,PyTypeObject* T )
-   :   SCA_IActuator(gameobj,T),
+SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,SCA_IObject* sourceObj,const STR_String& propname,const STR_String& expr,int acttype)
+   :   SCA_IActuator(gameobj),
        m_type(acttype),
        m_propname(propname),
        m_exprtxt(expr),
@@ -245,18 +245,15 @@ PyTypeObject SCA_PropertyActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_PropertyActuator::Parents[] = {
-       &SCA_PropertyActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef SCA_PropertyActuator::Methods[] = {
@@ -276,18 +273,6 @@ PyAttributeDef SCA_PropertyActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_PropertyActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* SCA_PropertyActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int SCA_PropertyActuator::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_IActuator);
-}
-
 /* 1. setProperty                                                        */
 const char SCA_PropertyActuator::SetProperty_doc[] = 
 "setProperty(name)\n"
index a8df08dfc6ecaad776317eb3925c272d6c72451f..8fb2e7a7bc5897f4634ad3aa1a74039eb4e7380b 100644 (file)
@@ -64,9 +64,7 @@ public:
                SCA_IObject* sourceObj,
                const STR_String& propname,
                const STR_String& expr,
-               int acttype,
-               PyTypeObject* T=&Type
-       );
+               int acttype);
 
 
        ~SCA_PropertyActuator();
@@ -86,10 +84,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject*  py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        // python wrapped methods
        KX_PYMETHOD_DOC(SCA_PropertyActuator,SetProperty);
        KX_PYMETHOD_DOC(SCA_PropertyActuator,GetProperty);
index 3b343af3cbaa9ac766492c436a94260961e46a87..b15711647745ba0d2fb1ac0e7bbb0d6bc6e87568 100644 (file)
@@ -48,9 +48,8 @@ SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr,
                                                                         const STR_String& propname,
                                                                         const STR_String& propval,
                                                                         const STR_String& propmaxval,
-                                                                        KX_PROPSENSOR_TYPE checktype,
-                                                                        PyTypeObject* T )
-       : SCA_ISensor(gameobj,eventmgr,T),
+                                                                        KX_PROPSENSOR_TYPE checktype)
+       : SCA_ISensor(gameobj,eventmgr),
          m_checktype(checktype),
          m_checkpropval(propval),
          m_checkpropmaxval(propmaxval),
@@ -320,18 +319,15 @@ PyTypeObject SCA_PropertySensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_PropertySensor::Parents[] = {
-       &SCA_PropertySensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_PropertySensor::Methods[] = {
@@ -353,19 +349,6 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-
-PyObject* SCA_PropertySensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_PropertySensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_PropertySensor::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_ISensor);
-}
-
 /* 1. getType */
 const char SCA_PropertySensor::GetType_doc[] = 
 "getType()\n"
index 538ecd65949eb13c8249c6c53f3e50cb3c3247d2..3513fcdf5aefc5d8d7e749b887923a45137eaff5 100644 (file)
@@ -67,8 +67,7 @@ public:
                                          const STR_String& propname,
                                          const STR_String& propval,
                                          const STR_String& propmaxval,
-                                         KX_PROPSENSOR_TYPE checktype,
-                                         PyTypeObject* T=&Type );
+                                         KX_PROPSENSOR_TYPE checktype);
        
        /** 
         *  For property sensor, it is used to release the pre-calculated expression
@@ -89,10 +88,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* 1. getType */
        KX_PYMETHOD_DOC_NOARGS(SCA_PropertySensor,GetType);
        /* 2. setType */
index 80e4f54c9c5beef9d933e2a1de17497f820f3a93..fb12674ebeda4cd2c7700ff07e95abc71a3dd051 100644 (file)
 SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
 
 
-SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj,
-                                                                                  int mode,
-                                                                                  PyTypeObject* T)
-       : SCA_IController(gameobj, T),
+SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode)
+       : SCA_IController(gameobj),
        m_bytecode(NULL),
        m_function(NULL),
        m_function_argc(0),
@@ -246,18 +244,17 @@ PyTypeObject SCA_PythonController::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IController::Type
 };
 
-PyParentObject SCA_PythonController::Parents[] = {
-       &SCA_PythonController::Type,
-       &SCA_IController::Type,
-       &CValue::Type,
-       NULL
-};
 PyMethodDef SCA_PythonController::Methods[] = {
        {"activate", (PyCFunction) SCA_PythonController::sPyActivate, METH_O},
        {"deactivate", (PyCFunction) SCA_PythonController::sPyDeActivate, METH_O},
@@ -490,22 +487,6 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
        m_sCurrentController = NULL;
 }
 
-
-
-PyObject* SCA_PythonController::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_PythonController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
-int SCA_PythonController::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IController);
-}
-
 PyObject* SCA_PythonController::PyActivate(PyObject *value)
 {
        if(m_sCurrentController != this) {
@@ -565,10 +546,15 @@ PyObject* SCA_PythonController::PySetScript(PyObject* value)
 
 PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
+       //SCA_PythonController* self= static_cast<SCA_PythonController*>(static_cast<SCA_IController*>(static_cast<SCA_ILogicBrick*>(static_cast<CValue*>(static_cast<PyObjectPlus*>(self_v)))));
+       // static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
+
        SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
        return PyString_FromString(self->m_scriptText);
 }
 
+
+
 int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
index 0c2af79c3a31f38cceede4ffef70e1d94aa2e465..9311b3f355e4e1f40f8cab4240184a620dc84ed8 100644 (file)
@@ -72,7 +72,7 @@ class SCA_PythonController : public SCA_IController
        //virtual       CValue*         AddRef();
        //virtual int                   Release();                                                                                              // Release a reference to this value (when reference count reaches 0, the value is removed from the heap)
 
-       SCA_PythonController(SCA_IObject* gameobj, int mode, PyTypeObject* T = &Type);
+       SCA_PythonController(SCA_IObject* gameobj, int mode);
        virtual ~SCA_PythonController();
 
        virtual CValue* GetReplica();
@@ -96,10 +96,6 @@ class SCA_PythonController : public SCA_IController
        static PyObject* sPyAddActiveActuator(PyObject* self, 
                                                                                  PyObject* args);
        static SCA_IActuator* LinkedActuatorFromPy(PyObject *value);
-               
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
 
                
        KX_PYMETHOD_O(SCA_PythonController,Activate);
index a722590dd10d05b36b60da2756d1081aafb41f24..a272306bd1d3f8f602b4a776c07605a941ad3f43 100644 (file)
@@ -50,9 +50,8 @@ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj,
                                                                         SCA_RandomActuator::KX_RANDOMACT_MODE mode,
                                                                         float para1,
                                                                         float para2,
-                                                                        const STR_String &propName,
-                                                                        PyTypeObject* T)
-       : SCA_IActuator(gameobj, T),
+                                                                        const STR_String &propName)
+       : SCA_IActuator(gameobj),
          m_propname(propName),
          m_parameter1(para1),
          m_parameter2(para2),
@@ -333,18 +332,15 @@ PyTypeObject SCA_RandomActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_RandomActuator::Parents[] = {
-       &SCA_RandomActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef SCA_RandomActuator::Methods[] = {
@@ -400,19 +396,6 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_
        }
 }
 
-PyObject* SCA_RandomActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* SCA_RandomActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int SCA_RandomActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 /* 1. setSeed                                                            */
 const char SCA_RandomActuator::SetSeed_doc[] = 
 "setSeed(seed)\n"
index 59863589b60fdb3dd102f047f7a385b3df828c59..c7d3fe2121741a6b2a9b22673d708fa283922144 100644 (file)
@@ -85,8 +85,7 @@ class SCA_RandomActuator : public SCA_IActuator
                                          KX_RANDOMACT_MODE mode,
                                          float para1,
                                          float para2,
-                                         const STR_String &propName,
-                                         PyTypeObject* T=&Type);
+                                         const STR_String &propName);
        virtual ~SCA_RandomActuator();
        virtual bool Update();
        
@@ -97,10 +96,6 @@ class SCA_RandomActuator : public SCA_IActuator
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        static PyObject* pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
        static int pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
index d5cbeef01ae61354a8c278b736e379df21122322..8a6f42c9926209649cac5dc35054bf59cb58642c 100644 (file)
@@ -46,9 +46,8 @@
 
 SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, 
                                 SCA_IObject* gameobj, 
-                                int startseed,
-                                PyTypeObject* T)
-    : SCA_ISensor(gameobj,eventmgr, T)
+                                int startseed)
+    : SCA_ISensor(gameobj,eventmgr)
 {
        m_basegenerator = new SCA_RandomNumberGenerator(startseed);
        Init();
@@ -148,18 +147,15 @@ PyTypeObject SCA_RandomSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_RandomSensor::Parents[] = {
-       &SCA_RandomSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef SCA_RandomSensor::Methods[] = {
@@ -177,19 +173,6 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
        {NULL} //Sentinel
 };
 
-PyObject* SCA_RandomSensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_RandomSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_RandomSensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 /* 1. setSeed                                                            */
 const char SCA_RandomSensor::SetSeed_doc[] = 
 "setSeed(seed)\n"
index b2bf244096614afb5de74a2cd6c9bb53ef8efc2b..5e66c36cccf128e74ef4ea4f84cc1e7d0b204032 100644 (file)
@@ -48,8 +48,7 @@ class SCA_RandomSensor : public SCA_ISensor
 public:
        SCA_RandomSensor(class SCA_EventManager* rndmgr,
                                        SCA_IObject* gameobj,
-                                       int startseed,
-                                       PyTypeObject* T=&Type);
+                                       int startseed);
        virtual ~SCA_RandomSensor();
        virtual CValue* GetReplica();
        virtual void ProcessReplica();
@@ -61,10 +60,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* 1. setSeed                                                            */
        KX_PYMETHOD_DOC_VARARGS(SCA_RandomSensor,SetSeed);
        /* 2. getSeed                                                            */
index aee8e26c21a34f5ab962ecff15e3faa22716c889..584a6b18f584bc60fa60335a57b295a77617e750 100644 (file)
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_XNORController::SCA_XNORController(SCA_IObject* gameobj,
-                                                                        PyTypeObject* T)
+SCA_XNORController::SCA_XNORController(SCA_IObject* gameobj)
        :
-       SCA_IController(gameobj,T)
+       SCA_IController(gameobj)
 {
 }
 
@@ -121,18 +120,15 @@ PyTypeObject SCA_XNORController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_XNORController::Parents[] = {
-       &SCA_XNORController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_XNORController::Methods[] = {
@@ -143,12 +139,4 @@ PyAttributeDef SCA_XNORController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_XNORController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_XNORController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index 4aad5763cb02629780600a994fd19c98d3317fae..18e77fae665cccbd3f59f7becd86b32feba5772c 100644 (file)
@@ -39,7 +39,7 @@ class SCA_XNORController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_XNORController(SCA_IObject* gameobj,PyTypeObject* T=&Type);
+       SCA_XNORController(SCA_IObject* gameobj);
        virtual ~SCA_XNORController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
@@ -48,9 +48,6 @@ public:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-
 };
 
 #endif //__KX_XNORCONTROLLER
index 5afb3a750f5662d5fc67116d2336a4f77fa16c1d..9f570acb009339675004e0d1880dd55d6264bad4 100644 (file)
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-SCA_XORController::SCA_XORController(SCA_IObject* gameobj,
-                                                                        PyTypeObject* T)
+SCA_XORController::SCA_XORController(SCA_IObject* gameobj)
        :
-       SCA_IController(gameobj,T)
+       SCA_IController(gameobj)
 {
 }
 
@@ -121,18 +120,15 @@ PyTypeObject SCA_XORController::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_XORController::Parents[] = {
-       &SCA_XORController::Type,
-       &SCA_IController::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IController::Type
 };
 
 PyMethodDef SCA_XORController::Methods[] = {
@@ -143,12 +139,4 @@ PyAttributeDef SCA_XORController::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_XORController::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IController);
-}
-
-PyObject* SCA_XORController::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IController);
-}
-
 /* eof */
index feb9f2ed07c2a3e9f03f892dbdf8ab78c8df0fd2..2607a533661408aea63b281c4ae42f2a8b09c27b 100644 (file)
@@ -39,18 +39,10 @@ class SCA_XORController : public SCA_IController
        Py_Header;
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
-       SCA_XORController(SCA_IObject* gameobj,PyTypeObject* T=&Type);
+       SCA_XORController(SCA_IObject* gameobj);
        virtual ~SCA_XORController();
        virtual CValue* GetReplica();
        virtual void Trigger(SCA_LogicManager* logicmgr);
-
-       /* --------------------------------------------------------------------- */
-       /* Python interface ---------------------------------------------------- */
-       /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-
 };
 
 #endif //__KX_XORCONTROLLER
index c5c517c8a65390e35114a1d93e770f9c171338ec..b595aab578fb0c7520bb2d9f0c9abab8158c39b8 100644 (file)
@@ -113,8 +113,8 @@ bool BL_Shader::Ok()const
        return (mShader !=0 && mOk && mUse);
 }
 
-BL_Shader::BL_Shader(PyTypeObject *T)
-:      PyObjectPlus(T),
+BL_Shader::BL_Shader()
+:      PyObjectPlus(),
        mShader(0),
        mPass(1),
        mOk(0),
@@ -728,17 +728,6 @@ void BL_Shader::SetUniform(int uniform, const int* val, int len)
        }
 }
 
-
-PyObject* BL_Shader::py_getattro(PyObject *attr)
-{
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* BL_Shader::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-
 PyMethodDef BL_Shader::Methods[] = 
 {
        // creation
@@ -793,20 +782,17 @@ PyTypeObject BL_Shader::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-PyParentObject BL_Shader::Parents[] = {
-       &BL_Shader::Type,
-       &PyObjectPlus::Type,
-       NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type
 };
 
-
 KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProgram)" )
 {
        if(mShader !=0 && mOk  )
index 7db40e778ae6b0a3c4cfab9b968dc032dc8bcc86..517f31519092075f7b60075aeacfa9b62993df47 100644 (file)
@@ -120,7 +120,7 @@ private:
        void                    ClearUniforms();
 
 public:
-       BL_Shader(PyTypeObject *T=&Type);
+       BL_Shader();
        virtual ~BL_Shader();
 
        // Unused for now tangent is set as 
@@ -202,8 +202,6 @@ public:
        void SetUniform(int uniform, const int val);
 
        // Python interface
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
        virtual PyObject* py_repr(void) { return PyString_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
 
        // -----------------------------------
index 63773352d96c287f1c7b6bc0c50cc5adba7002ac..60805916a20badccf99e3fdba07ab4fbde8858de 100644 (file)
@@ -41,9 +41,8 @@ KX_NetworkMessageActuator::KX_NetworkMessageActuator(
        const STR_String &toPropName,
        const STR_String &subject,
        int bodyType,
-       const STR_String &body,
-       PyTypeObject* T) :
-       SCA_IActuator(gameobj,T),
+       const STR_String &body) :
+       SCA_IActuator(gameobj),
        m_networkscene(networkscene),
        m_toPropName(toPropName),
        m_subject(subject),
@@ -119,18 +118,15 @@ PyTypeObject KX_NetworkMessageActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_NetworkMessageActuator::Parents[] = {
-       &KX_NetworkMessageActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_NetworkMessageActuator::Methods[] = {
@@ -155,18 +151,6 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_NetworkMessageActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_NetworkMessageActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_NetworkMessageActuator::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_IActuator);
-}
-
 // Deprecated ----->
 // 1. SetToPropName
 PyObject* KX_NetworkMessageActuator::PySetToPropName(
@@ -240,4 +224,4 @@ PyObject* KX_NetworkMessageActuator::PySetBody(
        Py_RETURN_NONE;
 }
 
-// <----- Deprecated
\ No newline at end of file
+// <----- Deprecated
index cf92fd46fe0cdd55fb3efaa8c53971ab0bcd3c74..b4f55f2a4668476f10dba50ecf6b943dfeddc7bb 100644 (file)
@@ -50,8 +50,7 @@ public:
                const STR_String &toPropName,
                const STR_String &subject,
                int bodyType,
-               const STR_String &body,
-               PyTypeObject* T=&Type);
+               const STR_String &body);
        virtual ~KX_NetworkMessageActuator();
 
        virtual bool Update();
@@ -61,10 +60,6 @@ public:
        /* Python interface ------------------------------------------- */
        /* ------------------------------------------------------------ */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        // Deprecated ----->
        KX_PYMETHOD(KX_NetworkMessageActuator, SetToPropName);
        KX_PYMETHOD(KX_NetworkMessageActuator, SetSubject);
index 8ddcd87b66ff6a9cbe36ad7a2807f22ac9cae78b..da43893cee3cdf2744d693758e206059c2e9153b 100644 (file)
@@ -50,10 +50,9 @@ KX_NetworkMessageSensor::KX_NetworkMessageSensor(
        class KX_NetworkEventManager* eventmgr, // our eventmanager
        class NG_NetworkScene *NetworkScene,    // our scene
        SCA_IObject* gameobj,                                   // the sensor controlling object
-       const STR_String &subject,
-       PyTypeObject* T
+       const STR_String &subject
 ) :
-    SCA_ISensor(gameobj,eventmgr,T),
+    SCA_ISensor(gameobj,eventmgr),
     m_Networkeventmgr(eventmgr),
     m_NetworkScene(NetworkScene),
     m_subject(subject),
@@ -183,18 +182,15 @@ PyTypeObject KX_NetworkMessageSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_NetworkMessageSensor::Parents[] = {
-       &KX_NetworkMessageSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef KX_NetworkMessageSensor::Methods[] = {
@@ -226,18 +222,6 @@ PyAttributeDef KX_NetworkMessageSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_NetworkMessageSensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* KX_NetworkMessageSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int KX_NetworkMessageSensor::py_setattro(PyObject *attr, PyObject *value) {
-       return SCA_ISensor::py_setattro(attr, value);
-}
-
 PyObject* KX_NetworkMessageSensor::pyattr_get_bodies(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_NetworkMessageSensor *self = static_cast<KX_NetworkMessageSensor*>(self_v);
@@ -328,4 +312,4 @@ PyObject* KX_NetworkMessageSensor::PyGetSubjects()
                return (new CListValue())->NewProxy(true);
        }
 }
-// <----- Deprecated
\ No newline at end of file
+// <----- Deprecated
index 53183f3382681c5c32ca3768d9dd3049c1cd47df..ade876973032e61303c6e8f15ebdf20bd209f54f 100644 (file)
@@ -57,8 +57,7 @@ public:
                KX_NetworkEventManager* eventmgr,       // our eventmanager
                NG_NetworkScene *NetworkScene,          // our scene
                SCA_IObject* gameobj,                           // the sensor controlling object
-               const STR_String &subject,
-               PyTypeObject* T=&Type
+               const STR_String &subject
        );
        virtual ~KX_NetworkMessageSensor();
 
@@ -72,10 +71,6 @@ public:
        /* Python interface -------------------------------------------- */
        /* ------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        // Deprecated ----->
        KX_PYMETHOD_DOC_O(KX_NetworkMessageSensor, SetSubjectFilterText);
        KX_PYMETHOD_DOC_NOARGS(KX_NetworkMessageSensor, GetFrameMessageCount);
index 30057fc039d359b24bde63c2d9e4d8ca25d68107..9e3b718a87a47657162f697e5160a607f7283b37 100644 (file)
@@ -42,10 +42,8 @@ BL_BlenderShader *KX_BlenderMaterial::mLastBlenderShader = NULL;
 
 //static PyObject *gTextureDict = 0;
 
-KX_BlenderMaterial::KX_BlenderMaterial(
-       PyTypeObject *T
-       )
-:      PyObjectPlus(T),
+KX_BlenderMaterial::KX_BlenderMaterial()
+:      PyObjectPlus(),
        RAS_IPolyMaterial(),
        mMaterial(NULL),
        mShader(0),
@@ -814,35 +812,17 @@ PyTypeObject KX_BlenderMaterial::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-PyParentObject KX_BlenderMaterial::Parents[] = {
-       &KX_BlenderMaterial::Type,
-       &PyObjectPlus::Type,
-       NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type
 };
 
-
-PyObject* KX_BlenderMaterial::py_getattro(PyObject *attr)
-{
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* KX_BlenderMaterial::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-int KX_BlenderMaterial::py_setattro(PyObject *attr, PyObject *pyvalue)
-{
-       return PyObjectPlus::py_setattro(attr, pyvalue);
-}
-
-
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 {
        if( !GLEW_ARB_fragment_shader) {
index b29f2df98db920d8765fac0ceb8891f38c1ab105..6eb9647a5959bcf72c9cb182d126856eb49c98f6 100644 (file)
@@ -23,9 +23,7 @@ class KX_BlenderMaterial :  public PyObjectPlus, public RAS_IPolyMaterial
        Py_Header;
 public:
        // --------------------------------
-       KX_BlenderMaterial(
-               PyTypeObject*   T=&Type
-       );
+       KX_BlenderMaterial();
        void Initialize(
                class KX_Scene* scene,
                BL_Material*    mat,
@@ -83,9 +81,6 @@ public:
        );
        
        // --------------------------------
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int       py_setattro(PyObject *attr, PyObject *pyvalue);
        virtual PyObject* py_repr(void) { return PyString_FromString(mMaterial->matname.ReadPtr()); }
 
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
index 8511526fd5ff3b211b1b02ddfc94a3e3bf051bab..6e01bf0dded1affc8a72527442ced6d2348e229b 100644 (file)
@@ -48,9 +48,8 @@ KX_CDActuator::KX_CDActuator(SCA_IObject* gameobject,
                                                         KX_CDACT_TYPE type,
                                                         int track,
                                                         short start,
-                                                        short end,
-                                                        PyTypeObject* T)
-                                                        : SCA_IActuator(gameobject,T)
+                                                        short end)
+                                                        : SCA_IActuator(gameobject)
 {
        m_soundscene = soundscene;
        m_type = type;
@@ -172,24 +171,17 @@ PyTypeObject KX_CDActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-PyParentObject KX_CDActuator::Parents[] = {
-       &KX_CDActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_CDActuator::Methods[] = {
        // Deprecated ----->
        {"setGain",(PyCFunction) KX_CDActuator::sPySetGain,METH_VARARGS,NULL},
@@ -217,22 +209,6 @@ int KX_CDActuator::pyattr_setGain(void *self, const struct KX_PYATTRIBUTE_DEF *a
        return PY_SET_ATTR_SUCCESS;
 }
 
-PyObject* KX_CDActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_CDActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_CDActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
-
-
 KX_PYMETHODDEF_DOC_NOARGS(KX_CDActuator, startCD,
 "startCD()\n"
 "\tStarts the CD playing.\n")
index 2fd05ab72e5d82a7fb9df4f82989af0ee4b21fad..b01ad73777ebf6809c6b471671536687e6cad60b 100644 (file)
@@ -68,8 +68,7 @@ public:
                                  KX_CDACT_TYPE type,
                                  int track,
                                  short start,
-                                 short end,
-                                 PyTypeObject* T=&Type);
+                                 short end);
 
        ~KX_CDActuator();
 
@@ -81,10 +80,6 @@ public:
        /* Python interface --------------------------------------------------- */
        /* -------------------------------------------------------------------- */
 
-       virtual PyObject*  py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        // Deprecated ----->
        KX_PYMETHOD_VARARGS(KX_CDActuator,SetGain);
        KX_PYMETHOD_VARARGS(KX_CDActuator,GetGain);
index 40f6c99c03c6d924154ef7ef238f1a08ff94b1da..4ccbf73b417e25fd34d7867255013a607cc2fc34 100644 (file)
@@ -42,10 +42,9 @@ KX_Camera::KX_Camera(void* sgReplicationInfo,
                                         SG_Callbacks callbacks,
                                         const RAS_CameraData& camdata,
                                         bool frustum_culling,
-                                        bool delete_node,
-                                        PyTypeObject *T)
+                                        bool delete_node)
                                        :
-                                       KX_GameObject(sgReplicationInfo,callbacks,T),
+                                       KX_GameObject(sgReplicationInfo,callbacks),
                                        m_camdata(camdata),
                                        m_dirty(true),
                                        m_normalized(false),
@@ -551,41 +550,17 @@ PyTypeObject KX_Camera::Type = {
                &KX_GameObject::Sequence,
                &KX_GameObject::Mapping,
                0,0,0,
-               py_base_getattro,
-               py_base_setattro,
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
                0,
-               Py_TPFLAGS_DEFAULT,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
                0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-
-
-
-PyParentObject KX_Camera::Parents[] = {
-       &KX_Camera::Type,
-       &KX_GameObject::Type,
-               &SCA_IObject::Type,
-               &CValue::Type,
-               NULL
+               Methods,
+               0,
+               0,
+               &KX_GameObject::Type
 };
 
-PyObject* KX_Camera::py_getattro(PyObject *attr)
-{
-       py_getattro_up(KX_GameObject);
-}
-
-PyObject* KX_Camera::py_getattro_dict() {
-       py_getattro_dict_up(KX_GameObject);
-}
-
-int KX_Camera::py_setattro(PyObject *attr, PyObject *value)
-{      
-       py_setattro_up(KX_GameObject);
-}
-
 KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
 "sphereInsideFrustum(center, radius) -> Integer\n"
 "\treturns INSIDE, OUTSIDE or INTERSECT if the given sphere is\n"
index aef21cd91e48ae4103077a6658cd6429d3ee6102..74c8e6d4e4f242849f493f9212efca4448b71b78 100644 (file)
@@ -143,7 +143,7 @@ public:
 
        enum { INSIDE, INTERSECT, OUTSIDE } ;
 
-       KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, bool delete_node = false, PyTypeObject *T = &Type);
+       KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, bool delete_node = false);
        virtual ~KX_Camera();
        
        /** 
@@ -265,6 +265,7 @@ public:
         */
        int GetViewportTop() const;
 
+       virtual int GetGameObjectType() { return OBJ_CAMERA; }
 
        KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum);
        KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum);
@@ -282,10 +283,6 @@ public:
        KX_PYMETHOD_DOC_O(KX_Camera, getScreenPosition);
        KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenVect);
        KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenRay);
-
-       virtual PyObject* py_getattro(PyObject *attr); /* lens, near, far, projection_matrix */
-       virtual PyObject* py_getattro_dict();
-       virtual int       py_setattro(PyObject *attr, PyObject *pyvalue);
        
        static PyObject*        pyattr_get_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
index f8557dac2c419ad08d0c6791dfadfde48d155fca..b960ae25841b6f1ed19879a0dd6c8f616810e35e 100644 (file)
@@ -56,10 +56,9 @@ KX_CameraActuator::KX_CameraActuator(
        float hght,
        float minhght,
        float maxhght,
-       bool  xytog,
-       PyTypeObject* T
+       bool  xytog
 ): 
-       SCA_IActuator(gameobj, T),
+       SCA_IActuator(gameobj),
        m_ob (obj),
        m_height (hght),
        m_minHeight (minhght),
@@ -386,18 +385,15 @@ PyTypeObject KX_CameraActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_CameraActuator::Parents[] = {
-       &KX_CameraActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_CameraActuator::Methods[] = {
@@ -424,18 +420,6 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
        {NULL}
 };
 
-PyObject* KX_CameraActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_CameraActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_CameraActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
-
 /* get obj  ---------------------------------------------------------- */
 const char KX_CameraActuator::GetObject_doc[] = 
 "getObject(name_only = 1)\n"
index efa4e2f38d79d07eec2bb5712aa8b59451fa711c..057c6fed770aa00f37172e2db137cd259e0678f6 100644 (file)
@@ -91,9 +91,7 @@ private :
                float hght,
                float minhght,
                float maxhght,
-               bool xytog,
-               PyTypeObject* T=&Type
-
+               bool xytog
        );
 
 
@@ -120,10 +118,6 @@ private :
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
        /* set object to look at */
        KX_PYMETHOD_DOC_O(KX_CameraActuator,SetObject);
        /* get current object  */
index bd03dea486b411e4de72f90b15de203394187d38..7e5a2e3190725cd7242a867db2e90beedd72f1d3 100644 (file)
@@ -54,9 +54,8 @@ KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj,
                                                                                         int locrotxyz,
                                                                                         int time,
                                                                                         int option,
-                                                                                        char *property,
-                                                                                        PyTypeObject* T) : 
-       SCA_IActuator(gameobj, T),
+                                                                                        char *property) :
+       SCA_IActuator(gameobj),
        m_refDirVector(refDir),
        m_currentTime(0)
 {
@@ -582,18 +581,15 @@ PyTypeObject KX_ConstraintActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_ConstraintActuator::Parents[] = {
-       &KX_ConstraintActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_ConstraintActuator::Methods[] = {
@@ -639,21 +635,6 @@ PyAttributeDef KX_ConstraintActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_ConstraintActuator::py_getattro(PyObject *attr) 
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_ConstraintActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_ConstraintActuator::py_setattro(PyObject *attr, PyObject* value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
-
 int KX_ConstraintActuator::pyattr_check_direction(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_ConstraintActuator* act = static_cast<KX_ConstraintActuator*>(self);
index 40607b449478a54519cf0a767f9cdfb254e44e60..677904aedc931c8c0e08b843d1510c66f6da2ed5 100644 (file)
@@ -126,8 +126,7 @@ protected:
                                                  int locrot,
                                                  int time,
                                                  int option,
-                                                 char *property,
-                                                 PyTypeObject* T=&Type);
+                                                 char *property);
        virtual ~KX_ConstraintActuator();
        virtual CValue* GetReplica() {
                KX_ConstraintActuator* replica = new KX_ConstraintActuator(*this);
@@ -141,10 +140,6 @@ protected:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
        static int pyattr_check_direction(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
        static int pyattr_check_min(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
 
index c5cf67af67dd74f474e1ea183fb26a3a6df5daf8..be23eff6ac0a7379483e9d566fa4d1b4c327f3fc 100644 (file)
@@ -38,8 +38,8 @@
 KX_ConstraintWrapper::KX_ConstraintWrapper(
                                                PHY_ConstraintType ctype,
                                                int constraintId,
-                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T) :
-               PyObjectPlus(T),
+                                               PHY_IPhysicsEnvironment* physenv) :
+               PyObjectPlus(),
                m_constraintId(constraintId),
                m_constraintType(ctype),
                m_physenv(physenv)
@@ -100,36 +100,17 @@ PyTypeObject KX_ConstraintWrapper::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_ConstraintWrapper::Parents[] = {
-       &KX_ConstraintWrapper::Type,
-       NULL
-};
-
-//here you can search for existing data members (like mass,friction etc.)
-PyObject* KX_ConstraintWrapper::py_getattro(PyObject *attr)
-{
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* KX_ConstraintWrapper::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-int    KX_ConstraintWrapper::py_setattro(PyObject *attr,PyObject* value)
-{
-       py_setattro_up(PyObjectPlus);   
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type
 };
 
-
-
-
-
 PyMethodDef KX_ConstraintWrapper::Methods[] = {
        {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_NOARGS},
        {"setParam",(PyCFunction) KX_ConstraintWrapper::sPySetParam, METH_VARARGS},
index 03813e0f16781aec73c6da35c999a7af86dd467e..74670944415e5cd90df05bb4626aea5b60a5a81f 100644 (file)
 class  KX_ConstraintWrapper : public PyObjectPlus
 {
        Py_Header;
-       virtual PyObject*               py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int                     py_setattro(PyObject *attr, PyObject *value);
 public:
-       KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv,PyTypeObject *T = &Type);
+       KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv);
        virtual ~KX_ConstraintWrapper ();
        int                     getConstraintId() { return m_constraintId;};
        
index 28bf12f5e87235444e42ec44fa3a881e6b3b6a25..2a769cf6c6665335f1ee70077bb3f94ffbb69cab 100644 (file)
@@ -49,9 +49,8 @@ KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj,
                                                                   const STR_String& filename,
                                                                   const STR_String& loadinganimationname,
                                                                   KX_Scene* scene,
-                                                                  KX_KetsjiEngine* ketsjiengine,
-                                                                  PyTypeObject* T)
-                                                                  : SCA_IActuator(gameobj, T)
+                                                                  KX_KetsjiEngine* ketsjiengine)
+                                                                  : SCA_IActuator(gameobj)
 {
        m_mode = mode;
        m_filename = filename;
@@ -225,25 +224,17 @@ PyTypeObject KX_GameActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-PyParentObject KX_GameActuator::Parents[] =
-{
-       &KX_GameActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_GameActuator::Methods[] =
 {
        // Deprecated ----->
@@ -259,21 +250,6 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_GameActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_GameActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_GameActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
-
 // Deprecated ----->
 /* getFile */
 const char KX_GameActuator::GetFile_doc[] = 
index b2b1d6ec2b954c7f5a20c05187eb3ae69b8be4b1..cabbf827b40e13c9b537e75e6efe69788c777708 100644 (file)
@@ -65,8 +65,7 @@ protected:
                                         const STR_String& filename,
                                         const STR_String& loadinganimationname,
                                         KX_Scene* scene,
-                                        KX_KetsjiEngine* ketsjiEngine,
-                                        PyTypeObject* T=&Type);
+                                        KX_KetsjiEngine* ketsjiEngine);
        virtual ~KX_GameActuator();
 
        virtual CValue* GetReplica();
@@ -77,10 +76,6 @@ protected:
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        // Deprecated functions ----->
        KX_PYMETHOD_DOC(KX_GameActuator,GetFile);
        KX_PYMETHOD_DOC(KX_GameActuator,SetFile);
index 577f767b47523e77d3e7307c9b3c6a9e955fbc4b..30b3cb201a7104b3977d4a349ff726bfb63a5710 100644 (file)
@@ -86,10 +86,8 @@ static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(        1.0, 0.0, 0.0,
 
 KX_GameObject::KX_GameObject(
        void* sgReplicationInfo,
-       SG_Callbacks callbacks,
-       PyTypeObject* T
-) : 
-       SCA_IObject(T),
+       SG_Callbacks callbacks)
+       : SCA_IObject(),
        m_bDyna(false),
        m_layer(0),
        m_pBlenderObject(NULL),
@@ -1674,24 +1672,15 @@ PyTypeObject KX_GameObject::Type = {
                &Sequence,
                &Mapping,
                0,0,0,
-               py_base_getattro,
-               py_base_setattro,
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
                0,
-               Py_TPFLAGS_DEFAULT,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
                0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-
-
-
-PyParentObject KX_GameObject::Parents[] = {
-       &KX_GameObject::Type,
-               &SCA_IObject::Type,
-               &CValue::Type,
-               NULL
+               Methods,
+               0,
+               0,
+               &SCA_IObject::Type
 };
 
 PyObject* KX_GameObject::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -1922,7 +1911,7 @@ PyObject* KX_GameObject::pyattr_get_localScaling(void *self_v, const KX_PYATTRIB
 #ifdef USE_MATHUTILS
        return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
 #else
-       return PyObjectFrom(self->NodeGetLocalScale());
+       return PyObjectFrom(self->NodeGetLocalScaling());
 #endif
 }
 
@@ -2047,128 +2036,6 @@ PyObject* KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_
        return self->m_attr_dict;
 }
 
-/* We need these because the macros have a return in them */
-PyObject* KX_GameObject::py_getattro__internal(PyObject *attr)
-{
-       py_getattro_up(SCA_IObject);
-}
-
-int KX_GameObject::py_setattro__internal(PyObject *attr, PyObject *value)      // py_setattro method
-{
-       py_setattro_up(SCA_IObject);
-}
-
-
-PyObject* KX_GameObject::py_getattro(PyObject *attr)
-{
-       PyObject *object= py_getattro__internal(attr);
-       
-       if (object==NULL && m_attr_dict)
-       {
-               /* backup the exception incase the attr doesnt exist in the dict either */
-               PyObject *err_type, *err_value, *err_tb;
-               PyErr_Fetch(&err_type, &err_value, &err_tb);
-               
-               object= PyDict_GetItem(m_attr_dict, attr);
-               if (object) {
-                       Py_INCREF(object);
-                       
-                       PyErr_Clear();
-                       Py_XDECREF( err_type );
-                       Py_XDECREF( err_value );
-                       Py_XDECREF( err_tb );
-               }
-               else {
-                       PyErr_Restore(err_type, err_value, err_tb); /* use the error from the parent function */
-               }
-       }
-       return object;
-}
-
-PyObject* KX_GameObject::py_getattro_dict() {
-       //py_getattro_dict_up(SCA_IObject);
-       PyObject *dict= py_getattr_dict(SCA_IObject::py_getattro_dict(), Type.tp_dict);
-       if(dict==NULL)
-               return NULL;
-       
-       /* normally just return this but KX_GameObject has some more items */
-
-       
-       /* Not super fast getting as a list then making into dict keys but its only for dir() */
-       PyObject *list= ConvertKeysToPython();
-       if(list)
-       {
-               int i;
-               for(i=0; i<PyList_Size(list); i++)
-                       PyDict_SetItem(dict, PyList_GET_ITEM(list, i), Py_None);
-       }
-       else
-               PyErr_Clear();
-       
-       Py_DECREF(list);
-       
-       /* Add m_attr_dict if we have it */
-       if(m_attr_dict)
-               PyDict_Update(dict, m_attr_dict);
-       
-       return dict;
-}
-
-int KX_GameObject::py_setattro(PyObject *attr, PyObject *value)        // py_setattro method
-{
-       int ret= py_setattro__internal(attr, value);
-       
-       if (ret==PY_SET_ATTR_SUCCESS) {
-               /* remove attribute in our own dict to avoid double ups */
-               /* NOTE: Annoying that we also do this for setting builtin attributes like mass and visibility :/ */
-               if (m_attr_dict) {
-                       if (PyDict_DelItem(m_attr_dict, attr) != 0)
-                               PyErr_Clear();
-               }
-       }
-       
-       if (ret==PY_SET_ATTR_COERCE_FAIL) {
-               /* CValue attribute exists, remove CValue and add PyDict value */
-               RemoveProperty(PyString_AsString(attr));
-               ret= PY_SET_ATTR_MISSING;
-       }
-       
-       if (ret==PY_SET_ATTR_MISSING) {
-               /* Lazy initialization */
-               if (m_attr_dict==NULL)
-                       m_attr_dict = PyDict_New();
-               
-               if (PyDict_SetItem(m_attr_dict, attr, value)==0) {
-                       PyErr_Clear();
-                       ret= PY_SET_ATTR_SUCCESS;
-               }
-               else {
-                       PyErr_Format(PyExc_AttributeError, "gameOb.myAttr = value: KX_GameObject, failed assigning value to internal dictionary");
-                       ret= PY_SET_ATTR_FAIL;
-               }
-       }
-       
-       return ret;     
-}
-
-
-int    KX_GameObject::py_delattro(PyObject *attr)
-{
-       ShowDeprecationWarning("del ob.attr", "del ob['attr'] for user defined properties");
-       
-       char *attr_str= PyString_AsString(attr); 
-       
-       if (RemoveProperty(attr_str)) // XXX - should call CValues instead but its only 2 lines here
-               return PY_SET_ATTR_SUCCESS;
-       
-       if (m_attr_dict && (PyDict_DelItem(m_attr_dict, attr) == 0))
-               return PY_SET_ATTR_SUCCESS;
-       
-       PyErr_Format(PyExc_AttributeError, "del gameOb.myAttr: KX_GameObject, attribute \"%s\" dosnt exist", attr_str);
-       return PY_SET_ATTR_MISSING;
-}
-
-
 PyObject* KX_GameObject::PyApplyForce(PyObject* args)
 {
        int local = 0;
index 5928571495096778b5922561a2872985131d2156..1abd4399295212f0e8dbec09c7d6cf303d6cdf1c 100644 (file)
@@ -189,8 +189,7 @@ public:
 
        KX_GameObject(
                void* sgReplicationInfo,
-               SG_Callbacks callbacks,
-               PyTypeObject* T=&Type
+               SG_Callbacks callbacks
        );
 
        virtual 
@@ -808,22 +807,10 @@ public:
        /**
         * @section Python interface functions.
         */
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);               // py_setattro method
-       virtual int                             py_delattro(PyObject *attr);
        virtual PyObject* py_repr(void)
        {
                return PyString_FromString(GetName().ReadPtr());
        }
-       
-       
-       /* quite annoying that we need these but the bloody 
-        * py_getattro_up and py_setattro_up macro's have a returns in them! */
-       PyObject* py_getattro__internal(PyObject *attr);
-       int py_setattro__internal(PyObject *attr, PyObject *value);             // py_setattro method
-       
                
        KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
        KX_PYMETHOD_O(KX_GameObject,SetPosition);
index 3ec0598ac03756696feb3549419854b01cf2db4a..18e91250233a03538c556c4a81ddad69bbc086d0 100644 (file)
@@ -70,9 +70,8 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
                                                           int acttype,
                                                           bool ipo_as_force,
                                                           bool ipo_add,
-                                                          bool ipo_local,
-                                                          PyTypeObject* T) 
-       : SCA_IActuator(gameobj,T),
+                                                          bool ipo_local)
+       : SCA_IActuator(gameobj),
        m_bNegativeEvent(false),
        m_startframe (starttime),
        m_endframe(endtime),
@@ -430,18 +429,15 @@ PyTypeObject KX_IpoActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_IpoActuator::Parents[] = {
-       &KX_IpoActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_IpoActuator::Methods[] = {
@@ -477,18 +473,6 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_IpoActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_IpoActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_IpoActuator::py_setattro(PyObject *attr, PyObject *value)       // py_setattro method
-{
-       py_setattro_up(SCA_IActuator);
-}
 
 /* set --------------------------------------------------------------------- */
 const char KX_IpoActuator::Set_doc[] = 
index 9ea597def1eb1772abb9c6ff77db00a88887b39c..01051ca82dc93153e87f8607d719af1c03b22104 100644 (file)
@@ -121,8 +121,7 @@ public:
                                   int acttype,
                                   bool ipo_as_force, 
                                   bool ipo_add,
-                                  bool ipo_local,
-                                  PyTypeObject* T=&Type);
+                                  bool ipo_local);
        virtual ~KX_IpoActuator() {};
 
        virtual CValue* GetReplica() {
@@ -138,10 +137,6 @@ public:
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
        
        //KX_PYMETHOD_DOC
        KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,Set);
index ae9e097a96e9fbbb576269bac8eb0ca2ac7f6204..c7d8ab4f0d1e79795bf7016925f843b158551d95 100644 (file)
 KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
                                                           class RAS_IRenderTools* rendertools,
                                                           const RAS_LightObject&       lightobj,
-                                                          bool glsl,
-                                                          PyTypeObject* T
-                                                          )
- :
-       KX_GameObject(sgReplicationInfo,callbacks,T),
-               m_rendertools(rendertools)
+                                                          bool glsl)
+       : KX_GameObject(sgReplicationInfo,callbacks),
+         m_rendertools(rendertools)
 {
        m_lightobj = lightobj;
        m_lightobj.m_scene = sgReplicationInfo;
@@ -271,11 +268,6 @@ void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras)
 /* Python Integration Hooks                                                                     */
 /* ------------------------------------------------------------------------- */
 
-PyObject* KX_LightObject::py_getattro_dict() {
-       py_getattro_dict_up(KX_GameObject);
-}
-
-
 PyTypeObject KX_LightObject::Type = {
 #if (PY_VERSION_HEX >= 0x02060000)
        PyVarObject_HEAD_INIT(NULL, 0)
@@ -297,20 +289,15 @@ PyTypeObject KX_LightObject::Type = {
                &KX_GameObject::Sequence,
                &KX_GameObject::Mapping,
                0,0,0,
-               py_base_getattro,
-               py_base_setattro,
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
                0,
-               Py_TPFLAGS_DEFAULT,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
                0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_LightObject::Parents[] = {
-       &KX_LightObject::Type,
-       &KX_GameObject::Type,
-               &SCA_IObject::Type,
-               &CValue::Type,
-               NULL
+               Methods,
+               0,
+               0,
+               &KX_GameObject::Type
 };
 
 PyMethodDef KX_LightObject::Methods[] = {
@@ -401,14 +388,3 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr
 
        return PY_SET_ATTR_SUCCESS;
 }
-
-
-PyObject* KX_LightObject::py_getattro(PyObject *attr)
-{
-       py_getattro_up(KX_GameObject);
-}
-
-int KX_LightObject::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(KX_GameObject);
-}
index 358c705080aa732b7f0842f9a32b268704684aee..0b7ccbe81abcebdf5359e297eb7af56dbbe035f6 100644 (file)
@@ -49,7 +49,7 @@ protected:
        Scene*                          m_blenderscene;
 
 public:
-       KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, bool glsl, PyTypeObject *T = &Type);
+       KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, bool glsl);
        virtual ~KX_LightObject();
        virtual CValue*         GetReplica();
        RAS_LightObject*        GetLightData() { return &m_lightobj;}
@@ -64,10 +64,6 @@ public:
        void BindShadowBuffer(class RAS_IRasterizer *ras, class KX_Camera *cam, class MT_Transform& camtrans);
        void UnbindShadowBuffer(class RAS_IRasterizer *ras);
        void Update();
-       
-       virtual PyObject* py_getattro(PyObject *attr); /* lens, near, far, projection_matrix */
-       virtual PyObject* py_getattro_dict();
-       virtual int       py_setattro(PyObject *attr, PyObject *pyvalue);
 
        /* attributes */
        static PyObject*        pyattr_get_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
index 11effa1ca980a0cd09d532cfc764a947bd58da8f..79aa887601a51e586643ad1d15c314b598dbf5e3 100644 (file)
@@ -63,17 +63,15 @@ PyTypeObject KX_MeshProxy::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_MeshProxy::Parents[] = {
-       &KX_MeshProxy::Type,
-       &CValue::Type,
-       &PyObjectPlus::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type
 };
 
 PyMethodDef KX_MeshProxy::Methods[] = {
@@ -106,24 +104,8 @@ void KX_MeshProxy::SetMeshModified(bool v)
        m_meshobj->SetMeshModified(v);
 }
 
-
-PyObject* KX_MeshProxy::py_getattro(PyObject *attr)
-{
-       py_getattro_up(CValue);
-}
-
-PyObject* KX_MeshProxy::py_getattro_dict() {
-       py_getattro_dict_up(CValue);
-}
-
-int KX_MeshProxy::py_setattro(PyObject *attr, PyObject* value)
-{
-       py_setattro_up(CValue);
-}
-
-
 KX_MeshProxy::KX_MeshProxy(RAS_MeshObject* mesh)
-       : CValue(&Type), m_meshobj(mesh)
+       : CValue(), m_meshobj(mesh)
 {
 }
 
index bfdd4be41187899f6ceb234a1aca89714e6ed445..4b6543677ad5932b0fb7a958518715fb512c4e7c 100644 (file)
@@ -56,9 +56,6 @@ public:
        virtual CValue*         GetReplica();
 
 // stuff for python integration
-       virtual PyObject*  py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
 
        KX_PYMETHOD(KX_MeshProxy,GetNumMaterials);      // Deprecated
        KX_PYMETHOD(KX_MeshProxy,GetMaterialName);
index fde10a493db073e79a0f73d2dc35fc9091782593..e38ec702acd217daa7e3aedc54a3e48896fe98af 100644 (file)
@@ -63,9 +63,8 @@ KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr,
                                                                                 int focusmode,
                                                                                 KX_Scene* kxscene,
                                                                                 KX_KetsjiEngine *kxengine,
-                                                                                SCA_IObject* gameobj, 
-                                                                                PyTypeObject* T)
-    : SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj, T),
+                                                                                SCA_IObject* gameobj)
+       : SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj),
          m_focusmode(focusmode),
          m_kxscene(kxscene),
          m_kxengine(kxengine)
@@ -357,19 +356,15 @@ PyTypeObject KX_MouseFocusSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_MouseFocusSensor::Parents[] = {
-       &KX_MouseFocusSensor::Type,
-       &SCA_MouseSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_MouseSensor::Type
 };
 
 PyMethodDef KX_MouseFocusSensor::Methods[] = {
@@ -393,15 +388,6 @@ PyAttributeDef KX_MouseFocusSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_MouseFocusSensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_MouseSensor);
-}
-
-PyObject* KX_MouseFocusSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_MouseSensor);
-}
-
-
 const char KX_MouseFocusSensor::GetHitObject_doc[] = 
 "getHitObject()\n"
 "\tReturns the object that was hit by this ray.\n";
index 29d674eb30527875f5186d9fc516390c6335f1af..dfada7a59ccbf049ff42d43289755c86b0cdddde 100644 (file)
@@ -56,8 +56,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
                                                int focusmode,
                                                KX_Scene* kxscene,
                                                KX_KetsjiEngine* kxengine,
-                                               SCA_IObject* gameobj,
-                                               PyTypeObject* T=&Type );
+                                               SCA_IObject* gameobj);
 
        virtual ~KX_MouseFocusSensor() { ; };
        virtual CValue* GetReplica() {
@@ -89,8 +88,6 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
 
        KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRayTarget);
        KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRaySource);
index 44842b7f5b3dacb2936455072b9ab4b80b69ce32..64f6b9306a05af18165e438eeee0b6340967c2d9 100644 (file)
@@ -48,15 +48,13 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
                                                         bool bFindMaterial,
                                                         const STR_String& touchedpropname,
                                                         class KX_Scene* scene,
-                                                        PHY_IPhysicsController*        ctrl,
-                                                        PyTypeObject* T)
+                                                        PHY_IPhysicsController* ctrl)
                         :KX_TouchSensor(eventmgr,
                                                         gameobj,
                                                         bFindMaterial,
                                                         false,
-                                                        touchedpropname,
-                                                        /* scene, */
-                                                        T),
+                                                        touchedpropname
+                                                        /*, scene */),
                         m_Margin(margin),
                         m_ResetMargin(resetmargin)
 
@@ -273,25 +271,17 @@ PyTypeObject KX_NearSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-
-
-PyParentObject KX_NearSensor::Parents[] = {
-       &KX_NearSensor::Type,
-       &KX_TouchSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &KX_TouchSensor::Type
 };
 
-
-
 PyMethodDef KX_NearSensor::Methods[] = {
        //No methods
        {NULL,NULL} //Sentinel
@@ -302,18 +292,3 @@ PyAttributeDef KX_NearSensor::Attributes[] = {
        KX_PYATTRIBUTE_FLOAT_RW_CHECK("resetDistance", 0, 100, KX_NearSensor, m_ResetMargin, CheckResetDistance),
        {NULL} //Sentinel
 };
-
-
-PyObject* KX_NearSensor::py_getattro(PyObject *attr)
-{
-       py_getattro_up(KX_TouchSensor);
-}
-
-PyObject* KX_NearSensor::py_getattro_dict() {
-       py_getattro_dict_up(KX_TouchSensor);
-}
-
-int KX_NearSensor::py_setattro(PyObject*attr, PyObject* value)
-{
-       py_setattro_up(KX_TouchSensor);
-}
index 63099e181a0691cbbc8f2e90bcd9c3a2a9f91a36..f3c1d74805c6bfce520dfa0317999e50cab515d6 100644 (file)
@@ -54,8 +54,7 @@ public:
                        bool bFindMaterial,
                        const STR_String& touchedpropname,
                        class KX_Scene* scene,
-                        PHY_IPhysicsController*        ctrl,
-                       PyTypeObject* T=&Type);
+                        PHY_IPhysicsController*        ctrl);
 /*
 public:
        KX_NearSensor(class SCA_EventManager* eventmgr,
@@ -64,8 +63,7 @@ public:
                        double resetmargin,
                        bool bFindMaterial,
                        const STR_String& touchedpropname,
-                       class KX_Scene* scene,
-                       PyTypeObject* T=&Type);
+                       class KX_Scene* scene);
 */
        virtual ~KX_NearSensor(); 
        virtual void SynchronizeTransform();
@@ -83,9 +81,6 @@ public:
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
 
        //No methods
 
index 62e61667c561cc15eeea5dae7f743f4aac33741d..15e82581bc6ac59d04993c619c5e4e71c9900072 100644 (file)
@@ -53,10 +53,9 @@ KX_ObjectActuator(
        const MT_Vector3& linV,
        const MT_Vector3& angV,
        const short damping,
-       const KX_LocalFlags& flag,
-       PyTypeObject* T
+       const KX_LocalFlags& flag
 ) : 
-       SCA_IActuator(gameobj,T),
+       SCA_IActuator(gameobj),
        m_force(force),
        m_torque(torque),
        m_dloc(dloc),
@@ -343,18 +342,15 @@ PyTypeObject KX_ObjectActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_ObjectActuator::Parents[] = {
-       &KX_ObjectActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_ObjectActuator::Methods[] = {
@@ -414,20 +410,6 @@ PyAttributeDef KX_ObjectActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_ObjectActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-
-PyObject* KX_ObjectActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_ObjectActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 /* Attribute get/set functions */
 
 #ifdef USE_MATHUTILS
index 6ca442b2ec2cbb5460f59f6e25e1e18cadee01b9..20aec9e0e86c0c6b36599ed58a63a4724f6f7e79 100644 (file)
@@ -135,8 +135,7 @@ public:
                const MT_Vector3& linV,
                const MT_Vector3& angV,
                const short damping,
-               const KX_LocalFlags& flag,
-               PyTypeObject* T=&Type
+               const KX_LocalFlags& flag
        );
        ~KX_ObjectActuator();
        CValue* GetReplica();
@@ -163,10 +162,6 @@ public:
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-       
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int     py_setattro(PyObject *attr, PyObject *value);
 
        KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetForce);
        KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetForce);
index cd2ed456c48ddae1c2d0a5d52b691253b360bd1b..a68bafc4d863dc17bc7e2c95bc1683c81eacc016 100644 (file)
@@ -50,9 +50,8 @@ KX_ParentActuator::KX_ParentActuator(SCA_IObject *gameobj,
                                                                         int mode,
                                                                         bool addToCompound,
                                                                         bool ghost,
-                                                                        SCA_IObject *ob,
-                                                                        PyTypeObject* T)
-       : SCA_IActuator(gameobj, T),
+                                                                        SCA_IObject *ob)
+       : SCA_IActuator(gameobj),
          m_mode(mode),
          m_addToCompound(addToCompound),
          m_ghost(ghost),
@@ -158,18 +157,15 @@ PyTypeObject KX_ParentActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_ParentActuator::Parents[] = {
-       &KX_ParentActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
 PyMethodDef KX_ParentActuator::Methods[] = {
@@ -217,18 +213,6 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE
 }
 
 
-PyObject* KX_ParentActuator::py_getattro(PyObject *attr) {     
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_ParentActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_ParentActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
-
 /* Deprecated -----> */
 /* 1. setObject                                                            */
 const char KX_ParentActuator::SetObject_doc[] = 
index 148375e994cd08543587455a4e489cfeea1ff688..aeb39eabf89da6220ba2f172f06055fce46c126e 100644 (file)
@@ -68,8 +68,7 @@ class KX_ParentActuator : public SCA_IActuator
                                                int mode,
                                                bool addToCompound,
                                                bool ghost,
-                                               SCA_IObject *ob,
-                                               PyTypeObject* T=&Type);
+                                               SCA_IObject *ob);
        virtual ~KX_ParentActuator();
        virtual bool Update();
        
@@ -82,10 +81,6 @@ class KX_ParentActuator : public SCA_IActuator
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
        /* These are used to get and set m_ob */
        static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
        static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
index c968e50957e7c4602f108432598e87dde115653a..fb6bc8b898dc40381f02852af39a6331d981cf3b 100644 (file)
@@ -39,8 +39,8 @@
 
 KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper(
                                                PHY_IPhysicsController* ctrl,
-                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T) :
-                                       PyObjectPlus(T),
+                                               PHY_IPhysicsEnvironment* physenv) :
+                                       PyObjectPlus(),
                                        m_ctrl(ctrl),
                                        m_physenv(physenv)
 {
@@ -130,45 +130,17 @@ PyTypeObject KX_PhysicsObjectWrapper::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_PhysicsObjectWrapper::Parents[] = {
-       &KX_PhysicsObjectWrapper::Type,
-       NULL
-};
-
-PyObject* KX_PhysicsObjectWrapper::py_getattro(PyObject *attr)
-{
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* KX_PhysicsObjectWrapper::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-int    KX_PhysicsObjectWrapper::py_setattro(PyObject *attr,PyObject *pyobj)
-{
-       int result = 1;
-
-       if (PyInt_Check(pyobj))
-       {
-               result = 0;
-       }
-       if (PyString_Check(pyobj))
-       {
-               result = 0;
-       }
-       if (result)
-               result = PyObjectPlus::py_setattro(attr,pyobj);
-               
-       return result;
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type
 };
 
-
 PyMethodDef KX_PhysicsObjectWrapper::Methods[] = {
        {"setPosition",(PyCFunction) KX_PhysicsObjectWrapper::sPySetPosition, METH_VARARGS},
        {"setLinearVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetLinearVelocity, METH_VARARGS},
index 1b59686babc0a8e55a881d1a4153be242d7f8c41..fa6fd1d1f2a0dd83759e5817c75236a37edc3c35 100644 (file)
 class  KX_PhysicsObjectWrapper : public PyObjectPlus
 {
        Py_Header;
-
-       virtual PyObject*               py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int                     py_setattro(PyObject *attr, PyObject *value);
 public:
-       KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv,PyTypeObject *T = &Type);
+       KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
        virtual ~KX_PhysicsObjectWrapper();
        
        KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition);
index b56b5500c39fe419ceb86e365633ad06c05e5a96..babead252747ef19ff262851d5d920a7ee9412c6 100644 (file)
@@ -56,17 +56,15 @@ PyTypeObject KX_PolyProxy::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_PolyProxy::Parents[] = {
-       &KX_PolyProxy::Type,
-       &CValue::Type,
-       &PyObjectPlus::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type
 };
 
 PyMethodDef KX_PolyProxy::Methods[] = {
@@ -98,6 +96,7 @@ PyAttributeDef KX_PolyProxy::Attributes[] = {
        { NULL }        //Sentinel
 };
 
+#if 0
 PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
 {
        char *attr_str= PyString_AsString(attr);
@@ -162,12 +161,9 @@ PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
        {
                return PyInt_FromLong(m_polygon->IsCollider());
        }
-       py_getattro_up(CValue);
-}
-
-PyObject* KX_PolyProxy::py_getattro_dict() {
-       py_getattro_dict_up(CValue);
+       // py_getattro_up(CValue); // XXX -- todo, make all these attributes
 }
+#endif
 
 KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon)
 :      m_polygon(polygon),
index d8fd36fec6cb45d1cb8e83858a05f17b98f8420d..e619617d3126f6aa0a43dab498be3e35b52804f4 100644 (file)
@@ -52,8 +52,6 @@ public:
 
 
 // stuff for python integration
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
 
        KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialIndex)
        KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getNumVertex)
index 506c167a9054489631fd472b8200fb62264a9e60..8d8492cc062248dd33b97d7e9c07e6ad77137f6c 100644 (file)
@@ -51,8 +51,8 @@
 
 #include "KX_PyMath.h"
 
-KX_PolygonMaterial::KX_PolygonMaterial(PyTypeObject *T) 
-               : PyObjectPlus(T),
+KX_PolygonMaterial::KX_PolygonMaterial()
+               : PyObjectPlus(),
                  RAS_IPolyMaterial(),
 
        m_tface(NULL),
@@ -256,32 +256,17 @@ PyTypeObject KX_PolygonMaterial::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_PolygonMaterial::Parents[] = {
-       &KX_PolygonMaterial::Type,
-       &PyObjectPlus::Type,
-       NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type
 };
 
-PyObject* KX_PolygonMaterial::py_getattro(PyObject *attr)
-{      
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* KX_PolygonMaterial::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-int KX_PolygonMaterial::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(PyObjectPlus);
-}
-
 KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)")
 {
        PyObject *material;
index 89ecb026da91592ae9d3d5d3832a30b26fa955c9..481c429f658748c1291b73bdd5b5fefc56936e0a 100644 (file)
@@ -57,7 +57,7 @@ private:
 
        mutable int             m_pass;
 public:
-       KX_PolygonMaterial(PyTypeObject *T = &Type);
+       KX_PolygonMaterial();
        void Initialize(const STR_String &texname,
                Material* ma,
                int materialindex,
@@ -116,9 +116,6 @@ public:
        KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial);
        KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram);
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int       py_setattro(PyObject *attr, PyObject *pyvalue);
        virtual PyObject* py_repr(void) { return PyString_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
        
        static PyObject*        pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
index f37925bb0ab9ff298529a481705f7ed0934e9973..4fd16089ee284392604c832c6fd648cf73fe2512 100644 (file)
 #ifndef __KX_PYMATH_H__
 #define __KX_PYMATH_H__
 
-#ifdef USE_MATHUTILS
-extern "C" {
-#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
-}
-#endif
-
 #include "MT_Point2.h"
 #include "MT_Point3.h"
 #include "MT_Vector2.h"
@@ -48,6 +42,12 @@ extern "C" {
 #include "KX_Python.h"
 #include "PyObjectPlus.h"
 
+#ifdef USE_MATHUTILS
+extern "C" {
+#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
+}
+#endif
+
 inline unsigned int Size(const MT_Matrix4x4&)          { return 4; }
 inline unsigned int Size(const MT_Matrix3x3&)          { return 3; }
 inline unsigned int Size(const MT_Tuple2&)                { return 2; }
index d5d0fe3123cd4a39013645df5c5e11765fd9bbd2..b7a573fd0d3b71424288991f21b7eb8da80e7757 100644 (file)
@@ -128,28 +128,62 @@ void initPyObjectPlusType(PyTypeObject **parents)
        }
 }
 
+/*
+typedef PyObject *(*getter)(PyObject *, void *);
+typedef int (*setter)(PyObject *, PyObject *, void *);
+*/
 
-
-
-static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *attributes)
+static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *attributes, int init_getset)
 {
        PyAttributeDef *attr;
-       PyObject *item;
-       
-       PyType_Ready(tp);
-       PyDict_SetItemString(dict, tp->tp_name, reinterpret_cast<PyObject *>(tp));
+
+       if(init_getset) {
+               /* we need to do this for all types before calling PyType_Ready
+                * since they will call the parents PyType_Ready and those might not have initialized vars yet */
+
+               //if(tp->tp_base==NULL)
+               //      printf("Debug: No Parents - '%s'\n" , tp->tp_name);
+
+               if(tp->tp_getset==NULL && attributes->m_name) {
+                       PyGetSetDef *attr_getset;
+                       int attr_tot= 0;
+
+                       for(attr= attributes; attr->m_name; attr++, attr_tot++) {};
+
+                       tp->tp_getset = attr_getset = reinterpret_cast<PyGetSetDef *>(PyMem_Malloc((attr_tot+1) * sizeof(PyGetSetDef))); // XXX - Todo, free
+
+
+                       for(attr= attributes; attr->m_name; attr++, attr_getset++) {
+                               attr_getset->name= (char *)attr->m_name;
+                               attr_getset->doc= NULL;
+
+                               attr_getset->get= reinterpret_cast<getter>(PyObjectPlus::py_get_attrdef);
+
+                               if(attr->m_access==KX_PYATTRIBUTE_RO)
+                                       attr_getset->set= NULL;
+                               else
+                                       attr_getset->set= reinterpret_cast<setter>(PyObjectPlus::py_set_attrdef);
+
+                               attr_getset->closure= reinterpret_cast<void *>(attr);
+                       }
+
+                       memset(attr_getset, 0, sizeof(PyGetSetDef));
+               }
+
+
+               return;
+       } else {
        
-       /* 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);
+               PyObject *item;
+
+               PyType_Ready(tp);
+               PyDict_SetItemString(dict, tp->tp_name, reinterpret_cast<PyObject *>(tp));
        }
        
 }
 
 
-#define PyType_Ready_Attr(d, n)   PyType_Ready_ADD(d, &n::Type, n::Attributes)
+#define PyType_Ready_Attr(d, n, i)   PyType_Ready_ADD(d, &n::Type, n::Attributes, i)
 
 void initPyTypes(void)
 {
@@ -165,70 +199,74 @@ void initPyTypes(void)
        PyDict_SetItemString(PySys_GetObject((char *)"modules"), (char *)"GameTypes", mod);
        Py_DECREF(mod);
        
-       PyType_Ready_Attr(dict, BL_ActionActuator);
-       PyType_Ready_Attr(dict, BL_Shader);
-       PyType_Ready_Attr(dict, BL_ShapeActionActuator);
-       PyType_Ready_Attr(dict, CListValue);
-       PyType_Ready_Attr(dict, CValue);
-       PyType_Ready_Attr(dict, KX_BlenderMaterial);
-       PyType_Ready_Attr(dict, KX_CDActuator);
-       PyType_Ready_Attr(dict, KX_Camera);
-       PyType_Ready_Attr(dict, KX_CameraActuator);
-       PyType_Ready_Attr(dict, KX_ConstraintActuator);
-       PyType_Ready_Attr(dict, KX_ConstraintWrapper);
-       PyType_Ready_Attr(dict, KX_GameActuator);
-       PyType_Ready_Attr(dict, KX_GameObject);
-       PyType_Ready_Attr(dict, KX_IpoActuator);
-       PyType_Ready_Attr(dict, KX_LightObject);
-       PyType_Ready_Attr(dict, KX_MeshProxy);
-       PyType_Ready_Attr(dict, KX_MouseFocusSensor);
-       PyType_Ready_Attr(dict, KX_NearSensor);
-       PyType_Ready_Attr(dict, KX_NetworkMessageActuator);
-       PyType_Ready_Attr(dict, KX_NetworkMessageSensor);
-       PyType_Ready_Attr(dict, KX_ObjectActuator);
-       PyType_Ready_Attr(dict, KX_ParentActuator);
-       PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper);
-       PyType_Ready_Attr(dict, KX_PolyProxy);
-       PyType_Ready_Attr(dict, KX_PolygonMaterial);
-       PyType_Ready_Attr(dict, KX_RadarSensor);
-       PyType_Ready_Attr(dict, KX_RaySensor);
-       PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator);
-       PyType_Ready_Attr(dict, KX_SCA_DynamicActuator);
-       PyType_Ready_Attr(dict, KX_SCA_EndObjectActuator);
-       PyType_Ready_Attr(dict, KX_SCA_ReplaceMeshActuator);
-       PyType_Ready_Attr(dict, KX_Scene);
-       PyType_Ready_Attr(dict, KX_SceneActuator);
-       PyType_Ready_Attr(dict, KX_SoundActuator);
-       PyType_Ready_Attr(dict, KX_StateActuator);
-       PyType_Ready_Attr(dict, KX_TouchSensor);
-       PyType_Ready_Attr(dict, KX_TrackToActuator);
-       PyType_Ready_Attr(dict, KX_VehicleWrapper);
-       PyType_Ready_Attr(dict, KX_VertexProxy);
-       PyType_Ready_Attr(dict, KX_VisibilityActuator);
-       PyType_Ready_Attr(dict, PyObjectPlus);
-       PyType_Ready_Attr(dict, SCA_2DFilterActuator);
-       PyType_Ready_Attr(dict, SCA_ANDController);
-       PyType_Ready_Attr(dict, SCA_ActuatorSensor);
-       PyType_Ready_Attr(dict, SCA_AlwaysSensor);
-       PyType_Ready_Attr(dict, SCA_DelaySensor);
-       PyType_Ready_Attr(dict, SCA_ILogicBrick);
-       PyType_Ready_Attr(dict, SCA_IObject);
-       PyType_Ready_Attr(dict, SCA_ISensor);
-       PyType_Ready_Attr(dict, SCA_JoystickSensor);
-       PyType_Ready_Attr(dict, SCA_KeyboardSensor);
-       PyType_Ready_Attr(dict, SCA_MouseSensor);
-       PyType_Ready_Attr(dict, SCA_NANDController);
-       PyType_Ready_Attr(dict, SCA_NORController);
-       PyType_Ready_Attr(dict, SCA_ORController);
-       PyType_Ready_Attr(dict, SCA_PropertyActuator);
-       PyType_Ready_Attr(dict, SCA_PropertySensor);
-       PyType_Ready_Attr(dict, SCA_PythonController);
-       PyType_Ready_Attr(dict, SCA_RandomActuator);
-       PyType_Ready_Attr(dict, SCA_RandomSensor);
-       PyType_Ready_Attr(dict, SCA_XNORController);
-       PyType_Ready_Attr(dict, SCA_XORController);
-       PyType_Ready_Attr(dict, SCA_IController);
        
+       for(int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */
+               PyType_Ready_Attr(dict, BL_ActionActuator, init_getset);
+               PyType_Ready_Attr(dict, BL_Shader, init_getset);
+               PyType_Ready_Attr(dict, BL_ShapeActionActuator, init_getset);
+               PyType_Ready_Attr(dict, CListValue, init_getset);
+               PyType_Ready_Attr(dict, CValue, init_getset);
+               PyType_Ready_Attr(dict, KX_BlenderMaterial, init_getset);
+               PyType_Ready_Attr(dict, KX_CDActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_Camera, init_getset);
+               PyType_Ready_Attr(dict, KX_CameraActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_ConstraintActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_ConstraintWrapper, init_getset);
+               PyType_Ready_Attr(dict, KX_GameActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_GameObject, init_getset);
+               PyType_Ready_Attr(dict, KX_IpoActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_LightObject, init_getset);
+               PyType_Ready_Attr(dict, KX_MeshProxy, init_getset);
+               PyType_Ready_Attr(dict, KX_MouseFocusSensor, init_getset);
+               PyType_Ready_Attr(dict, KX_NearSensor, init_getset);
+               PyType_Ready_Attr(dict, KX_NetworkMessageActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_NetworkMessageSensor, init_getset);
+               PyType_Ready_Attr(dict, KX_ObjectActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_ParentActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper, init_getset);
+               PyType_Ready_Attr(dict, KX_PolyProxy, init_getset);
+               PyType_Ready_Attr(dict, KX_PolygonMaterial, init_getset);
+               PyType_Ready_Attr(dict, KX_RadarSensor, init_getset);
+               PyType_Ready_Attr(dict, KX_RaySensor, init_getset);
+               PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_SCA_DynamicActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_SCA_EndObjectActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_SCA_ReplaceMeshActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_Scene, init_getset);
+               PyType_Ready_Attr(dict, KX_SceneActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_SoundActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_StateActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_TouchSensor, init_getset);
+               PyType_Ready_Attr(dict, KX_TrackToActuator, init_getset);
+               PyType_Ready_Attr(dict, KX_VehicleWrapper, init_getset);
+               PyType_Ready_Attr(dict, KX_VertexProxy, init_getset);
+               PyType_Ready_Attr(dict, KX_VisibilityActuator, init_getset);
+               PyType_Ready_Attr(dict, PyObjectPlus, init_getset);
+               PyType_Ready_Attr(dict, SCA_2DFilterActuator, init_getset);
+               PyType_Ready_Attr(dict, SCA_ANDController, init_getset);
+               PyType_Ready_Attr(dict, SCA_ActuatorSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_AlwaysSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_DelaySensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_ILogicBrick, init_getset);
+               PyType_Ready_Attr(dict, SCA_IObject, init_getset);
+               PyType_Ready_Attr(dict, SCA_ISensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_JoystickSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_KeyboardSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_MouseSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_NANDController, init_getset);
+               PyType_Ready_Attr(dict, SCA_NORController, init_getset);
+               PyType_Ready_Attr(dict, SCA_ORController, init_getset);
+               PyType_Ready_Attr(dict, SCA_PropertyActuator, init_getset);
+               PyType_Ready_Attr(dict, SCA_PropertySensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_PythonController, init_getset);
+               PyType_Ready_Attr(dict, SCA_RandomActuator, init_getset);
+               PyType_Ready_Attr(dict, SCA_RandomSensor, init_getset);
+               PyType_Ready_Attr(dict, SCA_XNORController, init_getset);
+               PyType_Ready_Attr(dict, SCA_XORController, init_getset);
+               PyType_Ready_Attr(dict, SCA_IController, init_getset);
+       }
+
+
        /* Normal python type */
        PyType_Ready(&KX_PythonSeq_Type);
 
index 064dc9126ac1c518ad7209937097e23d6f3ceb93..3423fec99e0ab2f371ffb5ce9c1a3fe7623773c5 100644 (file)
@@ -49,8 +49,7 @@ KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr,
                        double resetmargin,
                        bool bFindMaterial,
                        const STR_String& touchedpropname,
-                       class KX_Scene* kxscene,
-                       PyTypeObject* T)
+                       class KX_Scene* kxscene)
 
                        : KX_NearSensor(
                                eventmgr,
@@ -61,8 +60,8 @@ KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr,
                                bFindMaterial,
                                touchedpropname,
                                kxscene,
-                               physCtrl,
-                               T),
+                               physCtrl),
+
                                m_coneradius(coneradius),
                                m_coneheight(coneheight),
                                m_axis(axis)
@@ -246,20 +245,15 @@ PyTypeObject KX_RadarSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_RadarSensor::Parents[] = {
-       &KX_RadarSensor::Type,
-       &KX_NearSensor::Type,
-       &KX_TouchSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &KX_NearSensor::Type
 };
 
 PyMethodDef KX_RadarSensor::Methods[] = {
@@ -283,16 +277,3 @@ PyAttributeDef KX_RadarSensor::Attributes[] = {
        {NULL} //Sentinel
 };
 
-PyObject* KX_RadarSensor::py_getattro(PyObject *attr)
-{
-       py_getattro_up(KX_NearSensor);
-}
-
-PyObject* KX_RadarSensor::py_getattro_dict() {
-       py_getattro_dict_up(KX_NearSensor);
-}
-
-int KX_RadarSensor::py_setattro(PyObject *attr, PyObject* value)
-{
-       py_setattro_up(KX_NearSensor);
-}
index 2e5a0e68bedcb5cfa2a67447491749f030712659..344be0e399f0722bf13252e89bacf2cf56a7639d 100644 (file)
@@ -70,8 +70,7 @@ public:
                        double resetmargin,
                        bool bFindMaterial,
                        const STR_String& touchedpropname,
-                       class KX_Scene* kxscene,
-                       PyTypeObject* T = &Type);
+                       class KX_Scene* kxscene);
        KX_RadarSensor();
        virtual ~KX_RadarSensor();
        virtual void SynchronizeTransform();
@@ -89,9 +88,7 @@ public:
                KX_RADAR_AXIS_NEG_Z
        };
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
+       /* python */
        virtual sensortype GetSensorType() { return ST_RADAR; }
 
        //Deprecated ----->
index 78a61e9d95e31a38d959fb2d930f463b784ad34c..ebdef526eaeaa2177e91bc0e1fc69f29d6d5985d 100644 (file)
@@ -55,9 +55,8 @@ KX_RaySensor::KX_RaySensor(class SCA_EventManager* eventmgr,
                                        bool bXRay,
                                        double distance,
                                        int axis,
-                                       KX_Scene* ketsjiScene,
-                                       PyTypeObject* T)
-                       : SCA_ISensor(gameobj,eventmgr, T),
+                                       KX_Scene* ketsjiScene)
+                       : SCA_ISensor(gameobj,eventmgr),
                                        m_propertyname(propname),
                                        m_bFindMaterial(bFindMaterial),
                                        m_bXRay(bXRay),
@@ -337,19 +336,16 @@ PyTypeObject KX_RaySensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-
-};
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 
-PyParentObject KX_RaySensor::Parents[] = {
-       &KX_RaySensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
 };
 
 PyMethodDef KX_RaySensor::Methods[] = {
@@ -447,18 +443,4 @@ PyObject* KX_RaySensor::PyGetHitNormal()
        return retVal;
 }
 
-
-
-PyObject* KX_RaySensor::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* KX_RaySensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int KX_RaySensor::py_setattro(PyObject *attr, PyObject *value) {
-       py_setattro_up(SCA_ISensor);
-}
-
 // <----- Deprecated
index 9efb046742ffe1c390bb5df7909c792333d42a47..530c8ce54e5096aa39b8364914b692245892a40b 100644 (file)
@@ -62,8 +62,7 @@ public:
                                        bool bXRay,
                                        double distance,
                                        int axis,
-                                       class KX_Scene* ketsjiScene,
-                                       PyTypeObject* T = &Type);
+                                       class KX_Scene* ketsjiScene);
        virtual ~KX_RaySensor();
        virtual CValue* GetReplica();
 
@@ -84,11 +83,6 @@ public:
                KX_RAY_AXIS_NEG_Y,
                KX_RAY_AXIS_NEG_Z
        };
-
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
        
        // Deprecated ----->
        KX_PYMETHOD_DOC_NOARGS(KX_RaySensor,GetHitObject);
index 75435b977973f12784a21531b9af16192f128387..2a4ae3a2abdd5ee6a6d338c696b8cd78cf46ca05 100644 (file)
@@ -55,10 +55,9 @@ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj,
                                                                                                   const float *linvel,
                                                                                                   bool linv_local,
                                                                                                   const float *angvel,
-                                                                                                  bool angv_local,
-                                                                                                  PyTypeObject* T)
+                                                                                                  bool angv_local)
        : 
-       SCA_IActuator(gameobj, T),
+       SCA_IActuator(gameobj),
        m_OriginalObject(original),
        m_scene(scene),
        
@@ -188,19 +187,17 @@ PyTypeObject KX_SCA_AddObjectActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
-PyParentObject KX_SCA_AddObjectActuator::Parents[] = {
-       &KX_SCA_AddObjectActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
-};
 PyMethodDef KX_SCA_AddObjectActuator::Methods[] = {
   // ---> deprecated
   {"setTime", (PyCFunction) KX_SCA_AddObjectActuator::sPySetTime, METH_O, (PY_METHODCHAR)SetTime_doc},
@@ -263,21 +260,6 @@ PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, con
                return actuator->m_lastCreatedObject->GetProxy();
 }
 
-
-PyObject* KX_SCA_AddObjectActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SCA_AddObjectActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SCA_AddObjectActuator::py_setattro(PyObject *attr, PyObject* value) 
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 /* 1. setObject */
 const char KX_SCA_AddObjectActuator::SetObject_doc[] = 
 "setObject(object)\n"
index 6746b7d1bc6e3d8716f5939d1799e9b4e243e749..3151e7a89cafd28db593ffadc3cc7ac260089f64 100644 (file)
@@ -88,8 +88,7 @@ public:
                const float *linvel,
                bool linv_local,
                const float *angvel,
-               bool angv_local,
-               PyTypeObject* T=&Type
+               bool angv_local
        );
 
        ~KX_SCA_AddObjectActuator(void);
@@ -110,10 +109,6 @@ public:
        virtual bool 
        Update();
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
                SCA_IObject*    
        GetLastCreatedObject(
        ) const ;
index a50764a54e6d5d31e9fa39077ce32b952c5e3e5d..8626512fdf355abcd7341797450aaead60d3cdaa 100644 (file)
@@ -47,9 +47,7 @@
 
 /* Integration hooks ------------------------------------------------------- */
 
-       PyTypeObject 
-
-KX_SCA_DynamicActuator::Type = {
+PyTypeObject KX_SCA_DynamicActuator::Type = {
 #if (PY_VERSION_HEX >= 0x02060000)
        PyVarObject_HEAD_INIT(NULL, 0)
 #else
@@ -67,21 +65,17 @@ KX_SCA_DynamicActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_SCA_DynamicActuator::Parents[] = {
-       &KX_SCA_DynamicActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
-
 PyMethodDef KX_SCA_DynamicActuator::Methods[] = {
        // ---> deprecated
        KX_PYMETHODTABLE(KX_SCA_DynamicActuator, setOperation),
@@ -96,21 +90,6 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
 };
 
 
-PyObject* KX_SCA_DynamicActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SCA_DynamicActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SCA_DynamicActuator::py_setattro(PyObject *attr, PyObject* value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
-
 /* 1. setOperation */
 KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, setOperation,
 "setOperation(operation?)\n"
@@ -152,10 +131,9 @@ KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, getOperation,
 
 KX_SCA_DynamicActuator::KX_SCA_DynamicActuator(SCA_IObject *gameobj,
                                                                                                           short dyn_operation,
-                                                                                                          float setmass,
-                                                                                                          PyTypeObject* T) : 
+                                                                                                          float setmass) :
 
-       SCA_IActuator(gameobj, T),
+       SCA_IActuator(gameobj),
        m_dyn_operation(dyn_operation),
        m_setmass(setmass)
 {
index 4add707f8cddeafcddc37397335896b8e091b3d9..8b598c9ecfa9480faaf1432c1ea8de8eec6e935a 100644 (file)
@@ -50,8 +50,7 @@ class KX_SCA_DynamicActuator : public SCA_IActuator
        KX_SCA_DynamicActuator(
                SCA_IObject* gameobj, 
                short dyn_operation,
-               float setmass,
-               PyTypeObject* T=&Type
+               float setmass
        );
 
        ~KX_SCA_DynamicActuator(
@@ -73,11 +72,6 @@ class KX_SCA_DynamicActuator : public SCA_IActuator
                KX_DYN_SET_MASS,
        };
 
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* 1. setOperation */
        KX_PYMETHOD_DOC(KX_SCA_DynamicActuator,setOperation);
        KX_PYMETHOD_DOC(KX_SCA_DynamicActuator,getOperation);
index 728254e7f48bc2d133494b6289ce324400dfd47a..bf1ada97b9e878a33f82ee5c16004125405f2d31 100644 (file)
@@ -43,9 +43,8 @@
 #endif
 
 KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj,
-                                                                                                  SCA_IScene* scene,
-                                                                                                  PyTypeObject* T): 
-       SCA_IActuator(gameobj, T),
+                                                                                                  SCA_IScene* scene):
+       SCA_IActuator(gameobj),
        m_scene(scene)
 {
     // intentionally empty 
@@ -109,23 +108,17 @@ PyTypeObject KX_SCA_EndObjectActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-
-PyParentObject KX_SCA_EndObjectActuator::Parents[] = {
-       &KX_SCA_EndObjectActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_SCA_EndObjectActuator::Methods[] = {
   {NULL,NULL} //Sentinel
 };
@@ -134,13 +127,4 @@ PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_SCA_EndObjectActuator::py_getattro(PyObject *attr)
-{
-  py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SCA_EndObjectActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
 /* eof */
index 70d72f1f8da3c5065417b5e000fe330bb5fb98b0..782a24b1ef1efa53ac3ff290f82935b5a45fdbff 100644 (file)
@@ -47,8 +47,7 @@ class KX_SCA_EndObjectActuator : public SCA_IActuator
  public:
        KX_SCA_EndObjectActuator(
                SCA_IObject* gameobj,
-               SCA_IScene* scene,
-               PyTypeObject* T=&Type
+               SCA_IScene* scene
        );
 
        ~KX_SCA_EndObjectActuator();
@@ -63,9 +62,6 @@ class KX_SCA_EndObjectActuator : public SCA_IActuator
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
        
 }; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */
 
index 00842d7012aec77129632a9902ce0a92586ff1c3..873272a37f969debdee9d9a77a6ed638273040d8 100644 (file)
@@ -50,9 +50,7 @@
 
 /* Integration hooks ------------------------------------------------------- */
 
-       PyTypeObject 
-
-KX_SCA_ReplaceMeshActuator::Type = {
+PyTypeObject KX_SCA_ReplaceMeshActuator::Type = {
 #if (PY_VERSION_HEX >= 0x02060000)
        PyVarObject_HEAD_INIT(NULL, 0)
 #else
@@ -70,22 +68,17 @@ KX_SCA_ReplaceMeshActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_SCA_ReplaceMeshActuator::Parents[] = {
-       &KX_SCA_ReplaceMeshActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = {
        KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, instantReplaceMesh),
        // Deprecated ----->
@@ -99,20 +92,6 @@ PyAttributeDef KX_SCA_ReplaceMeshActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_SCA_ReplaceMeshActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SCA_ReplaceMeshActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SCA_ReplaceMeshActuator::py_setattro(PyObject *attr, PyObject* value) 
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 PyObject* KX_SCA_ReplaceMeshActuator::pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_SCA_ReplaceMeshActuator* actuator = static_cast<KX_SCA_ReplaceMeshActuator*>(self);
@@ -178,10 +157,9 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh,
 
 KX_SCA_ReplaceMeshActuator::KX_SCA_ReplaceMeshActuator(SCA_IObject *gameobj,
                                                                                                           class RAS_MeshObject *mesh,
-                                                                                                          SCA_IScene* scene,
-                                                                                                          PyTypeObject* T) : 
+                                                                                                          SCA_IScene* scene) :
 
-       SCA_IActuator(gameobj, T),
+       SCA_IActuator(gameobj),
        m_mesh(mesh),
        m_scene(scene)
 {
index 0e7f7852701c0213dd756c78ef48023400dde0b0..6a68bd88cc5a382dbc3ccd249b8601a500a3db54 100644 (file)
@@ -55,9 +55,7 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
        KX_SCA_ReplaceMeshActuator(
                SCA_IObject* gameobj, 
                RAS_MeshObject *mesh, 
-               SCA_IScene* scene,
-               PyTypeObject* T=&Type
-       );
+               SCA_IScene* scene);
 
        ~KX_SCA_ReplaceMeshActuator(
        );
@@ -71,10 +69,7 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
 
        void    InstantReplaceMesh();
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
+       /* python api */
        static PyObject* pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
        static int pyattr_set_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
index c0d8a7090c4a1fd9b851e0cf394037de845ef778..f2bbc8e6fefbed2e0aa613a8060c0eb2663d1ae4 100644 (file)
@@ -138,7 +138,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
                                   class SND_IAudioDevice* adi,
                                   const STR_String& sceneName,
                                   Scene *scene): 
-       PyObjectPlus(&KX_Scene::Type),
+       PyObjectPlus(),
        m_keyboardmgr(NULL),
        m_mousemgr(NULL),
        m_sceneConverter(NULL),
@@ -1630,16 +1630,15 @@ PyTypeObject KX_Scene::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_Scene::Parents[] = {
-       &KX_Scene::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &CValue::Type
 };
 
 PyMethodDef KX_Scene::Methods[] = {
@@ -1730,72 +1729,6 @@ PyAttributeDef KX_Scene::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_Scene::py_getattro__internal(PyObject *attr)
-{      
-       py_getattro_up(PyObjectPlus);
-}
-
-int KX_Scene::py_setattro__internal(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(PyObjectPlus);
-}
-
-PyObject* KX_Scene::py_getattro(PyObject *attr)
-{
-       PyObject *object = py_getattro__internal(attr);
-       
-       if (object==NULL)
-       {
-               PyErr_Clear();
-               object = PyDict_GetItem(m_attr_dict, attr);
-               if(object) {
-                       Py_INCREF(object);
-               }
-               else {
-                       PyErr_Format(PyExc_AttributeError, "value = scene.myAttr: KX_Scene, attribute \"%s\" not found", PyString_AsString(attr));
-               }
-       }
-       
-       return object;
-}
-
-PyObject* KX_Scene::py_getattro_dict() {
-       //py_getattro_dict_up(PyObjectPlus);
-       
-       PyObject *dict= py_getattr_dict(PyObjectPlus::py_getattro_dict(), Type.tp_dict);
-       if(dict==NULL)
-               return NULL;
-       
-       /* normally just return this but KX_Scene has some more items */
-       
-       PyDict_Update(dict, m_attr_dict);
-       return dict;
-}
-
-int KX_Scene::py_setattro(PyObject *attr, PyObject *value)
-{
-       int ret= py_setattro__internal(attr, value);
-       
-       if (ret==PY_SET_ATTR_MISSING) {
-               if (PyDict_SetItem(m_attr_dict, attr, value)==0) {
-                       PyErr_Clear();
-                       ret= PY_SET_ATTR_SUCCESS;
-               }
-               else {
-                       PyErr_SetString(PyExc_AttributeError, "scene.UserAttr = value: KX_Scenes, failed assigning value to internal dictionary");
-                       ret= PY_SET_ATTR_FAIL;
-               }
-       }
-       
-       return ret;
-}
-
-int KX_Scene::py_delattro(PyObject *attr)
-{
-       PyDict_DelItem(m_attr_dict, attr);
-       return 0;
-}
-
 KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getLightList,
 "getLightList() -> list [KX_Light]\n"
 "Returns a list of all lights in the scene.\n"
index 79d3f7fd828bf8f0eba156a57d25220c80350814..edc4297ff14d56c309f9836ae0326e9d197a7e6c 100644 (file)
@@ -563,15 +563,7 @@ public:
        static PyObject*        pyattr_get_active_camera(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
-       virtual PyObject* py_getattro(PyObject *attr); /* name, active_camera, gravity, suspended, viewport, framing, activity_culling, activity_culling_radius */
-       virtual PyObject* py_getattro_dict();
-       
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-       virtual int py_delattro(PyObject *attr);
        virtual PyObject* py_repr(void) { return PyString_FromString(GetName().ReadPtr()); }
-
-       PyObject* py_getattro__internal(PyObject *attr);
-       int py_setattro__internal(PyObject *attr, PyObject *pyvalue);
                
        /**
         * Sets the time the scene was suspended
index 1b790ec98248d4660eddcf28a94116a012307931..16521f2ddcc6e65920f90627308535323797e713 100644 (file)
@@ -49,9 +49,8 @@ KX_SceneActuator::KX_SceneActuator(SCA_IObject *gameobj,
                                                                   KX_Scene *scene,
                                                                   KX_KetsjiEngine* ketsjiEngine,
                                                                   const STR_String& nextSceneName,
-                                                                  KX_Camera* camera,
-                                                                  PyTypeObject* T)
-                                                                  : SCA_IActuator(gameobj, T)
+                                                                  KX_Camera* camera)
+                                                                  : SCA_IActuator(gameobj)
 {
        m_mode = mode;
        m_scene  = scene;
@@ -134,7 +133,7 @@ bool KX_SceneActuator::Update()
                {
                        // if no camera is set and the parent object is a camera, use it as the camera
                        SCA_IObject* parent = GetParent();
-                       if (parent->isA(&KX_Camera::Type))
+                       if (parent->GetGameObjectType()==SCA_IObject::OBJ_CAMERA)
                        {
                                m_scene->SetActiveCamera((KX_Camera*)parent);
                        }
@@ -240,25 +239,17 @@ PyTypeObject KX_SceneActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-PyParentObject KX_SceneActuator::Parents[] =
-{
-       &KX_SceneActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_SceneActuator::Methods[] =
 {
        //Deprecated functions ------>
@@ -280,20 +271,6 @@ PyAttributeDef KX_SceneActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_SceneActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SceneActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SceneActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 PyObject* KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_SceneActuator* actuator = static_cast<KX_SceneActuator*>(self);
index 2412dd025903731505c587b5d430d6d6ff82cd0b..86de3395d1e5a0ed11b6534f1e3cdbf6268f8d64 100644 (file)
@@ -77,8 +77,7 @@ class KX_SceneActuator : public SCA_IActuator
                                         KX_Scene* scene,
                                         KX_KetsjiEngine* ketsjiEngine,
                                         const STR_String& nextSceneName,
-                                        KX_Camera* camera,
-                                        PyTypeObject* T=&Type);
+                                        KX_Camera* camera);
        virtual ~KX_SceneActuator();
 
        virtual CValue* GetReplica();
@@ -92,10 +91,6 @@ class KX_SceneActuator : public SCA_IActuator
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject *value);
-
        /* 1. set                                                                */
        /* Removed */
          
index c13271f66a583fd1313963121f2855c0137fbeba..28e46cc9fa2e87f5c7e9b5066b7b72f65c33cd79 100644 (file)
@@ -50,9 +50,8 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
                                                                   SND_Scene*   sndscene,
                                                                   KX_SOUNDACT_TYPE type,
                                                                   short start,
-                                                                  short end,
-                                                                  PyTypeObject* T)
-                                                                  : SCA_IActuator(gameobj,T)
+                                                                  short end)
+                                                                  : SCA_IActuator(gameobj)
 {
        m_soundObject = sndobj;
        m_soundScene = sndscene;
@@ -251,24 +250,17 @@ PyTypeObject KX_SoundActuator::Type = {
                0,
                py_base_repr,
                0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-
-PyParentObject KX_SoundActuator::Parents[] = {
-       &KX_SoundActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               NULL, //py_base_getattro,
+               NULL, //py_base_setattro,
+               0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type
 };
 
-
-
 PyMethodDef KX_SoundActuator::Methods[] = {
        // Deprecated ----->
        {"setFilename", (PyCFunction) KX_SoundActuator::sPySetFilename, METH_VARARGS,NULL},
@@ -340,18 +332,6 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
 }
 
 /* Atribute setting and getting -------------------------------------------- */
-PyObject* KX_SoundActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SoundActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SoundActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
 
 PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
index a7491355667a6746796574beab259d2863a07815..adafee0a30bd6116f5209e8140017258339bf746 100644 (file)
@@ -66,8 +66,7 @@ public:
                                        class SND_Scene*        sndscene,
                                        KX_SOUNDACT_TYPE type,
                                        short start,
-                                       short end,
-                                       PyTypeObject* T=&Type);
+                                       short end);
 
        ~KX_SoundActuator();
 
@@ -81,10 +80,6 @@ public:
        /* Python interface --------------------------------------------------- */
        /* -------------------------------------------------------------------- */
 
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
-
        KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, startSound);
        KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, pauseSound);
        KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, stopSound);
index f6979eee0f40de44279421ffef7cf5751ddd92a2..ad21258a3b639431cc8b4a6a3680f1bf79b2e3a2 100644 (file)
 KX_StateActuator::KX_StateActuator(
        SCA_IObject* gameobj,
        int operation,
-       unsigned int mask,
-       PyTypeObject* T
+       unsigned int mask
        ) 
-       : SCA_IActuator(gameobj,T),
+       : SCA_IActuator(gameobj),
          m_operation(operation),
          m_mask(mask)
 {
@@ -155,23 +154,18 @@ PyTypeObject KX_StateActuator::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject 
-KX_StateActuator::Parents[] = {
-       &KX_StateActuator::Type,
-       &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type
 };
 
-PyMethodDef 
-KX_StateActuator::Methods[] = {
+PyMethodDef KX_StateActuator::Methods[] = {
        // deprecated -->
        {"setOperation", (PyCFunction) KX_StateActuator::sPySetOperation, 
         METH_VARARGS, (PY_METHODCHAR)SetOperation_doc},
@@ -187,20 +181,6 @@ PyAttributeDef KX_StateActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_StateActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_StateActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_StateActuator::py_setattro(PyObject *attr, PyObject* value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 
 /* set operation ---------------------------------------------------------- */
 const char 
index a4191a4c5fd5216b5250e8f3074404f9e974234c..ce86c4b44fe14b8c995f00bb64608da19ce710f3 100644 (file)
@@ -66,9 +66,8 @@ class KX_StateActuator : public SCA_IActuator
        KX_StateActuator(
                SCA_IObject* gameobj,
                int operation,
-               unsigned int mask,
-               PyTypeObject* T=&Type
-               );
+               unsigned int mask
+       );
 
        virtual
                ~KX_StateActuator(
@@ -89,10 +88,6 @@ class KX_StateActuator : public SCA_IActuator
        /* --------------------------------------------------------------------- */
        /* Python interface ---------------------------------------------------- */
        /* --------------------------------------------------------------------- */
-
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
-       virtual int py_setattro(PyObject *attr, PyObject* value);
        //KX_PYMETHOD_DOC
        KX_PYMETHOD_DOC_VARARGS(KX_StateActuator,SetOperation);
        KX_PYMETHOD_DOC_VARARGS(KX_StateActuator,SetMask);
index c06acd4a873f2175efe76f75587903431e313573..8686de8f2ca14160a1a9763efa4f121c2778f724 100644 (file)
@@ -97,8 +97,8 @@ bool KX_TouchSensor::Evaluate()
        return result;
 }
 
-KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj,bool bFindMaterial,bool bTouchPulse,const STR_String& touchedpropname,PyTypeObject* T)
-:SCA_ISensor(gameobj,eventmgr,T),
+KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj,bool bFindMaterial,bool bTouchPulse,const STR_String& touchedpropname)
+:SCA_ISensor(gameobj,eventmgr),
 m_touchedpropname(touchedpropname),
 m_bFindMaterial(bFindMaterial),
 m_bTouchPulse(bTouchPulse),
@@ -311,18 +311,15 @@ PyTypeObject KX_TouchSensor::Type = {
        0,
        py_base_repr,
        0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
-       0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject KX_TouchSensor::Parents[] = {
-       &KX_TouchSensor::Type,
-       &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       NULL, //py_base_getattro,
+       NULL, //py_base_setattro,
+       0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_ISensor::Type
 };
 
 PyMethodDef KX_TouchSensor::Methods[] = {
@@ -348,20 +345,6 @@ PyAttributeDef KX_TouchSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* KX_TouchSensor::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* KX_TouchSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int KX_TouchSensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 /* Python API */
 
 /* 1. setProperty */
index 476c63e89dbc064f0b84bf866d244d5112dc05f3..6cbf5b15e3b4bb897404dcf41d12db134ce45f7c 100644 (file)
--- a/