Additional code improvements: avoid unnecessary Python object allocations in Freestyle.

This commit is contained in:
2013-11-05 00:51:59 +00:00
parent 737239c4c4
commit 8c5597eb49
6 changed files with 153 additions and 144 deletions

View File

@@ -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;
}