diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-26 16:39:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-26 16:39:06 +0400 |
commit | 11cdc2a002c5baf1a1405e7dc246cacbd2d9392d (patch) | |
tree | 7a816d48b63e57320ce4ff7716c760091cb17912 /source/gameengine/Ketsji | |
parent | ac25593479b2b45908312f83d255cd7d225b4ba2 (diff) |
Python API/Game engine fixes, dosn't affect 2.47
* Action FrameProp was checking if the string was true, not that it contained any text.
* Added GameObject.getVisible() since there is already a getVisible
* Added GameObject.getPropertyNames() Needed in apricot so Franky can collect and throw items in the level without having the names defined elsewhere or modifying his game logic which is stored in a separate blend file.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 15 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 4b467a229f0..3ca5f5809e6 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -803,6 +803,7 @@ void KX_GameObject::Suspend(void) PyMethodDef KX_GameObject::Methods[] = { {"setVisible",(PyCFunction) KX_GameObject::sPySetVisible, METH_VARARGS}, + {"getVisible",(PyCFunction) KX_GameObject::sPyGetVisible, METH_VARARGS}, {"alignAxisToVect",(PyCFunction) KX_GameObject::sPyAlignAxisToVect, METH_VARARGS}, {"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_VARARGS}, {"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_VARARGS}, @@ -823,6 +824,7 @@ PyMethodDef KX_GameObject::Methods[] = { {"removeParent", (PyCFunction)KX_GameObject::sPyRemoveParent,METH_VARARGS}, {"getMesh", (PyCFunction)KX_GameObject::sPyGetMesh,METH_VARARGS}, {"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_VARARGS}, + {"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_VARARGS}, KX_PYMETHODTABLE(KX_GameObject, getDistanceTo), KX_PYMETHODTABLE(KX_GameObject, rayCastTo), KX_PYMETHODTABLE(KX_GameObject, rayCast), @@ -1095,6 +1097,12 @@ PyObject* KX_GameObject::PySetVisible(PyObject* self, } +PyObject* KX_GameObject::PyGetVisible(PyObject* self, + PyObject* args, + PyObject* kwds) +{ + return PyInt_FromLong(m_bVisible); +} PyObject* KX_GameObject::PyGetVelocity(PyObject* self, @@ -1383,6 +1391,13 @@ PyObject* KX_GameObject::PyGetPhysicsId(PyObject* self, return PyInt_FromLong((long)physid); } +PyObject* KX_GameObject::PyGetPropertyNames(PyObject* self, + PyObject* args, + PyObject* kwds) +{ + return ConvertKeysToPython(); +} + KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo, "getDistanceTo(other): get distance to another point/KX_GameObject") { diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index a0507cb9dbc..796cb4a161f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -718,6 +718,7 @@ public: KX_PYMETHOD(KX_GameObject,GetReactionForce); KX_PYMETHOD(KX_GameObject,GetOrientation); KX_PYMETHOD(KX_GameObject,SetOrientation); + KX_PYMETHOD(KX_GameObject,GetVisible); KX_PYMETHOD(KX_GameObject,SetVisible); KX_PYMETHOD(KX_GameObject,AlignAxisToVect); KX_PYMETHOD(KX_GameObject,SuspendDynamics); @@ -731,9 +732,11 @@ public: KX_PYMETHOD(KX_GameObject,SetParent); KX_PYMETHOD(KX_GameObject,RemoveParent); KX_PYMETHOD(KX_GameObject,GetPhysicsId); + KX_PYMETHOD(KX_GameObject,GetPropertyNames); KX_PYMETHOD_DOC(KX_GameObject,rayCastTo); KX_PYMETHOD_DOC(KX_GameObject,rayCast); KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo); + private : /** |