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-05 04:51:59 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-05 04:51:59 +0400
commit8c5597eb4964086c715b7d0038ddb4c6cb718296 (patch)
tree34d0a78421e01ee6ceb2b372c85023b55a302d06 /source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
parent737239c4c4f1b422c741d53b19bf21939d7382c3 (diff)
Additional code improvements: avoid unnecessary Python object allocations in Freestyle.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index e17f16a2fa7..b08fcfa8dba 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -311,16 +311,15 @@ static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
+ Vec2f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
- Vec2f *v = Vec2f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec2f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
- self->sa->setAttributeVec2f(s, *v);
- delete v;
+ self->sa->setAttributeVec2f(s, vec);
Py_RETURN_NONE;
}
@@ -341,16 +340,15 @@ static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
+ Vec3f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
- Vec3f *v = Vec3f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec3f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
- self->sa->setAttributeVec3f(s, *v);
- delete v;
+ self->sa->setAttributeVec3f(s, vec);
Py_RETURN_NONE;
}