diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-18 00:06:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-18 00:06:06 +0400 |
commit | df8cf26404c7e922751643b1095e38f1ab430811 (patch) | |
tree | b4258cc6c90913c379f5cdd05edebd8785230647 /source/gameengine/Ketsji/KX_GameObject.h | |
parent | 90c6cf77f10961de756f6ff06329d3fa65ce3da4 (diff) |
Added m_zombie to the base python class (PyObjectPlus), when this is set all the subclasses will raise an error on access to their members.
Other small changes...
- KX_Camera and KX_Light didnt have get/setitem access in their PyType definition.
- CList.from_id() error checking for a long was checking for -1 against an unsigned value (own fault)
- CValue::SpecialRelease was incrementing an int for no reason.
- renamed m_attrlist to m_attr_dict since its a PyDict type.
- removed custom getattro/setattro functions for KX_Scene and KX_GameObject, use py_base_getattro, py_base_setattro for all subclasses of PyObjectPlus.
- lowercase windows.h in VideoBase.cpp for cross compiling.
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index cf0c0e6b0f5..dd85c2f2faa 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -62,7 +62,6 @@ struct Object; /* utility conversion function */ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok); -bool ValidPythonToGameObject(KX_GameObject *object); /** * KX_GameObject is the main class for dynamic objects. @@ -119,15 +118,15 @@ public: // these can be used with property actuators // // For the python API, For types that cannot be converted into CValues (lists, dicts, GameObjects) - // these will be put into "m_attrlist", logic bricks cannot access them. + // these will be put into "m_attr_dict", logic bricks cannot access them. // // rules for setting attributes. // - // * there should NEVER be a CValue and a m_attrlist attribute with matching names. get/sets make sure of this. - // * if CValue conversion fails, use a PyObject in "m_attrlist" - // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attrlist" and set the CValue + // * there should NEVER be a CValue and a m_attr_dict attribute with matching names. get/sets make sure of this. + // * if CValue conversion fails, use a PyObject in "m_attr_dict" + // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue // - PyObject* m_attrlist; + PyObject* m_attr_dict; virtual void /* This function should be virtual - derived classed override it */ Relink( @@ -814,16 +813,21 @@ public: virtual PyObject* py_getattro(PyObject *attr); virtual int py_setattro(PyObject *attr, PyObject *value); // py_setattro method + virtual int py_delattro(PyObject *attr); virtual PyObject* py_repr(void) { - if (ValidPythonToGameObject(this)==false) + if (IsZombiePyErr()) return NULL; return PyString_FromString(GetName().ReadPtr()); } - static PyObject *py_base_getattro_gameobject(PyObject * self, PyObject *attr); - static int py_base_setattro_gameobject(PyObject * self, PyObject *attr, PyObject *value); + /* 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); KX_PYMETHOD_O(KX_GameObject,SetWorldPosition); @@ -897,7 +901,6 @@ public: static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_is_valid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); /* for dir(), python3 uses __dir__() */ static PyObject* pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); @@ -913,7 +916,6 @@ public: static PyObject* Map_GetItem(PyObject *self_v, PyObject *item); static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val); - private : /** @@ -931,5 +933,7 @@ private : }; + + #endif //__KX_GAMEOBJECT |