Two bug fixes for mesh.faces.extend() method; fix a error checking for
duplicate faces in the input list, and also extend texture faces if they are enabled.
This commit is contained in:
@@ -4084,7 +4084,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
|
||||
/* eliminate new faces already in the mesh */
|
||||
tmppair = newpair;
|
||||
for( i = len; i-- ; ) {
|
||||
for( i = good_faces; i-- ; ) {
|
||||
if( tmppair->v[1] ) {
|
||||
if( bsearch( tmppair, oldpair, mesh->totface,
|
||||
sizeof(SrchFaces), mface_comp ) ) {
|
||||
@@ -4101,6 +4101,16 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
if( good_faces ) {
|
||||
int totface = mesh->totface+good_faces; /* new face count */
|
||||
|
||||
/* if mesh has tfaces, reallocate them first */
|
||||
if( mesh->tface ) {
|
||||
TFace *tmptface;
|
||||
|
||||
tmptface = MEM_callocN(totface*sizeof(TFace), "Mesh_addFaces");
|
||||
memcpy( tmptface, mesh->tface, mesh->totface*sizeof(TFace));
|
||||
MEM_freeN( mesh->tface );
|
||||
mesh->tface = tmptface;
|
||||
}
|
||||
|
||||
/* allocate new face list */
|
||||
tmpface = MEM_callocN(totface*sizeof(MFace), "Mesh_addFaces");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user