PyRNA API support for matrix types as Mathutils matrix (with callbacks) rather then a generic rna sequence of floats.

Any 3x3 or 4x4 rna matrix will automatically be returned as a Mathutils matrix.
This makes useful stuff like multiplying a vector location by an object matrix possible.
 ob = bpy.data.scenes[0].objects[0]
 print (ob.data.verts[0].co * ob.matrix)

Also added mathutils matrix types to the BGE GameObject.localOrientation, worldOrientation

* MT_Matrix3x3 added getValue3x3 and setValue3x3, assumed a 4x3 float array.
* KX_GameObject.cpp convenience functions NodeSetGlobalOrientation, NodeGetLocalOrientation, NodeGetLocalScaling, NodeGetLocalPosition.
* 2.5 python api now initializes modules BGL, Mathutils and Geometry
* modules py3 PyModuleDef's use PyModuleDef_HEAD_INIT, rather then {}, was making msvc fail to build.
* added macros for Vector_ReadCallback, Vector_WriteCallback etc. to check if the callback pointer is set before calling the function.
This commit is contained in:
2009-06-23 13:34:45 +00:00
parent bf74f105bc
commit eb22a7b210
14 changed files with 534 additions and 172 deletions

View File

@@ -40,11 +40,11 @@ extern PyTypeObject vector_Type;
typedef struct {
PyObject_VAR_HEAD
float *vec; /*1D array of data (alias), wrapped status depends on wrapped status */
PyObject *user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
PyObject *cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
unsigned char size; /* vec size 2,3 or 4 */
unsigned char wrapped; /* wrapped data type? */
unsigned char callback_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
unsigned char subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
unsigned char cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
} VectorObject;