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.
This commit is contained in:
Campbell Barton
2009-06-22 04:26:48 +00:00
parent 1efffc1f56
commit bce3f7e019
13 changed files with 682 additions and 189 deletions

View File

@@ -41,6 +41,8 @@
#include "MT_Vector3.h"
#include "SG_QList.h"
#define USE_MATHUTILS // Blender 2.5x api will use mathutils, for a while we might want to test without it
/*------------------------------
* Python defines
------------------------------*/