diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-29 16:06:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-29 16:06:46 +0400 |
commit | 9a7ea9664e27679935adaea3093630d7a6a30b5d (patch) | |
tree | 96d706f511e571c490f33a4b1702a48c53033723 /source/gameengine/Ketsji/KX_VertexProxy.cpp | |
parent | 7ca31bb171b2c94f8e9b928990363a42af8716fb (diff) |
BGE PyAPI support for subclassing any BGE game type from python, scripters define extra functions on gameObjects.
Adding a UI to set the type on startup can be added easily.
# ----
class myPlayer(GameTypes.KX_GameObject):
def die(self):
# ... do stuff ...
self.endObject()
# make an instance
player = myPlayer(gameOb) # gameOb is made invalid now.
player.die()
# ----
One limitation (which could also be an advantage), is making the subclass instance will return that subclass everywhere, you cant have 2 different subclasses of the same BGE data at once.
Diffstat (limited to 'source/gameengine/Ketsji/KX_VertexProxy.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_VertexProxy.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 34a84f908a8..cb8c891969d 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -53,16 +53,15 @@ PyTypeObject KX_VertexProxy::Type = { 0, 0, py_base_repr, - 0,0,0,0,0,0, - NULL, //py_base_getattro, - NULL, //py_base_setattro, - 0, + 0,0,0,0,0,0,0,0,0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, 0,0,0,0,0,0,0, Methods, 0, 0, - &CValue::Type + &CValue::Type, + 0,0,0,0,0,0, + py_base_new }; PyMethodDef KX_VertexProxy::Methods[] = { |