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 ce4311f..1787909 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 422b16b..e328ce1 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 7aa8714..b92e94b 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 d268eef..890fe3f 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 59344dd..4cad472 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 68e900e..98e6f21 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 2d4cc61..552e839 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 3b5eebe..0fe3e9f 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 61dabff..45eb15e 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 29ef19b..9da75b9 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 caed85b..8e54043 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 13b9997..c357c4f 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 87f7c61..fc2f9cd 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 9a359d5..cb16d7f 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 4dad65c..b6a9471 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 6655e08..cf8e735 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 ff02680..a14db7d 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 0f85a64..d58e055 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 dcdae0b..afc9028 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 5ccb33f..8270e89 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 8e044b8..6096930 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 6a34d7b..705f6df 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 be7c265..0fda755 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 27afcbc..13c718e 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 f2c3c83..7880daf 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 a52c57a..523878b 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 2dc80f5..d747dae 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 779e539..5067985 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 9876f25..698e845 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 eae4277..3060410 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 2783bf1..de70301 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 9bbd6ed..81864ab 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 3365296..645c73e 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 e6a1d2e..32f8ce5 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 f8ee8ed..34ade17 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 033225c..3185b38 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 c5e1c3c..3a1e619 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 6d6302b..47f0378 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 d27aea5..d4a6a44 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 0ae0ff1..36a145e 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 6c91416..67e0916 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 06cbb70..b962323 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 42c0a67..1dd8166 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 66f772c..09d31a8 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 4faa4b5..7eb088b 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 a8df08d..8fb2e7a 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 3b343af..b157116 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 538ecd6..3513fcd 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 80e4f54..fb12674 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 0c2af79..9311b3f 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 a722590..a272306 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 5986358..c7d3fe2 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 d5cbeef..8a6f42c 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 b2bf244..5e66c36 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 aee8e26..584a6b1 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 4aad576..18e77fa 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 5afb3a7..9f570ac 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 feb9f2e..2607a53 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 c5c517c..b595aab 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 7db40e7..517f315 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 6377335..6080591 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 cf92fd4..b4f55f2 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 8ddcd87..da43893 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 53183f3..ade8769 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 30057fc..9e3b718 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 b29f2df..6eb9647 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 8511526..6e01bf0 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 2fd05ab..b01ad73 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 40f6c99..4ccbf73 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 aef21cd..74c8e6d 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 f8557da..b960ae2 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 efa4e2f..057c6fe 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 bd03dea..7e5a2e3 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 40607b4..677904a 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 c5cf67a..be23eff 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 03813e0..7467094 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 28bf12f..2a769cf 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 b2b1d6e..cabbf82 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 577f767..30b3cb2 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 5928571..1abd439 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 3ec0598..18e9125 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 9ea597d..01051ca 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 ae9e097..c7d8ab4 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 358c705..0b7ccbe 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 11effa1..79aa887 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 bfdd4be..4b65436 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 fde10a4..e38ec70 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 29d674e..dfada7a 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 44842b7..64f6b93 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 63099e1..f3c1d74 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 62e6166..15e8258 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 6ca442b..20aec9e 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 cd2ed45..a68bafc 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 148375e..aeb39ea 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 c968e50..fb6bc8b 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 1b59686..fa6fd1d 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 b56b550..babead2 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 d8fd36f..e619617 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 506c167..8d8492c 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 89ecb02..481c429 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 f37925b..4fd1608 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 d5d0fe3..b7a573f 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 064dc91..3423fec 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 2e5a0e6..344be0e 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 78a61e9..ebdef52 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 9efb046..530c8ce 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 75435b9..2a4ae3a 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 6746b7d..3151e7a 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 a50764a..8626512 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 4add707..8b598c9 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 728254e..bf1ada9 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 70d72f1..782a24b 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 00842d7..873272a 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 0e7f785..6a68bd8 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 c0d8a70..f2bbc8e 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 79d3f7f..edc4297 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 1b790ec..16521f2 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 2412dd0..86de339 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 c13271f..28e46cc 100644 (file)
@@ -50,9 +50,8 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
                                                                   SND_Scene*   sndscene,
                                                                   KX_SOUNDACT_TYPE type,
                                                                   short start,
-                                                                  short end,
-                                &n