Revision: 20998
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20998
Author:   campbellbarton
Date:     2009-06-19 01:12:29 +0200 (Fri, 19 Jun 2009)

Log Message:
-----------
Update Mathutils for py3k
* removed coercing types which has been removed from py3.
* matrix uses getset's rather then getset items.
* removed deprecated functions.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/python/generic/Mathutils.c
    branches/blender2.5/blender/source/blender/python/generic/Mathutils.h
    branches/blender2.5/blender/source/blender/python/generic/matrix.c
    branches/blender2.5/blender/source/blender/python/generic/matrix.h
    branches/blender2.5/blender/source/blender/python/generic/quat.c
    branches/blender2.5/blender/source/blender/python/generic/quat.h
    branches/blender2.5/blender/source/blender/python/generic/vector.c

Modified: branches/blender2.5/blender/source/blender/python/generic/Mathutils.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/generic/Mathutils.c       
2009-06-18 21:25:21 UTC (rev 20997)
+++ branches/blender2.5/blender/source/blender/python/generic/Mathutils.c       
2009-06-18 23:12:29 UTC (rev 20998)
@@ -41,27 +41,16 @@
 static char M_Mathutils_Quaternion_doc[] = "() - create a quaternion from a 
list or an axis of rotation and an angle";
 static char M_Mathutils_Euler_doc[] = "() - create and return a new euler 
object";
 static char M_Mathutils_Rand_doc[] = "() - return a random number";
-static char M_Mathutils_CrossVecs_doc[] = "() - returns a vector perpedicular 
to the 2 vectors crossed";
-static char M_Mathutils_CopyVec_doc[] = "() - create a copy of vector";
-static char M_Mathutils_DotVecs_doc[] = "() - return the dot product of two 
vectors";
 static char M_Mathutils_AngleBetweenVecs_doc[] = "() - returns the angle 
between two vectors in degrees";
 static char M_Mathutils_MidpointVecs_doc[] = "() - return the vector to the 
midpoint between two vectors";
-static char M_Mathutils_MatMultVec_doc[] = "() - multiplies a matrix by a 
column vector";
-static char M_Mathutils_VecMultMat_doc[] = "() - multiplies a row vector by a 
matrix";
 static char M_Mathutils_ProjectVecs_doc[] =    "() - returns the projection 
vector from the projection of vecA onto vecB";
 static char M_Mathutils_RotationMatrix_doc[] = "() - construct a rotation 
matrix from an angle and axis of rotation";
 static char M_Mathutils_ScaleMatrix_doc[] =    "() - construct a scaling 
matrix from a scaling factor";
 static char M_Mathutils_OrthoProjectionMatrix_doc[] = "() - construct a 
orthographic projection matrix from a selected plane";
 static char M_Mathutils_ShearMatrix_doc[] = "() - construct a shearing matrix 
from a plane of shear and a shear factor";
-static char M_Mathutils_CopyMat_doc[] = "() - create a copy of a matrix";
 static char M_Mathutils_TranslationMatrix_doc[] = "(vec) - create a 
translation matrix from a vector";
-static char M_Mathutils_CopyQuat_doc[] = "() - copy quatB to quatA";
-static char M_Mathutils_CopyEuler_doc[] = "() - copy eulB to eultA";
-static char M_Mathutils_CrossQuats_doc[] = "() - return the mutliplication of 
two quaternions";
-static char M_Mathutils_DotQuats_doc[] = "() - return the dot product of two 
quaternions";
 static char M_Mathutils_Slerp_doc[] = "() - returns the interpolation between 
two quaternions";
 static char M_Mathutils_DifferenceQuats_doc[] = "() - return the angular 
displacment difference between two quats";
-static char M_Mathutils_RotateEuler_doc[] = "() - rotate euler by an axis and 
angle";
 static char M_Mathutils_Intersect_doc[] = "(v1, v2, v3, ray, orig, clip=1) - 
returns the intersection between a ray and a triangle, if possible, returns 
None otherwise";
 static char M_Mathutils_TriangleArea_doc[] = "(v1, v2, v3) - returns the area 
size of the 2D or 3D triangle defined";
 static char M_Mathutils_TriangleNormal_doc[] = "(v1, v2, v3) - returns the 
