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/Interface0D/BPy_SVertex.cpp
parent737239c4c4f1b422c741d53b19bf21939d7382c3 (diff)
Additional code improvements: avoid unnecessary Python object allocations in Freestyle.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp8
1 files changed, 3 insertions, 5 deletions
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;
}