[Bf-blender-cvs] [dbb06c5] temp-mathutils-doc: Documentation: updated mathutils documentation
Sybren A. Stüvel
noreply at git.blender.org
Sun Feb 1 16:09:41 CET 2015
Commit: dbb06c5fe587a23ef4f56b859630e3cd1e254ceb
Author: Sybren A. Stüvel
Date: Sun Feb 1 16:06:32 2015 +0100
Branches: temp-mathutils-doc
https://developer.blender.org/rBdbb06c5fe587a23ef4f56b859630e3cd1e254ceb
Documentation: updated mathutils documentation
Added descriptions of the constructors, and improved the module-level doc
to link to the classes.
===================================================================
M source/blender/python/mathutils/mathutils.c
M source/blender/python/mathutils/mathutils_Color.c
M source/blender/python/mathutils/mathutils_Euler.c
M source/blender/python/mathutils/mathutils_Matrix.c
M source/blender/python/mathutils/mathutils_Quaternion.c
M source/blender/python/mathutils/mathutils_Vector.c
===================================================================
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index ecaaae8..ad73d77 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -38,7 +38,11 @@
#endif
PyDoc_STRVAR(M_Mathutils_doc,
-"This module provides access to matrices, eulers, quaternions and vectors."
+"This module provides access to the math classes :class:`Color`,\n"
+":class:`Euler`, :class:`Matrix`, :class:`Quaternion` and :class:`Vector`.\n"
+"\n"
+"Classes and methods that accept Vectors also accept other numeric sequences,\n"
+"such as tuples and lists."
);
static int mathutils_array_parse_fast(float *array,
int size,
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 8426038..17b36f8 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -811,7 +811,12 @@ static struct PyMethodDef Color_methods[] = {
/* ------------------PY_OBECT DEFINITION-------------------------- */
PyDoc_STRVAR(color_doc,
-"This object gives access to Colors in Blender."
+".. class:: Color(rgb)\n"
+"\n"
+" :param rgb: (r, g, b) color values\n"
+" :type rgb: 3-:class:`Vector`\n"
+"\n"
+" This object gives access to Colors in Blender.\n"
);
PyTypeObject color_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 9c0ced3..b9893b9 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -657,6 +657,13 @@ static struct PyMethodDef Euler_methods[] = {
/* ------------------PY_OBECT DEFINITION-------------------------- */
PyDoc_STRVAR(euler_doc,
+".. class:: Euler(angles, order='XYZ')\n"
+"\n"
+" :param angles: three angles, in radians\n"
+" :type angles: 3-:class:`Vector`\n"
+" :param order: order of the angles, a permutation of 'XYZ'\n"
+" :type order: str\n"
+"\n"
"This object gives access to Eulers in Blender."
);
PyTypeObject euler_Type = {
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 4706c09..298925e 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -2716,7 +2716,14 @@ static struct PyMethodDef Matrix_methods[] = {
/*------------------PY_OBECT DEFINITION--------------------------*/
PyDoc_STRVAR(matrix_doc,
-"This object gives access to Matrices in Blender."
+".. class:: Matrix([sequence_of_rows])\n"
+"\n"
+" :param sequence_of_rows: Sequence of rows (which are sequences of floats).\n"
+" When ommitted, a 4x4 identity matrix is constructed.\n"
+" :type sequence_of_rows: tuple or list\n"
+"\n"
+"This object gives access to Matrices in Blender, supporting square and rectangular\n"
+"matrices from 2x2 up to 4x4.\n"
);
PyTypeObject matrix_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 786a932..2d782e8 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -187,6 +187,8 @@ PyDoc_STRVAR(Quaternion_to_exponential_map_doc,
"\n"
" :return: exponential map.\n"
" :rtype: :class:`Vector` of size 3\n"
+"\n"
+" To convert back to a quaternion, pass it to the :class:`Quaternion` constructor.\n"
);
static PyObject *Quaternion_to_exponential_map(QuaternionObject *self)
{
@@ -1226,7 +1228,30 @@ static PyGetSetDef Quaternion_getseters[] = {
/* ------------------PY_OBECT DEFINITION-------------------------- */
PyDoc_STRVAR(quaternion_doc,
-"This object gives access to Quaternions in Blender."
+".. class:: Quaternion([vector, [angle]])\n"
+"\n"
+" :param vector: size 3 or 4\n"
+" :type vector: :class:`Vector`\n"
+" :param angle: rotation angle, in radians\n"
+" :type angle: float\n"
+"\n"
+" This object gives access to Quaternions in Blender. The constructor takes\n"
+" arguments in various forms:\n"
+"\n"
+" no arguments\n"
+" Create an identity quaternion\n"
+"\n"
+" (`wxyz`)\n"
+" Create a quaternion from a `(w, x, y, z)` vector.\n"
+"\n"
+" (`exponential_map`)\n"
+" Create a quaternion from an exponential map vector.\n"
+" See also :meth:`to_exponential_map`\n"
+"\n"
+" (`axis`, `angle`)\n"
+" Create a quaternion representing a rotation of `angle` radians over `axis`.\n"
+" See also :meth:`to_axis_angle`\n"
+"\n"
);
PyTypeObject quaternion_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 167fb5b..d6f7648 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -2904,7 +2904,12 @@ static struct PyMethodDef Vector_methods[] = {
*/
PyDoc_STRVAR(vector_doc,
-"This object gives access to Vectors in Blender."
+".. class:: Vector(sequence_of_floats=(0, 0, 0))\n"
+"\n"
+" :param sequence_of_floats: components of the vector, must be a sequence of at least two elements\n"
+" :type sequence_of_floats: tuple or :class:`Vector`\n"
+"\n"
+" This object gives access to Vectors in Blender.\n"
);
PyTypeObject vector_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
More information about the Bf-blender-cvs
mailing list