From 8c5597eb4964086c715b7d0038ddb4c6cb718296 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Tue, 5 Nov 2013 00:51:59 +0000 Subject: Additional code improvements: avoid unnecessary Python object allocations in Freestyle. --- .../blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source/blender/freestyle/intern/python/Interface0D') diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 3205a3a3d7e..d2dd1657770 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -107,17 +107,15 @@ static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject { static const char *kwlist[] = {"normal", NULL}; PyObject *py_normal; + Vec3r n; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal)) return NULL; - Vec3r *n = Vec3r_ptr_from_PyObject(py_normal); - if (!n) { + if (!Vec3r_ptr_from_PyObject(py_normal, &n)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)"); return NULL; } - self->sv->AddNormal(*n); - delete n; - + self->sv->AddNormal(n); Py_RETURN_NONE; } -- cgit v1.2.3