[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26352] trunk/blender: * Mathutils attributes documented - http://www.blender.org/documentation/ 250PythonDoc/Mathutils.html

Campbell Barton ideasman42 at gmail.com
Wed Jan 27 22:33:40 CET 2010


Revision: 26352
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26352
Author:   campbellbarton
Date:     2010-01-27 22:33:39 +0100 (Wed, 27 Jan 2010)

Log Message:
-----------
* Mathutils attributes documented - http://www.blender.org/documentation/250PythonDoc/Mathutils.html
* Vector.difference() needed normalized vectors
* bpy.DEUBG -> bpy.app.debug

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/__init__.py
    trunk/blender/release/scripts/modules/bpy/app.py
    trunk/blender/source/blender/blenlib/intern/math_rotation.c
    trunk/blender/source/blender/python/doc/epy/Mathutils.py
    trunk/blender/source/blender/python/generic/Mathutils.c
    trunk/blender/source/blender/python/generic/Mathutils.h
    trunk/blender/source/blender/python/generic/euler.c
    trunk/blender/source/blender/python/generic/matrix.c
    trunk/blender/source/blender/python/generic/quat.c
    trunk/blender/source/blender/python/generic/vector.c
    trunk/blender/source/blender/python/sphinx_doc_gen.py

Modified: trunk/blender/release/scripts/modules/bpy/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/__init__.py	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/release/scripts/modules/bpy/__init__.py	2010-01-27 21:33:39 UTC (rev 26352)
@@ -35,9 +35,7 @@
 ops = _ops_module.ops_fake_module
 
 import sys as _sys
-DEBUG = ("-d" in _sys.argv)
 
-
 def load_scripts(reload_scripts=False):
     import os
     import traceback
@@ -58,7 +56,7 @@
         try:
             t = time.time()
             ret = __import__(module_name)
-            if DEBUG:
+            if app.debug:
                 print("time %s %.4f" % (module_name, time.time() - t))
             return ret
         except:
@@ -104,7 +102,7 @@
                         print("Reloading:", mod)
                         test_reload(mod)
 
-    if DEBUG:
+    if app.debug:
         print("Time %.4f" % (time.time() - t_main))
 
 

Modified: trunk/blender/release/scripts/modules/bpy/app.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/app.py	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/release/scripts/modules/bpy/app.py	2010-01-27 21:33:39 UTC (rev 26352)
@@ -38,10 +38,16 @@
 
    The location of blenders executable, useful for utilities that spawn new instances.
 
+.. data:: debug
+
+   Boolean, set when blender is running in debug mode (started with -d)
+
 """
 # constants
 import _bpy
+import sys as _sys
 version = _bpy._VERSION
 version_string = _bpy._VERSION_STR
 home = _bpy._HOME
 binary_path = _bpy._BINPATH
+debug = ("-d" in _sys.argv)

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-01-27 21:33:39 UTC (rev 26352)
@@ -327,6 +327,7 @@
 	}
 }
 
+/* note: expects vectors to be normalized */
 void rotation_between_vecs_to_quat(float *q, const float v1[3], const float v2[3])
 {
 	float axis[3];

Modified: trunk/blender/source/blender/python/doc/epy/Mathutils.py
===================================================================
--- trunk/blender/source/blender/python/doc/epy/Mathutils.py	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/source/blender/python/doc/epy/Mathutils.py	2010-01-27 21:33:39 UTC (rev 26352)
@@ -33,15 +33,6 @@
   """
   The Vector object
   =================
-    This object gives access to Vectors in Blender.
-  @group Axises: x, y, z, w
-  @ivar x: The x value.
-  @ivar y: The y value.
-  @ivar z: The z value (if any).
-  @ivar w: The w value (if any).
-  @ivar length: The magnitude of the vector.
-  @ivar magnitude: This is a synonym for length.
-  @ivar wrapped: Whether or not this item is wrapped data
   @note: Comparison operators can be done on Vector classes:
       - >, >=, <, <= test the vector magnitude
       - ==, != test vector values e.g. 1,2,3 != 1,2,4 even if they are the same length
