[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42868] trunk/blender/source/blender/ python/mathutils: use docstrings for mathutils getset's, also some formatting edits, no functional changes.

Campbell Barton ideasman42 at gmail.com
Sun Dec 25 12:36:35 CET 2011


Revision: 42868
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42868
Author:   campbellbarton
Date:     2011-12-25 11:36:26 +0000 (Sun, 25 Dec 2011)
Log Message:
-----------
use docstrings for mathutils getset's, also some formatting edits, no functional changes.

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils.c
    trunk/blender/source/blender/python/mathutils/mathutils_Color.c
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
    trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
    trunk/blender/source/blender/python/mathutils/mathutils_geometry.c

Modified: trunk/blender/source/blender/python/mathutils/mathutils.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils.c	2011-12-24 22:12:00 UTC (rev 42867)
+++ trunk/blender/source/blender/python/mathutils/mathutils.c	2011-12-25 11:36:26 UTC (rev 42868)
@@ -43,7 +43,7 @@
 static int mathutils_array_parse_fast(float *array,
                                       int size,
                                       PyObject *value_fast,
-									  const char *error_prefix)
+                                      const char *error_prefix)
 {
 	PyObject *item;
 

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Color.c	2011-12-24 22:12:00 UTC (rev 42867)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Color.c	2011-12-25 11:36:26 UTC (rev 42868)
@@ -111,7 +111,7 @@
 //----------------------------print object (internal)--------------
 //print the object to screen
 
-static PyObject *Color_repr(ColorObject * self)
+static PyObject *Color_repr(ColorObject *self)
 {
 	PyObject *ret, *tuple;
 
@@ -126,7 +126,7 @@
 	return ret;
 }
 
-static PyObject *Color_str(ColorObject * self)
+static PyObject *Color_str(ColorObject *self)
 {
 	DynStr *ds;
 
@@ -188,7 +188,7 @@
 }
 //----------------------------object[]---------------------------
 //sequence accessor (get)
-static PyObject *Color_item(ColorObject * self, int i)
+static PyObject *Color_item(ColorObject *self, int i)
 {
 	if (i < 0) i = COLOR_SIZE - i;
 
@@ -207,7 +207,7 @@
 }
 //----------------------------object[]-------------------------
 //sequence accessor (set)
-static int Color_ass_item(ColorObject * self, int i, PyObject *value)
+static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 {
 	float f = PyFloat_AsDouble(value);
 
@@ -235,7 +235,7 @@
 }
 //----------------------------object[z:y]------------------------
 //sequence slice (get)
-static PyObject *Color_slice(ColorObject * self, int begin, int end)
+static PyObject *Color_slice(ColorObject *self, int begin, int end)
 {
 	PyObject *tuple;
 	int count;
@@ -670,18 +670,26 @@
 };
 
 /* color channel, vector.r/g/b */
-static PyObject *Color_channel_get(ColorObject * self, void *type)
+PyDoc_STRVAR(Color_channel_r_doc, "Red color channel.\n\n:type: float");
+PyDoc_STRVAR(Color_channel_g_doc, "Green color channel.\n\n:type: float");
+PyDoc_STRVAR(Color_channel_b_doc, "Blue color channel.\n\n:type: float");
+
+static PyObject *Color_channel_get(ColorObject *self, void *type)
 {
 	return Color_item(self, GET_INT_FROM_POINTER(type));
 }
 
-static int Color_channel_set(ColorObject * self, PyObject *value, void * type)
+static int Color_channel_set(ColorObject *self, PyObject *value, void * type)
 {
 	return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
 }
 
 /* color channel (HSV), color.h/s/v */
-static PyObject *Color_channel_hsv_get(ColorObject * self, void *type)
+PyDoc_STRVAR(Color_channel_hsv_h_doc, "HSV Hue component in [0, 1].\n\n:type: float");
+PyDoc_STRVAR(Color_channel_hsv_s_doc, "HSV Saturation component in [0, 1].\n\n:type: float");
+PyDoc_STRVAR(Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n\n:type: float");
+
+static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
 {
 	float hsv[3];
 	int i = GET_INT_FROM_POINTER(type);
@@ -694,7 +702,7 @@
 	return PyFloat_FromDouble(hsv[i]);
 }
 
-static int Color_channel_hsv_set(ColorObject * self, PyObject *value, void * type)
+static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void * type)
 {
 	float hsv[3];
 	int i = GET_INT_FROM_POINTER(type);
@@ -722,7 +730,8 @@
 }
 
 /* color channel (HSV), color.h/s/v */
-static PyObject *Color_hsv_get(ColorObject * self, void *UNUSED(closure))
+PyDoc_STRVAR(Color_hsv_doc, "HSV Values in [0, 1].\n\n:type: float triplet");
+static PyObject *Color_hsv_get(ColorObject *self, void *UNUSED(closure))
 {
 	float hsv[3];
 	PyObject *ret;
@@ -739,7 +748,7 @@
 	return ret;
 }
 
-static int Color_hsv_set(ColorObject * self, PyObject *value, void *UNUSED(closure))
+static int Color_hsv_set(ColorObject *self, PyObject *value, void *UNUSED(closure))
 {
 	float hsv[3];
 
@@ -762,15 +771,15 @@
 /* Python attributes get/set structure:                                      */
 /*****************************************************************************/
 static PyGetSetDef Color_getseters[] = {
-	{(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Red color channel.\n\n:type: float", (void *)0},
-	{(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Green color channel.\n\n:type: float", (void *)1},
-	{(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Blue color channel.\n\n:type: float", (void *)2},
+	{(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_r_doc, (void *)0},
+	{(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_g_doc, (void *)1},
+	{(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_b_doc, (void *)2},
 
-	{(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Hue component in [0, 1].\n\n:type: float", (void *)0},
-	{(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Saturation component in [0, 1].\n\n:type: float", (void *)1},
-	{(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Value component in [0, 1].\n\n:type: float", (void *)2},
+	{(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_h_doc, (void *)0},
+	{(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_s_doc, (void *)1},
+	{(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_v_doc, (void *)2},
 
-	{(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)"HSV Values in [0, 1].\n\n:type: float triplet", (void *)0},
+	{(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)Color_hsv_doc, (void *)0},
 
 	{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
 	{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2011-12-24 22:12:00 UTC (rev 42867)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2011-12-25 11:36:26 UTC (rev 42868)
@@ -134,7 +134,7 @@
 "   :return: Quaternion representation of the euler.\n"
 "   :rtype: :class:`Quaternion`\n"
 );
-static PyObject *Euler_to_quaternion(EulerObject * self)
+static PyObject *Euler_to_quaternion(EulerObject *self)
 {
 	float quat[4];
 
@@ -155,7 +155,7 @@
 "   :return: A 3x3 roation matrix representation of the euler.\n"
 "   :rtype: :class:`Matrix`\n"
 );
-static PyObject *Euler_to_matrix(EulerObject * self)
+static PyObject *Euler_to_matrix(EulerObject *self)
 {
 	float mat[9];
 
@@ -172,7 +172,7 @@
 "\n"
 "   Set all values to zero.\n"
 );
-static PyObject *Euler_zero(EulerObject * self)
+static PyObject *Euler_zero(EulerObject *self)
 {
 	zero_v3(self->eul);
 
@@ -193,7 +193,7 @@
 "   :arg angle: angle in radians.\n"
 "   :type angle: float\n"
 );
-static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
+static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args)
 {
 	float angle = 0.0f;
 	int axis; /* actually a character */
@@ -231,7 +231,7 @@
 "   :arg other: rotation component of mathutils value\n"
 "   :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
 );
-static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
+static PyObject *Euler_rotate(EulerObject *self, PyObject *value)
 {
 	float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
 
@@ -258,7 +258,7 @@
 "\n"
 "   .. note:: the rotation order is not taken into account for this function.\n"
 );
-static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
+static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
 {
 	float teul[EULER_SIZE];
 
@@ -303,7 +303,7 @@
 //----------------------------print object (internal)--------------
 //print the object to screen
 
-static PyObject *Euler_repr(EulerObject * self)
+static PyObject *Euler_repr(EulerObject *self)
 {
 	PyObject *ret, *tuple;
 
@@ -318,7 +318,7 @@
 	return ret;
 }
 
-static PyObject *Euler_str(EulerObject * self)
+static PyObject *Euler_str(EulerObject *self)
 {
 	DynStr *ds;
 
@@ -378,7 +378,7 @@
 }
 //----------------------------object[]---------------------------
 //sequence accessor (get)
-static PyObject *Euler_item(EulerObject * self, int i)
+static PyObject *Euler_item(EulerObject *self, int i)
 {
 	if (i < 0) i = EULER_SIZE - i;
 
@@ -397,7 +397,7 @@
 }
 //----------------------------object[]-------------------------
 //sequence accessor (set)
-static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
+static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
 {
 	float f = PyFloat_AsDouble(value);
 
@@ -426,7 +426,7 @@
 }
 //----------------------------object[z:y]------------------------
 //sequence slice (get)
-static PyObject *Euler_slice(EulerObject * self, int begin, int end)
+static PyObject *Euler_slice(EulerObject *self, int begin, int end)
 {
 	PyObject *tuple;
 	int count;
@@ -568,9 +568,11 @@
 	(objobjargproc)Euler_ass_subscript
 };
 
-/*
- * euler axis, euler.x/y/z
- */
+/* euler axis, euler.x/y/z */
+
+PyDoc_STRVAR(Euler_axis_doc,
+"Euler axis angle in radians.\n\n:type: float"
+);
 static PyObject *Euler_axis_get(EulerObject *self, void *type)
 {
 	return Euler_item(self, GET_INT_FROM_POINTER(type));
@@ -582,6 +584,10 @@
 }
 
 /* rotation order */
+
+PyDoc_STRVAR(Euler_order_doc,
+"Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']"
+);
 static PyObject *Euler_order_get(EulerObject *self, void *UNUSED(closure))
 {
 	if (BaseMath_ReadCallback(self) == -1) /* can read order too */
@@ -607,13 +613,13 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list