From 69836ce9bce1f89aa9751f5faebb80ba15116dfd Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Fri, 25 Aug 2006 16:01:16 +0000 Subject: [PATCH] ===Python API=== More additions for Mesh.faces.extend(); allow faces with 2 verts or duplicate verts to remain in the input list (although they are still not added to the mesh) so that indexList option can return None for them. The goal is for all faces which are discarded to still be ignored but return None. --- source/blender/python/api2_2x/Mesh.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 19d9e41cdd5..5ebb74f088e 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -4702,8 +4702,8 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args, for( i = 0; i < len; ++i ) { tmp = PySequence_ITEM( args, i ); nverts = PySequence_Size( tmp ); - if( nverts != 2 ) /* new faces cannot have only 2 verts */ - ++new_face_count; + if( return_list || nverts != 2 ) + ++new_face_count; /* new faces must have 3 or 4 verts */ Py_DECREF( tmp ); } @@ -4723,6 +4723,8 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args, nverts = PySequence_Size( tmp ); if( nverts == 2 ) { /* again, ignore 2-vert tuples */ + if( return_list ) /* if returning indices, mark as deleted */ + tmppair->v[1] = 0; Py_DECREF( tmp ); continue; } @@ -4777,9 +4779,13 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args, break; tmppair->v[j] = vert[j]; } - if( j >= 0 ) { - --new_face_count; - continue; + if( j >= 0 ) { /* a duplicate vertex found */ + if( return_list ) { /* if returning index list */ + tmppair->v[1] = 0; /* mark as deleted */ + } else { + --new_face_count; /* otherwise skip */ + continue; + } } tmppair->index = i;