diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-27 15:35:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-27 15:35:55 +0400 |
commit | f0a3cbcdac4c7f84daef7c33e858a10277400a5f (patch) | |
tree | 29f78ca1043a106bca0230f895dab7ace4f81c30 /source | |
parent | a8f00246bae68a08562832fbb010ff674e293599 (diff) |
patch [#15865] BGE API call to delete objects
from Dalai Felinto (dfelinto)
renamed deleteObject to endObject() to match the user interface.
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 13 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.h | 3 | ||||
-rw-r--r-- | source/gameengine/PyDoc/KX_GameObject.py | 5 |
3 files changed, 20 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 3ca5f5809e6..fd06b223216 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -825,6 +825,7 @@ PyMethodDef KX_GameObject::Methods[] = { {"getMesh", (PyCFunction)KX_GameObject::sPyGetMesh,METH_VARARGS}, {"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_VARARGS}, {"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_VARARGS}, + {"endObject",(PyCFunction) KX_GameObject::sPyEndObject, METH_VARARGS}, KX_PYMETHODTABLE(KX_GameObject, getDistanceTo), KX_PYMETHODTABLE(KX_GameObject, rayCastTo), KX_PYMETHODTABLE(KX_GameObject, rayCast), @@ -858,6 +859,18 @@ PyObject* KX_GameObject::sPySetPosition(PyObject* self, } +PyObject* KX_GameObject::PyEndObject(PyObject* self, + PyObject* args, + PyObject* kwds) +{ + + KX_Scene *scene = PHY_GetActiveScene(); + scene->DelayedRemoveObject(this); + + return Py_None; + +} + PyObject* KX_GameObject::PyGetPosition(PyObject* self, PyObject* args, diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 796cb4a161f..682b339bf62 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -710,7 +710,7 @@ public: PyObject* args, PyObject* kwds ); - + KX_PYMETHOD(KX_GameObject,GetPosition); KX_PYMETHOD(KX_GameObject,GetLinearVelocity); KX_PYMETHOD(KX_GameObject,GetVelocity); @@ -733,6 +733,7 @@ public: KX_PYMETHOD(KX_GameObject,RemoveParent); KX_PYMETHOD(KX_GameObject,GetPhysicsId); KX_PYMETHOD(KX_GameObject,GetPropertyNames); + KX_PYMETHOD(KX_GameObject,EndObject); KX_PYMETHOD_DOC(KX_GameObject,rayCastTo); KX_PYMETHOD_DOC(KX_GameObject,rayCast); KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo); diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py index 572ac2d42ae..f971a7f5f54 100644 --- a/source/gameengine/PyDoc/KX_GameObject.py +++ b/source/gameengine/PyDoc/KX_GameObject.py @@ -25,6 +25,11 @@ class KX_GameObject: @ivar timeOffset: adjust the slowparent delay at runtime. @type timeOffset: float """ + def endObject(visible): + """ + Delete this object, can be used inpace of the EndObject Actuator. + The actual removal of the object from the scene is delayed. + """ def getVisible(visible): """ Gets the game object's visible flag. |