Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-23 17:34:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-23 17:34:45 +0400
commiteb22a7b2102cceb432e3545cd342956e92873a49 (patch)
treec87ad1de81cc216403568b44f289ff9af3a2ae9e /source/blender/python/generic/matrix.h
parentbf74f105bc5ec98980fa087347203244750fb669 (diff)
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.
Diffstat (limited to 'source/blender/python/generic/matrix.h')
-rw-r--r--source/blender/python/generic/matrix.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/python/generic/matrix.h b/source/blender/python/generic/matrix.h
index 2604d58d0d1..cc3928f1632 100644
--- a/source/blender/python/generic/matrix.h
+++ b/source/blender/python/generic/matrix.h
@@ -39,15 +39,14 @@ extern PyTypeObject matrix_Type;
typedef float **ptRow;
typedef struct _Matrix {
PyObject_VAR_HEAD
- struct{
- float *py_data; /*python managed*/
- float *blend_data; /*blender managed*/
- }data;
- ptRow matrix; /*ptr to the contigPtr (accessor)*/
- float *contigPtr; /*1D array of data (alias)*/
- int rowSize;
- int colSize;
- int wrapped; /*is wrapped data?*/
+ ptRow matrix; /*ptr to the contigPtr (accessor)*/
+ float* contigPtr; /*1D array of data (alias)*/
+ PyObject* cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
+ unsigned char rowSize;
+ unsigned char colSize;
+ unsigned char wrapped; /*is wrapped data?*/
+ unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
+ unsigned int cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
} MatrixObject;
/*struct data contains a pointer to the actual data that the
@@ -57,5 +56,9 @@ blender (stored in blend_data). This is an either/or struct not both*/
/*prototypes*/
PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type);
+PyObject *newMatrixObject_cb(PyObject *user, int rowSize, int colSize, int cb_type, int cb_subtype);
+
+extern int mathutils_matrix_vector_cb_index;
+extern struct Mathutils_Callback mathutils_matrix_vector_cb;
#endif /* EXPP_matrix_H */