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:
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp')
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index a028952fa69..c15d974e771 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -142,18 +142,12 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect
}
return NULL;
}
- PyObject *list = PyList_New(0);
- PyObject *item;
- for (unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) {
+
+ const unsigned int list_len = self->uf1D_vectorviewshape->result.size();
+ PyObject *list = PyList_New(list_len);
+ for (unsigned int i = 0; i < list_len; i++) {
ViewShape *v = self->uf1D_vectorviewshape->result[i];
- if (v) {
- item = BPy_ViewShape_from_ViewShape(*v);
- }
- else {
- item = Py_None;
- Py_INCREF(item);
- }
- PyList_Append(list, item);
+ PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None));
}
return list;