diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-23 17:34:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-23 17:34:45 +0400 |
commit | eb22a7b2102cceb432e3545cd342956e92873a49 (patch) | |
tree | c87ad1de81cc216403568b44f289ff9af3a2ae9e /intern | |
parent | bf74f105bc5ec98980fa087347203244750fb669 (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 'intern')
-rw-r--r-- | intern/moto/include/MT_Matrix3x3.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h index 899a2731588..c6d299d19fd 100644 --- a/intern/moto/include/MT_Matrix3x3.h +++ b/intern/moto/include/MT_Matrix3x3.h @@ -98,6 +98,18 @@ public: m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m; } + void setValue3x3(const float *m) { + m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; + m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; + m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m; + } + + void setValue3x3(const double *m) { + m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; + m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; + m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m; + } + void setValue(MT_Scalar xx, MT_Scalar xy, MT_Scalar xz, MT_Scalar yx, MT_Scalar yy, MT_Scalar yz, MT_Scalar zx, MT_Scalar zy, MT_Scalar zz) { @@ -194,6 +206,18 @@ public: *m++ = m_el[0][2]; *m++ = m_el[1][2]; *m++ = m_el[2][2]; *m = 0.0; } + void getValue3x3(float *m) const { + *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; + *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; + *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; + } + + void getValue3x3(double *m) const { + *m++ = m_el[0][0]; *m++ = m_el[1][0]; *m++ = m_el[2][0]; + *m++ = m_el[0][1]; *m++ = m_el[1][1]; *m++ = m_el[2][1]; + *m++ = m_el[0][2]; *m++ = m_el[1][2]; *m++ = m_el[2][2]; + } + MT_Quaternion getRotation() const; MT_Matrix3x3& operator*=(const MT_Matrix3x3& m); |