@@ -106,11 +97,6 @@
   The Euler object
   ================
     This object gives access to Eulers in Blender.
-  @group Axises: x, y, z
-  @ivar x: The heading value in degrees.
-  @ivar y: The pitch value in degrees.
-  @ivar z: The roll value in degrees.
-  @ivar wrapped: Whether or not this object is wrapping data directly
   @note: You can access a euler object like a sequence
       - x = euler[0]
   @note: Comparison operators can be done:
@@ -152,16 +138,6 @@
   The Quaternion object
   =====================
     This object gives access to Quaternions in Blender.
-  @group Axises: x, y, z, w
-  @ivar w: The w value.
-  @ivar x: The x value.
-  @ivar y: The y value.
-  @ivar z: The z value.
-  @ivar wrapped: Wether or not this object wraps data directly
-  @ivar magnitude: The magnitude of the quaternion.
-  @ivar axis: Vector representing the axis of rotation.
-  @ivar angle: A scalar representing the amount of rotation
-  in degrees.
   @note: Comparison operators can be done:
       - ==, != test numeric values within epsilon
   @note: Math can be performed on Quaternion classes
@@ -215,10 +191,6 @@
   """
   The Matrix Object
   =================
-    This object gives access to Matrices in Blender.
-  @ivar rowSize: The row size of the matrix.
-  @ivar colSize: The column size of the matrix.
-  @ivar wrapped: Whether or not this object wrapps internal data
   @note: Math can be performed on Matrix classes
       - mat + mat 
       - mat - mat 

Modified: trunk/blender/source/blender/python/generic/Mathutils.c
===================================================================
--- trunk/blender/source/blender/python/generic/Mathutils.c	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/source/blender/python/generic/Mathutils.c	2010-01-27 21:33:39 UTC (rev 26352)
@@ -137,9 +137,9 @@
 "   :arg size: The size of the rotation matrix to construct [2, 4].\n"
 "   :type size: int\n"
 "   :arg axis: a string in ['X', 'Y', 'Z'] or a 3D Vector Object (optional when size is 2).\n"
-"   :type axis: string or vector\n"
+"   :type axis: string or :class:`Vector`\n"
 "   :return: A new rotation matrix.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 
 static PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
 {
@@ -266,9 +266,9 @@
 "   Create a matrix representing a translation.\n"
 "\n"
 "   :arg vector: The translation vector.\n"
-"   :type vector: Vector\n"
+"   :type vector: :class:`Vector`\n"
 "   :return: An identity matrix with a translation.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 
 static PyObject *M_Mathutils_TranslationMatrix(PyObject * self, VectorObject * vec)
 {
@@ -307,9 +307,9 @@
 "   :arg size: The size of the scale matrix to construct [2, 4].\n"
 "   :type size: int\n"
 "   :arg axis: Direction to influence scale. (optional).\n"
-"   :type axis: Vector\n"
+"   :type axis: :class:`Vector`\n"
 "   :return: A new scale matrix.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 
 static PyObject *M_Mathutils_ScaleMatrix(PyObject * self, PyObject * args)
 {
@@ -397,10 +397,10 @@
 "   :type plane: string\n"
 "   :arg size: The size of the projection matrix to construct [2, 4].\n"
 "   :type size: int\n"
-"   :arg axis: Arbitrary perpendicular plane vector.\n"
-"   :type axis: vector (optional)\n"
+"   :arg axis: Arbitrary perpendicular plane vector (optional).\n"
+"   :type axis: :class:`Vector`\n"
 "   :return: A new projection matrix.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 static PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * args)
 {
 	VectorObject *vec = NULL;
@@ -502,7 +502,7 @@
 "   :arg size: The size of the shear matrix to construct [2, 4].\n"
 "   :type size: int\n"
 "   :return: A new shear matrix.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 
 static PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args)
 {
@@ -661,6 +661,7 @@
 }
 
 /* BaseMathObject generic functions for all mathutils types */
+char BaseMathObject_Owner_doc[] = "The item this is wrapping or None  (readonly).";
 PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type )
 {
 	PyObject *ret= self->cb_user ? self->cb_user : Py_None;
@@ -668,6 +669,7 @@
 	return ret;
 }
 
+char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly). **type** boolean";
 PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type )
 {
 	return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);

Modified: trunk/blender/source/blender/python/generic/Mathutils.h
===================================================================
--- trunk/blender/source/blender/python/generic/Mathutils.h	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/source/blender/python/generic/Mathutils.h	2010-01-27 21:33:39 UTC (rev 26352)
@@ -41,6 +41,9 @@
 
 /* Can cast different mathutils types to this, use for generic funcs */
 
+extern char BaseMathObject_Wrapped_doc[];
+extern char BaseMathObject_Owner_doc[];
+
 typedef struct {
 	PyObject_VAR_HEAD
 	float *data;					/*array of data (alias), wrapped status depends on wrapped status */

Modified: trunk/blender/source/blender/python/generic/euler.c
===================================================================
--- trunk/blender/source/blender/python/generic/euler.c	2010-01-27 21:19:39 UTC (rev 26351)
+++ trunk/blender/source/blender/python/generic/euler.c	2010-01-27 21:33:39 UTC (rev 26352)
@@ -92,7 +92,7 @@
 "   Return a quaternion representation of the euler.\n"
 "\n"
 "   :return: Quaternion representation of the euler.\n"
-"   :rtype: Quaternion\n";
+"   :rtype: :class:`Quaternion`\n";
 
 static PyObject *Euler_ToQuat(EulerObject * self)
 {
@@ -124,7 +124,7 @@
 "   Return a matrix representation of the euler.\n"
 "\n"
 "   :return: A 3x3 roation matrix representation of the euler.\n"
-"   :rtype: Matrix\n";
+"   :rtype: :class:`Matrix`\n";
 
 static PyObject *Euler_ToMatrix(EulerObject * self)
 {
@@ -155,8 +155,9 @@
 ".. method:: unique()\n"
 "\n"
 "   Calculate a unique rotation for this euler. Avoids gimble lock.\n"
+"\n"
 "   :return: an instance of itself\n"
-"   :rtype: Euler\n";
+"   :rtype: :class:`Euler`\n";
 
 static PyObject *Euler_Unique(EulerObject * self)
 {
@@ -226,8 +227,9 @@
 ".. method:: zero()\n"
 "\n"
 "   Set all values to zero.\n"
+"\n"
 "   :return: an instance of itself\n"
-"   :rtype: Euler\n";
+"   :rtype: :class:`Euler`\n";
 
 static PyObject *Euler_Zero(EulerObject * self)
 {
@@ -293,9 +295,9 @@
 "   Make this euler compatible with another, so interpolating between them works as intended.\n"
 "\n"
 "   :arg other: make compatible with this rotation.\n"
-"   :type other: Euler\n"
+"   :type other: :class:`Euler`\n"
 "   :return: an instance of itself.\n"
-"   :rtype: Euler\n";
+"   :rtype: :class:`Euler`\n";
 
 static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value)
 {
@@ -343,7 +345,7 @@
 "   Returns a copy of this euler.\n"
 "\n"
 "   :return: A copy of the euler.\n"
-"   :rtype: Euler\n"
+"   :rtype: :class:`Euler`\n"
 "\n"
 "   .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n";
 
@@ -551,7 +553,6 @@
 /*
  * vector axis, vector.x/y/z/w
  */
-	
 static PyObject *Euler_getAxis( EulerObject * self, void *type )
 {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list