diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_Freestyle.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Freestyle.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index c28f6ef6762..fb678d7ea66 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -129,7 +129,6 @@ static PyObject *Freestyle_blendRamp(PyObject *self, PyObject *args) PyObject *obj1, *obj2; char *s; int type; - Vec3f *v1 = NULL, *v2 = NULL; float a[3], fac, b[3]; if (!PyArg_ParseTuple(args, "sOfO", &s, &obj1, &fac, &obj2)) @@ -137,32 +136,20 @@ static PyObject *Freestyle_blendRamp(PyObject *self, PyObject *args) type = ramp_blend_type(s); if (type < 0) { PyErr_SetString(PyExc_TypeError, "argument 1 is an unknown ramp blend type"); - goto error; + return NULL; } - v1 = Vec3f_ptr_from_PyObject(obj1); - if (!v1) { + if (!float_array_from_PyObject(obj1, a, 3)) { PyErr_SetString(PyExc_TypeError, "argument 2 must be a 3D vector (either a tuple/list of 3 elements or Vector)"); - goto error; + return NULL; } - v2 = Vec3f_ptr_from_PyObject(obj2); - if (!v2) { + if (!float_array_from_PyObject(obj2, b, 3)) { PyErr_SetString(PyExc_TypeError, "argument 4 must be a 3D vector (either a tuple/list of 3 elements or Vector)"); - goto error; + return NULL; } - a[0] = v1->x(); b[0] = v2->x(); - a[1] = v1->y(); b[1] = v2->y(); - a[2] = v1->z(); b[2] = v2->z(); ramp_blend(type, a, fac, b); - delete v1; - delete v2; return Vector_CreatePyObject(a, 3, Py_NEW, NULL); - -error: - if (v1) delete v1; - if (v2) delete v2; - return NULL; } #include "BKE_texture.h" /* do_colorband() */ |