diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-16 04:49:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-16 04:49:28 +0400 |
commit | 006ad4aaacc36a7e7fd1a8cd96e60a5e74cbfedd (patch) | |
tree | 929a9d1452a4901986c38f37c7e03774f591c7ca /source/gameengine | |
parent | 83006e51f845b2c5c36539373e036be3efaddc16 (diff) |
BGE Py API Bugfixes
KX_GameObject.getVelocity() would set an error but nor return an error value when an non vector argument was given.
KX_PythonSeq_Type was not initialized with PyType_Ready which could crash blender when inspecting the type.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/PyDoc/GameTypes.py | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 9196d1e0527..ae30aeb971c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -2051,14 +2051,8 @@ PyObject* KX_GameObject::PyGetVelocity(PyObject* args) MT_Point3 point(0.0,0.0,0.0); PyObject* pypos = NULL; - if (PyArg_ParseTuple(args, "|O:getVelocity", &pypos)) - { - if (pypos) - PyVecTo(pypos, point); - } - else { + if (!PyArg_ParseTuple(args, "|O:getVelocity", &pypos) || (pypos && !PyVecTo(pypos, point))) return NULL; - } if (m_pPhysicsController1) { diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index cd21663f41d..83c4dcbb34c 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -51,6 +51,7 @@ #include "KX_PhysicsObjectWrapper.h" #include "KX_PolyProxy.h" #include "KX_PolygonMaterial.h" +#include "KX_PythonSeq.h" #include "KX_SCA_AddObjectActuator.h" #include "KX_SCA_EndObjectActuator.h" #include "KX_SCA_ReplaceMeshActuator.h" @@ -227,6 +228,9 @@ void initPyTypes(void) PyType_Ready_Attr(dict, SCA_XNORController); PyType_Ready_Attr(dict, SCA_XORController); PyType_Ready_Attr(dict, SCA_IController); + + /* Normal python type */ + PyType_Ready(&KX_PythonSeq_Type); } #endif
\ No newline at end of file diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index d58f9087a9f..b5b0839c0f4 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -5544,7 +5544,7 @@ class KX_Camera(KX_GameObject): """ import types attrs = [] -for name, val in __builtins__.locals().items(): +for name, val in locals().items(): if name.startswith('__'): continue if type(val) == types.ClassType: @@ -5554,4 +5554,4 @@ for name, val in __builtins__.locals().items(): for a in attrs: print a -"""
\ No newline at end of file +""" |