normal of the 3D triangle defined";
@@ -71,30 +60,19 @@
 struct PyMethodDef M_Mathutils_methods[] = {
        {"Rand", (PyCFunction) M_Mathutils_Rand, METH_VARARGS, 
M_Mathutils_Rand_doc},
        {"Vector", (PyCFunction) M_Mathutils_Vector, METH_VARARGS, 
M_Mathutils_Vector_doc},
-       {"CrossVecs", (PyCFunction) M_Mathutils_CrossVecs, METH_VARARGS, 
M_Mathutils_CrossVecs_doc},
-       {"DotVecs", (PyCFunction) M_Mathutils_DotVecs, METH_VARARGS, 
M_Mathutils_DotVecs_doc},
        {"AngleBetweenVecs", (PyCFunction) M_Mathutils_AngleBetweenVecs, 
METH_VARARGS, M_Mathutils_AngleBetweenVecs_doc},
        {"MidpointVecs", (PyCFunction) M_Mathutils_MidpointVecs, METH_VARARGS, 
M_Mathutils_MidpointVecs_doc},
-       {"VecMultMat", (PyCFunction) M_Mathutils_VecMultMat, METH_VARARGS, 
M_Mathutils_VecMultMat_doc},
        {"ProjectVecs", (PyCFunction) M_Mathutils_ProjectVecs, METH_VARARGS, 
M_Mathutils_ProjectVecs_doc},
-       {"CopyVec", (PyCFunction) M_Mathutils_CopyVec, METH_VARARGS, 
M_Mathutils_CopyVec_doc},
        {"Matrix", (PyCFunction) M_Mathutils_Matrix, METH_VARARGS, 
M_Mathutils_Matrix_doc},
        {"RotationMatrix", (PyCFunction) M_Mathutils_RotationMatrix, 
METH_VARARGS, M_Mathutils_RotationMatrix_doc},
        {"ScaleMatrix", (PyCFunction) M_Mathutils_ScaleMatrix, METH_VARARGS, 
M_Mathutils_ScaleMatrix_doc},
        {"ShearMatrix", (PyCFunction) M_Mathutils_ShearMatrix, METH_VARARGS, 
M_Mathutils_ShearMatrix_doc},
        {"TranslationMatrix", (PyCFunction) M_Mathutils_TranslationMatrix, 
METH_O, M_Mathutils_TranslationMatrix_doc},
-       {"CopyMat", (PyCFunction) M_Mathutils_CopyMat, METH_VARARGS, 
M_Mathutils_CopyMat_doc},
        {"OrthoProjectionMatrix", (PyCFunction) 
M_Mathutils_OrthoProjectionMatrix,  METH_VARARGS, 
M_Mathutils_OrthoProjectionMatrix_doc},
-       {"MatMultVec", (PyCFunction) M_Mathutils_MatMultVec, METH_VARARGS, 
M_Mathutils_MatMultVec_doc},
        {"Quaternion", (PyCFunction) M_Mathutils_Quaternion, METH_VARARGS, 
M_Mathutils_Quaternion_doc},
-       {"CopyQuat", (PyCFunction) M_Mathutils_CopyQuat, METH_VARARGS, 
M_Mathutils_CopyQuat_doc},
-       {"CrossQuats", (PyCFunction) M_Mathutils_CrossQuats, METH_VARARGS, 
M_Mathutils_CrossQuats_doc},
-       {"DotQuats", (PyCFunction) M_Mathutils_DotQuats, METH_VARARGS, 
M_Mathutils_DotQuats_doc},
        {"DifferenceQuats", (PyCFunction) M_Mathutils_DifferenceQuats, 
METH_VARARGS,M_Mathutils_DifferenceQuats_doc},
        {"Slerp", (PyCFunction) M_Mathutils_Slerp, METH_VARARGS, 
M_Mathutils_Slerp_doc},
        {"Euler", (PyCFunction) M_Mathutils_Euler, METH_VARARGS, 
M_Mathutils_Euler_doc},
-       {"CopyEuler", (PyCFunction) M_Mathutils_CopyEuler, METH_VARARGS, 
M_Mathutils_CopyEuler_doc},
-       {"RotateEuler", (PyCFunction) M_Mathutils_RotateEuler, METH_VARARGS, 
M_Mathutils_RotateEuler_doc},
        {"Intersect", ( PyCFunction ) M_Mathutils_Intersect, METH_VARARGS, 
M_Mathutils_Intersect_doc},
        {"TriangleArea", ( PyCFunction ) M_Mathutils_TriangleArea, 
METH_VARARGS, M_Mathutils_TriangleArea_doc},
        {"TriangleNormal", ( PyCFunction ) M_Mathutils_TriangleNormal, 
METH_VARARGS, M_Mathutils_TriangleNormal_doc},
@@ -356,49 +334,6 @@
        Py_DECREF(listObject);
        return newVectorObject(vec, size, Py_NEW);
 }
