[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20220] trunk/blender/source/gameengine: BGE Py API Bugfixes

Campbell Barton ideasman42 at gmail.com
Sat May 16 02:49:28 CEST 2009


Revision: 20220
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20220
Author:   campbellbarton
Date:     2009-05-16 02:49:28 +0200 (Sat, 16 May 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
    trunk/blender/source/gameengine/PyDoc/GameTypes.py

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-05-15 21:27:13 UTC (rev 20219)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-05-16 00:49:28 UTC (rev 20220)
@@ -2051,14 +2051,8 @@
 	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)
 	{

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInitTypes.cpp	2009-05-15 21:27:13 UTC (rev 20219)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInitTypes.cpp	2009-05-16 00:49:28 UTC (rev 20220)
@@ -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 @@
 	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

Modified: trunk/blender/source/gameengine/PyDoc/GameTypes.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/GameTypes.py	2009-05-15 21:27:13 UTC (rev 20219)
+++ trunk/blender/source/gameengine/PyDoc/GameTypes.py	2009-05-16 00:49:28 UTC (rev 20220)
@@ -5544,7 +5544,7 @@
 """
 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 a in attrs:
 	print a
-"""
\ No newline at end of file
+"""





More information about the Bf-blender-cvs mailing list