Blender Git Commit Log

Git Commits -> Revision bce3f7e

Revision bce3f7e by Campbell Barton (master)
June 22, 2009, 04:26 (GMT)
PyAPI Mathutils Vector callbacks, referencing other PyObjects rather then thin wrapping vectors which is crash prone.

in short, vectors can work as if they are thin wrapped but not crash blender if the original data is removed.

* RNA vector's return Mathutils vector types.
* BGE vectors for GameObject's localPosition, worldPosition, localPosition, localScale, worldScale, localInertia.
* Comment USE_MATHUTILS define to disable returning vectors.

Example...

* 2.49... *
loc = gameOb.worldPosition
loc[1] = 0
gameOb.worldPosition = loc

* With vectors... *
gameOb.worldPosition[1] = 0


* But this wont crash... *
loc = gameOb.worldPosition
gameOb.endObject()
loc[1] = 0 # will raise an error that the objects removed.

This breaks games which assume return values are lists.

Will add this to eulers, matrix and quaternion types later.

Commit Details:

Full Hash: bce3f7e019c174947a0f98063f39533eb59ab03e
SVN Revision: 21073
Parent Commit: 1efffc1
Lines Changed: +682, -189

13 Modified Paths:

/source/blender/python/generic/geometry.c (+20, -0) (Diff)
/source/blender/python/generic/mathutils.c (+130, -75) (Diff)
/source/blender/python/generic/mathutils.h (+19, -4) (Diff)
/source/blender/python/generic/matrix.c (+41, -1) (Diff)
/source/blender/python/generic/quat.c (+1, -1) (Diff)
/source/blender/python/generic/vector.c (+220, -101) (Diff)
/source/blender/python/generic/vector.h (+8, -3) (Diff)
/source/blender/python/intern/bpy_rna.c (+78, -1) (Diff)
/source/blender/python/intern/bpy_util.c (+1, -1) (Diff)
/source/gameengine/Expressions/PyObjectPlus.h (+2, -0) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+153, -2) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+4, -0) (Diff)
/source/gameengine/Ketsji/KX_PythonInitTypes.cpp (+5, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021