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>2014-06-24 17:48:15 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-06-24 18:13:56 +0400
commit9563bde9a5457a3b04b61b8727d798da3ab689d3 (patch)
tree13d9205314245e57fc62db8af0d5a9457fd45ad6 /source/blender/freestyle/intern/python/Interface0D
parent252eaed483ca8c0d89708b3d0a2a82076f944229 (diff)
Freestyle: use mathutils_array_parse() instead of its own helper functions.
Patch contribution by flokkievids (Folkert de Vries). Thanks!
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D')
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp15
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp5
2 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index 7317479a878..af9f7198748 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -61,11 +61,6 @@ PyDoc_STRVAR(SVertex_doc,
" :arg id: An Id object.\n"
" :type id: :class:`Id`");
-static int convert_v3(PyObject *obj, void *v)
-{
- return float_array_from_PyObject(obj, (float *)v, 3);
-}
-
static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist_1[] = {"brother", NULL};
@@ -283,8 +278,9 @@ static PyObject *SVertex_point_3d_get(BPy_SVertex *self, void *UNUSED(closure))
static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure))
{
float v[3];
- if (!float_array_from_PyObject(value, v, 3)) {
- PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
+ if (mathutils_array_parse(v, 3, 3, value,
+ "value must be a 3-dimensional vector") == -1)
+ {
return -1;
}
Vec3r p(v[0], v[1], v[2]);
@@ -305,8 +301,9 @@ static PyObject *SVertex_point_2d_get(BPy_SVertex *self, void *UNUSED(closure))
static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure))
{
float v[3];
- if (!float_array_from_PyObject(value, v, 3)) {
- PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
+ if (mathutils_array_parse(v, 3, 3, value,
+ "value must be a 3-dimensional vector") == -1)
+ {
return -1;
}
Vec3r p(v[0], v[1], v[2]);
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 18f0f81b0ec..65d80283fca 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -277,8 +277,9 @@ static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(clo
static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
{
float v[2];
- if (!float_array_from_PyObject(value, v, 2)) {
- PyErr_SetString(PyExc_ValueError, "value must be a 2-dimensional vector");
+ if (mathutils_array_parse(v, 2, 2, value,
+ "value must be a 2-dimensional vector") == -1)
+ {
return -1;
}
self->sv->setX(v[0]);