diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-08 03:17:23 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-08 03:17:23 +0400 |
commit | 4a92d82626980d6d1690113b9d27aae282fd48eb (patch) | |
tree | d690f59c72441272ed462fe59d416a9a255d087e /source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp | |
parent | b4b22699850a859d601bb4851d0af18f568b3061 (diff) |
A big code clean-up patch from Bastien Montagne, many thanks!
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 3a5abd21d07..1547de42a91 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -135,22 +135,19 @@ static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObj return 0; } -static void StrokeAttribute_dealloc(BPy_StrokeAttribute* self) +static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self) { if (self->sa && !self->borrowed) delete self->sa; - Py_TYPE(self)->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject *)self); } -static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute* self) +static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute *self) { stringstream repr("StrokeAttribute:"); - repr << " r: " << self->sa->getColorR() - << " g: " << self->sa->getColorG() - << " b: " << self->sa->getColorB() - << " a: " << self->sa->getAlpha() - << " - R: " << self->sa->getThicknessR() - << " L: " << self->sa->getThicknessL(); + repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG() << " b: " << self->sa->getColorB() << + " a: " << self->sa->getAlpha() << + " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL(); return PyUnicode_FromString(repr.str().c_str()); } @@ -365,15 +362,24 @@ static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, } static PyMethodDef BPy_StrokeAttribute_methods[] = { - {"get_attribute_real", (PyCFunction) StrokeAttribute_get_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_real_doc}, - {"get_attribute_vec2", (PyCFunction) StrokeAttribute_get_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_vec2_doc}, - {"get_attribute_vec3", (PyCFunction) StrokeAttribute_get_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_vec3_doc}, - {"has_attribute_real", (PyCFunction) StrokeAttribute_has_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_real_doc}, - {"has_attribute_vec2", (PyCFunction) StrokeAttribute_has_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_vec2_doc}, - {"has_attribute_vec3", (PyCFunction) StrokeAttribute_has_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_vec3_doc}, - {"set_attribute_real", (PyCFunction) StrokeAttribute_set_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_real_doc}, - {"set_attribute_vec2", (PyCFunction) StrokeAttribute_set_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_vec2_doc}, - {"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_vec3_doc}, + {"get_attribute_real", (PyCFunction) StrokeAttribute_get_attribute_real, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_real_doc}, + {"get_attribute_vec2", (PyCFunction) StrokeAttribute_get_attribute_vec2, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_vec2_doc}, + {"get_attribute_vec3", (PyCFunction) StrokeAttribute_get_attribute_vec3, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_vec3_doc}, + {"has_attribute_real", (PyCFunction) StrokeAttribute_has_attribute_real, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_real_doc}, + {"has_attribute_vec2", (PyCFunction) StrokeAttribute_has_attribute_vec2, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_vec2_doc}, + {"has_attribute_vec3", (PyCFunction) StrokeAttribute_has_attribute_vec3, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_vec3_doc}, + {"set_attribute_real", (PyCFunction) StrokeAttribute_set_attribute_real, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_real_doc}, + {"set_attribute_vec2", (PyCFunction) StrokeAttribute_set_attribute_vec2, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_vec2_doc}, + {"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_vec3_doc}, {NULL, NULL, 0, NULL} }; @@ -545,7 +551,8 @@ PyDoc_STRVAR(StrokeAttribute_thickness_doc, static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_THICKNESS); + return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, + MATHUTILS_SUBTYPE_THICKNESS); } static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) @@ -580,10 +587,14 @@ static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, PyObject *valu } static PyGetSetDef BPy_StrokeAttribute_getseters[] = { - {(char *)"alpha", (getter)StrokeAttribute_alpha_get, (setter)StrokeAttribute_alpha_set, (char *)StrokeAttribute_alpha_doc, NULL}, - {(char *)"color", (getter)StrokeAttribute_color_get, (setter)StrokeAttribute_color_set, (char *)StrokeAttribute_color_doc, NULL}, - {(char *)"thickness", (getter)StrokeAttribute_thickness_get, (setter)StrokeAttribute_thickness_set, (char *)StrokeAttribute_thickness_doc, NULL}, - {(char *)"visible", (getter)StrokeAttribute_visible_get, (setter)StrokeAttribute_visible_set, (char *)StrokeAttribute_visible_doc, NULL}, + {(char *)"alpha", (getter)StrokeAttribute_alpha_get, (setter)StrokeAttribute_alpha_set, + (char *)StrokeAttribute_alpha_doc, NULL}, + {(char *)"color", (getter)StrokeAttribute_color_get, (setter)StrokeAttribute_color_set, + (char *)StrokeAttribute_color_doc, NULL}, + {(char *)"thickness", (getter)StrokeAttribute_thickness_get, (setter)StrokeAttribute_thickness_set, + (char *)StrokeAttribute_thickness_doc, NULL}, + {(char *)"visible", (getter)StrokeAttribute_visible_get, (setter)StrokeAttribute_visible_set, + (char *)StrokeAttribute_visible_doc, NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; |