Revision: 20332
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20332
Author:   campbellbarton
Date:     2009-05-22 05:22:56 +0200 (Fri, 22 May 2009)

Log Message:
-----------
- Deprecated Mathutils.CrossVecs(v1,v2) for v1.cross(v2), (same with .DotVecs 
-> v1.dot(v2), for CrossQuats and DotQuats too)
- Grouped Mathutils deprecated functions
- Dont include source code in bpy epydocs

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Mathutils.h
    trunk/blender/source/blender/python/api2_2x/doc/Mathutils.py
    trunk/blender/source/blender/python/api2_2x/doc/epy_docgen.sh
    trunk/blender/source/blender/python/api2_2x/quat.c
    trunk/blender/source/blender/python/api2_2x/quat.h
    trunk/blender/source/blender/python/api2_2x/vector.c
    trunk/blender/source/blender/python/api2_2x/vector.h

Modified: trunk/blender/source/blender/python/api2_2x/Mathutils.h
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Mathutils.h     2009-05-22 
01:16:26 UTC (rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/Mathutils.h     2009-05-22 
03:22:56 UTC (rev 20332)
@@ -45,8 +45,6 @@
 
 PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_Vector(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_MidpointVecs(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_ProjectVecs(PyObject * self, PyObject * args);
@@ -57,8 +55,6 @@
 PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_Quaternion(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_Slerp(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_Euler(PyObject * self, PyObject * args);
@@ -75,6 +71,10 @@
 PyObject *M_Mathutils_RotateEuler(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_MatMultVec(PyObject * self, PyObject * args);
 PyObject *M_Mathutils_VecMultMat(PyObject * self, PyObject * args);
+PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args);
+PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args);
+PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args);
+PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args);
 
 int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
 int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);

Modified: trunk/blender/source/blender/python/api2_2x/doc/Mathutils.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Mathutils.py        
2009-05-22 01:16:26 UTC (rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/doc/Mathutils.py        
2009-05-22 03:22:56 UTC (rev 20332)
@@ -26,6 +26,8 @@
 
   angle = DifferenceQuats(quat1, quat2)
   print angle  
+  
+...@group Deprecated: CopyMat, CopyVec, CopyQuat, CopyEuler, RotateEuler, 
MatMultVec, VecMultMat, CrossVecs, DotVecs, CrossQuats, DotQuats
 """
 
 def Rand (low=0.0, high = 1.0):
@@ -129,6 +131,7 @@
 def CrossVecs(vec1, vec2):
   """
   Return the cross product of two vectors.
+  @attention: B{DEPRECATED} use vector.cross(other) instead.
   @type vec1: Vector object.
   @param vec1: A 3d vector.
   @type vec2: Vector object.
@@ -141,6 +144,7 @@
 def DotVecs(vec1, vec2):
   """
   Return the dot product of two vectors.
+  @attention: B{DEPRECATED} use vector.dot(other) instead.
   @type vec1: Vector object.
   @param vec1: A 2d,3d or 4d vector.
   @type vec2: Vector object.
@@ -323,6 +327,7 @@
 def CrossQuats(quat1, quat2):
   """
   Return the cross product of two quaternions.
+  @attention: B{DEPRECATED} use quat.cross(other) instead.
   @type quat1: Quaternion object.
   @param quat1: Quaternion.
   @type quat2: Quaternion object.
@@ -335,6 +340,7 @@
 def DotQuats(quat1, quat2):
   """
   Return the dot product of two quaternions.
+  @attention: B{DEPRECATED} use quat.dot(other) instead.
   @type quat1: Quaternion object.
   @param quat1: Quaternion.
   @type quat2: Quaternion object.
@@ -541,6 +547,26 @@
     @return: The reflected vector.
     """
 
+  def cross(other):
+    """
+    Return the cross product of this vector and another.
+    @note: both vectors must be 3D.
+    @type other: Vector object
+    @param other: The other vector to perform the cross product with.
+    @rtype: Vector
+    @return: The cross product.
+    """
+
+  def dot(other):
+    """
+    Return the dot product of this vector and another.
+    @note: both vectors must be the same size.
+    @type other: Vector object
+    @param other: The other vector to perform the dot product with.
+    @rtype: float
+    @return: The dot product.
+    """
+
 class Euler:
   """
   The Euler object
@@ -740,6 +766,24 @@
     @return: A 3x3 rotation matrix representation of the quaternion.
     """
 
+  def cross(other):
+    """
+    Return the cross product of this quaternion and another.
+    @type other: Quaterion object
+    @param other: The other quaternion to perform the cross product with.
+    @rtype: Vector
+    @return: The cross product.
+    """
+
+  def dot(other):
+    """
+    Return the dot product of this quaternion and another.
+    @type other: Quaterion object
+    @param other: The other quaternion to perform the dot product with.
+    @rtype: float
+    @return: The dot product.
+    """
+
 class Matrix:
   """
   The Matrix Object

Modified: trunk/blender/source/blender/python/api2_2x/doc/epy_docgen.sh
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/epy_docgen.sh       
2009-05-22 01:16:26 UTC (rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/doc/epy_docgen.sh       
2009-05-22 03:22:56 UTC (rev 20332)
@@ -8,4 +8,4 @@
 LC_ALL=POSIX
 
 epydoc --debug -v  -o BPY_API --url "http://www.blender.org"; --top API_intro \
- --name "Blender" --no-private --no-frames [A-Z]*.py 
+ --name "Blender" --no-private --no-sourcecode [A-Z]*.py 

Modified: trunk/blender/source/blender/python/api2_2x/quat.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/quat.c  2009-05-22 01:16:26 UTC 
(rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/quat.c  2009-05-22 03:22:56 UTC 
(rev 20332)
@@ -41,6 +41,8 @@
 char Quaternion_Normalize_doc[] = "() - normalize the vector portion of the 
quaternion";
 char Quaternion_ToEuler_doc[] = "(eul_compat) - return a euler rotation 
representing the quaternion, optional euler argument that the new euler will be 
made compatible with.";
 char Quaternion_ToMatrix_doc[] = "() - return a rotation matrix representing 
the quaternion";
+char Quaternion_Cross_doc[] = "(other) - return the cross product between this 
quaternion and another";
+char Quaternion_Dot_doc[] = "(other) - return the dot product between this 
quaternion and another";
 char Quaternion_copy_doc[] = "() - return a copy of the quat";
 //-----------------------METHOD DEFINITIONS ----------------------
 struct PyMethodDef Quaternion_methods[] = {
@@ -51,6 +53,8 @@
        {"normalize", (PyCFunction) Quaternion_Normalize, METH_NOARGS, 
Quaternion_Normalize_doc},
        {"toEuler", (PyCFunction) Quaternion_ToEuler, METH_VARARGS, 
Quaternion_ToEuler_doc},
        {"toMatrix", (PyCFunction) Quaternion_ToMatrix, METH_NOARGS, 
Quaternion_ToMatrix_doc},
+       {"cross", (PyCFunction) Quaternion_Cross, METH_O, Quaternion_Cross_doc},
+       {"dot", (PyCFunction) Quaternion_Dot, METH_O, Quaternion_Dot_doc},
        {"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, 
Quaternion_copy_doc},
        {"copy", (PyCFunction) Quaternion_copy, METH_NOARGS, 
Quaternion_copy_doc},
        {NULL, NULL, 0, NULL}
@@ -96,6 +100,40 @@
 
        return newMatrixObject(mat, 3, 3, Py_NEW);
 }
+
+//----------------------------Quaternion.cross(other)------------------
+//return the cross quat
+PyObject *Quaternion_Cross(QuaternionObject * self, QuaternionObject * value)
+{
+       float quat[4];
+       
+       if (!QuaternionObject_Check(value)) {
+               PyErr_SetString( PyExc_TypeError, "quat.cross(value): expected 
a quaternion argument" );
+               return NULL;
+       }
+       
+       QuatMul(quat, self->quat, value->quat);
+       return newQuaternionObject(quat, Py_NEW);
+}
+
+//----------------------------Quaternion.dot(other)------------------
+//return the dot quat
+PyObject *Quaternion_Dot(QuaternionObject * self, QuaternionObject * value)
+{
+       int x;
+       double dot = 0.0;
+       
+       if (!QuaternionObject_Check(value)) {
+               PyErr_SetString( PyExc_TypeError, "quat.dot(value): expected a 
quaternion argument" );
+               return NULL;
+       }
+       
+       for(x = 0; x < 4; x++) {
+               dot += self->quat[x] * value->quat[x];
+       }
+       return PyFloat_FromDouble(dot);
+}
+
 //----------------------------Quaternion.normalize()----------------
 //normalize the axis of rotation of [theta,vector]
 PyObject *Quaternion_Normalize(QuaternionObject * self)

Modified: trunk/blender/source/blender/python/api2_2x/quat.h
===================================================================
--- trunk/blender/source/blender/python/api2_2x/quat.h  2009-05-22 01:16:26 UTC 
(rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/quat.h  2009-05-22 03:22:56 UTC 
(rev 20332)
@@ -64,6 +64,8 @@
 PyObject *Quaternion_Normalize( QuaternionObject * self );
 PyObject *Quaternion_ToEuler( QuaternionObject * self, PyObject *args );
 PyObject *Quaternion_ToMatrix( QuaternionObject * self );
+PyObject *Quaternion_Cross( QuaternionObject * self, QuaternionObject * value 
);
+PyObject *Quaternion_Dot( QuaternionObject * self, QuaternionObject * value );
 PyObject *Quaternion_copy( QuaternionObject * self );
 PyObject *newQuaternionObject( float *quat, int type );
 

Modified: trunk/blender/source/blender/python/api2_2x/vector.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/vector.c        2009-05-22 
01:16:26 UTC (rev 20331)
+++ trunk/blender/source/blender/python/api2_2x/vector.c        2009-05-22 
03:22:56 UTC (rev 20332)
@@ -47,7 +47,9 @@
 char Vector_Resize3D_doc[] = "() - resize a vector to [x,y,z]";
 char Vector_Resize4D_doc[] = "() - resize a vector to [x,y,z,w]";
 char Vector_ToTrackQuat_doc[] = "(track, up) - extract a quaternion from the 
vector and the track and up axis";
-char Vector_reflect_doc[] = "(mirror) - return a vector reflected on the 
mirror normal";
+char Vector_Reflect_doc[] = "(mirror) - return a vector reflected on the 
mirror normal";
+char Vector_Cross_doc[] = "(other) - return the cross product between this 
vector and another";
+char Vector_Dot_doc[] = "(other) - return the dot product between this vector 
and another";
 char Vector_copy_doc[] = "() - return a copy of the vector";
 char Vector_swizzle_doc[] = "Swizzle: Get or set axes in specified order";
 /*-----------------------METHOD DEFINITIONS ----------------------*/
@@ -59,7 +61,9 @@

@@ 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