diff options
2 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index c0c3f700b65..7d9026a6c78 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -99,9 +99,17 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe return NULL; } PyObject *list = PyList_New(0); - - for( unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) - PyList_Append(list, BPy_ViewShape_from_ViewShape(*( self->uf0D_vectorviewshape->result[i] )) ); + PyObject *item; + for( unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) { + ViewShape *v = self->uf0D_vectorviewshape->result[i]; + if (v) { + item = BPy_ViewShape_from_ViewShape(*v); + } else { + item = Py_None; + Py_INCREF(item); + } + PyList_Append(list, item); + } return list; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index 6493bcb13fb..e59aeefff52 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -129,9 +129,17 @@ static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVe return NULL; } PyObject *list = PyList_New(0); - - for( unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) - PyList_Append(list, BPy_ViewShape_from_ViewShape(*( self->uf1D_vectorviewshape->result[i] )) ); + PyObject *item; + for( unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); 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); + } return list; } |