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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-04 04:23:37 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-04 04:23:37 +0400
commit3c064f4553e4be988fe4fcec450b59b935fa3c80 (patch)
tree1c3d16fa18865bac305ea1bb0b365308bba26b2d /source/blender/freestyle/intern/python/Interface0D
parent7f8a17118bef19016e916c5c9775871ccb9e22db (diff)
* Added a generic helper function for parsing PyObject arguments as N-dimensional float array.
* Local helpers were replaced with the generic one. This also fixed a memory leak in the setter function StrokeVertex_point_set. * Made minor code style changes.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D')
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
index 3d7a29a540d..27f70caeb70 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -188,8 +188,7 @@ void StrokeVertex_mathutils_register_callback()
PyDoc_STRVAR(StrokeVertex_attribute_doc,
"StrokeAttribute for this StrokeVertex.\n"
"\n"
-":type: StrokeAttribute"
-);
+":type: StrokeAttribute");
static PyObject *StrokeVertex_attribute_get(BPy_StrokeVertex *self, void *UNUSED(closure))
{
@@ -209,8 +208,7 @@ static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, PyObject *value, v
PyDoc_STRVAR(StrokeVertex_curvilinear_abscissa_doc,
"Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
"\n"
-":type: float"
-);
+":type: float");
static PyObject *StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, void *UNUSED(closure))
{
@@ -231,8 +229,7 @@ static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, PyObjec
PyDoc_STRVAR(StrokeVertex_point_doc,
"2D point coordinates.\n"
"\n"
-":type: mathutils.Vector"
-);
+":type: mathutils.Vector");
static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(closure))
{
@@ -241,13 +238,13 @@ static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(clo
static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
{
- Vec2f *v = Vec2f_ptr_from_PyObject(value);
- if (!v) {
+ float v[2];
+ if (!float_array_from_PyObject(value, v, 2)) {
PyErr_SetString(PyExc_ValueError, "value must be a 2-dimensional vector");
return -1;
}
- self->sv->setX(v->x());
- self->sv->setY(v->y());
+ self->sv->setX(v[0]);
+ self->sv->setY(v[1]);
return 0;
}
@@ -255,8 +252,7 @@ PyDoc_STRVAR(StrokeVertex_stroke_length_doc,
"Stroke length (it is only a value retained by the StrokeVertex,\n"
"and it won't change the real stroke length).\n"
"\n"
-":type: float"
-);
+":type: float");
static PyObject *StrokeVertex_stroke_length_get(BPy_StrokeVertex *self, void *UNUSED(closure))
{
@@ -277,8 +273,7 @@ static int StrokeVertex_stroke_length_set(BPy_StrokeVertex *self, PyObject *valu
PyDoc_STRVAR(StrokeVertex_u_doc,
"Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
"\n"
-":type: float"
-);
+":type: float");
static PyObject *StrokeVertex_u_get(BPy_StrokeVertex *self, void *UNUSED(closure))
{