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-11-03 18:25:37 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-03 18:25:37 +0400
commit95755218128956d8bd874d3e30eb53f10b2cd9ce (patch)
treebb2b78fc81b044f7daf41641ac22fca6b68eb845 /source/blender/freestyle
parent2190e6de0e971b5267925e609b73f0ce4931b02b (diff)
Minor code improvements: avoid unnecessary Python object allocations in Freestyle color blending.
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/python/BPy_Freestyle.cpp23
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() */