Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-25 15:36:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-25 15:36:26 +0400
commit67effc8aefcde5acc72a67aff76d367e22a091ae (patch)
tree2f34ccd37825db5389515fe9d6f64fbe310e9d86 /source/blender/python/mathutils/mathutils_Color.c
parentf3ac865cc0031d775f67e3fcaa389e6f06d1954e (diff)
use docstrings for mathutils getset's, also some formatting edits, no functional changes.
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Color.c')
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index c85380fb245..7f3f811c41a 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -111,7 +111,7 @@ static PyObject *Color_copy(ColorObject *self)
//----------------------------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 @@ static PyObject *Color_repr(ColorObject * self)
return ret;
}
-static PyObject *Color_str(ColorObject * self)
+static PyObject *Color_str(ColorObject *self)
{
DynStr *ds;
@@ -188,7 +188,7 @@ static int Color_len(ColorObject *UNUSED(self))
}
//----------------------------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 @@ static PyObject *Color_item(ColorObject * self, int i)
}
//----------------------------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 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
}
//----------------------------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 @@ static PyNumberMethods Color_NumMethods = {
};
/* 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 @@ static PyObject *Color_channel_hsv_get(ColorObject * self, void *type)
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 @@ static int Color_channel_hsv_set(ColorObject * self, PyObject *value, void * typ
}
/* 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 @@ static PyObject *Color_hsv_get(ColorObject * self, void *UNUSED(closure))
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 @@ static int Color_hsv_set(ColorObject * self, PyObject *value, void *UNUSED(closu
/* 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},