Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-29 16:06:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-29 16:06:46 +0400
commit9a7ea9664e27679935adaea3093630d7a6a30b5d (patch)
tree96d706f511e571c490f33a4b1702a48c53033723 /source/gameengine/Converter
parent7ca31bb171b2c94f8e9b928990363a42af8716fb (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/Converter')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp10
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.cpp9
2 files changed, 8 insertions, 11 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index d9e65c53fac..bed99a4f502 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -1005,19 +1005,17 @@ PyTypeObject BL_ActionActuator::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,
- &SCA_IActuator::Type
+ &SCA_IActuator::Type,
+ 0,0,0,0,0,0,
+ py_base_new
};
-
PyMethodDef BL_ActionActuator::Methods[] = {
//Deprecated ----->
{"setAction", (PyCFunction) BL_ActionActuator::sPySetAction, METH_VARARGS, (PY_METHODCHAR)SetAction_doc},
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index 4c9a584d72b..970539777f4 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -427,16 +427,15 @@ PyTypeObject BL_ShapeActionActuator::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,
- &SCA_IActuator::Type
+ &SCA_IActuator::Type,
+ 0,0,0,0,0,0,
+ py_base_new
};