-//----------------------------------Mathutils.CrossVecs() ---------------
-//finds perpendicular vector - only 3D is supported
-PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args)
-{
-       PyObject *vecCross = NULL;
-       VectorObject *vec1 = NULL, *vec2 = NULL;
-
-       if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, 
&vec2)) {
-               PyErr_SetString(PyExc_TypeError, "Mathutils.CrossVecs(): 
expects (2) 3D vector objects\n");
-               return NULL;
-       }
-       
-       if(vec1->size != 3 || vec2->size != 3) {
-               PyErr_SetString(PyExc_AttributeError, "Mathutils.CrossVecs(): 
expects (2) 3D vector objects\n");
-               return NULL;
-       }
-       vecCross = newVectorObject(NULL, 3, Py_NEW);
-       Crossf(((VectorObject*)vecCross)->vec, vec1->vec, vec2->vec);
-       return vecCross;
-}
-//----------------------------------Mathutils.DotVec() -------------------
-//calculates the dot product of two vectors
-PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args)
-{
-       VectorObject *vec1 = NULL, *vec2 = NULL;
-       double dot = 0.0f;
-       int x;
-
-       if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, 
&vec2)) {
-               PyErr_SetString(PyExc_TypeError, "Mathutils.DotVecs(): expects 
(2) vector objects of the same size\n");
-               return NULL;
-       }
-       
-       if(vec1->size != vec2->size) {
-               PyErr_SetString(PyExc_AttributeError, "Mathutils.DotVecs(): 
expects (2) vector objects of the same size\n");
-               return NULL;
-       }
-
-       for(x = 0; x < vec1->size; x++) {
-               dot += vec1->vec[x] * vec2->vec[x];
-       }
-       return PyFloat_FromDouble(dot);
-}
 //----------------------------------Mathutils.AngleBetweenVecs() ---------
 //calculates the angle between 2 vectors
 PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args)
@@ -1100,39 +1035,7 @@
        Py_DECREF(listObject);
        return newQuaternionObject(quat, Py_NEW);
 }
-//----------------------------------Mathutils.CrossQuats() ----------------
-//quaternion multiplication - associate not commutative
-PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args)
-{
-       QuaternionObject *quatU = NULL, *quatV = NULL;
-       float quat[4];
 
-       if(!PyArg_ParseTuple(args, "O!O!", &quaternion_Type, &quatU, 
&quaternion_Type, &quatV)) {
-               PyErr_SetString(PyExc_TypeError,"Mathutils.CrossQuats(): 
expected Quaternion types");
-               return NULL;
-       }
-       QuatMul(quat, quatU->quat, quatV->quat);
-
-       return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------------Mathutils.DotQuats() ----------------
-//returns the dot product of 2 quaternions
-PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args)
-{
-       QuaternionObject *quatU = NULL, *quatV = NULL;
-       double dot = 0.0f;
-       int x;
-
-       if(!PyArg_ParseTuple(args, "O!O!", &quaternion_Type, &quatU, 
&quaternion_Type, &quatV)) {
-               PyErr_SetString(PyExc_TypeError, "Mathutils.DotQuats(): 
expected Quaternion types");
-               return NULL;
-       }
-
-       for(x = 0; x < 4; x++) {
-               dot += quatU->quat[x] * quatV->quat[x];
-       }
-       return PyFloat_FromDouble(dot);
-}
 //----------------------------------Mathutils.DifferenceQuats() ---------
 //returns the difference between 2 quaternions
 PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args)
@@ -1533,146 +1436,7 @@
                return NULL;
        }
 }
-//#############################DEPRECATED################################
-//#######################################################################
-//----------------------------------Mathutils.CopyMat() -----------------
-//copies a matrix into a new matrix
-PyObject *M_Mathutils_CopyMat(PyObject * self, PyObject * args)
-{
-       PyObject *matrix = NULL;
-       static char warning = 1;
 
-       if( warning ) {
-               printf("Mathutils.CopyMat(): deprecated :use Mathutils.Matrix() 
to copy matrices\n");
-               --warning;
-       }
-
-       matrix = M_Mathutils_Matrix(self, args);
-       if(matrix == NULL)
-               return NULL; //error string already set if we get here
-       else
-               return matrix;
-}
-//----------------------------------Mathutils.CopyVec() -----------------
-//makes a new vector that is a copy of the input
-PyObject *M_Mathutils_CopyVec(PyObject * self, PyObject * args)
-{
-       PyObject *vec = NULL;
-       static char warning = 1;
-
-       if( warning ) {
-               printf("Mathutils.CopyVec(): Deprecated: use Mathutils.Vector() 
to copy vectors\n");
-               --warning;
-       }
-
-       vec = M_Mathutils_Vector(self, args);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to