Python API
---------- Bugfix #8615: NMesh.update() did not check if faces had less than 3 vertices, so would create bogus faces. Also discovered in the process that documentation and error message for Mesh.assignVertsToGroup() was wrong.
This commit is contained in:
@@ -6483,7 +6483,7 @@ static PyObject *Mesh_assignVertsToGroup( BPy_Mesh * self, PyObject * args )
|
||||
if( !PyArg_ParseTuple ( args, "sO!fi", &groupStr, &PyList_Type,
|
||||
&listObject, &weight, &assignmode) ) {
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected string, list, float, string arguments" );
|
||||
"expected string, list, float, int arguments" );
|
||||
}
|
||||
|
||||
pGroup = get_named_vertexgroup( object, groupStr );
|
||||
|
||||
@@ -2582,27 +2582,27 @@ static int mface_from_data( MFace * mf, CustomData *fdata, int findex,
|
||||
nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 0 );
|
||||
if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
|
||||
mf->v1 = nmv->index;
|
||||
else
|
||||
mf->v1 = 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 1 );
|
||||
if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
|
||||
mf->v2 = nmv->index;
|
||||
else
|
||||
mf->v2 = 0;
|
||||
return -1;
|
||||
|
||||
nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 2 );
|
||||
if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
|
||||
mf->v3 = nmv->index;
|
||||
else
|
||||
mf->v3 = 0;
|
||||
return -1;
|
||||
|
||||
if( numverts == 4 ) {
|
||||
nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 3 );
|
||||
if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
|
||||
mf->v4 = nmv->index;
|
||||
else
|
||||
mf->v4 = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( tf )
|
||||
@@ -2966,6 +2966,7 @@ static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh)
|
||||
MVert *newmv;
|
||||
MSticky *newst;
|
||||
int nmeshtotedges;
|
||||
int badfaces;
|
||||
int i, j, ok;
|
||||
|
||||
/* Minor note: we used 'mode' because 'flag' was already used internally
|
||||
@@ -3054,14 +3055,19 @@ static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh)
|
||||
}
|
||||
|
||||
newmf = mesh->mface;
|
||||
badfaces = 0;
|
||||
for( i = 0; i < mesh->totface; i++ ) {
|
||||
PyObject *mf = PySequence_GetItem( nmesh->faces, i );
|
||||
ok = mface_from_data( newmf, &mesh->fdata, i, ( BPy_NMFace * ) mf );
|
||||
Py_DECREF( mf );
|
||||
if( !ok )
|
||||
if( ok == 0)
|
||||
return 0;
|
||||
newmf++;
|
||||
else if ( ok == -1 )
|
||||
++badfaces;
|
||||
else
|
||||
newmf++;
|
||||
}
|
||||
mesh->totface -= badfaces;
|
||||
|
||||
/* Always do this to ensure no loose edges in faces */
|
||||
fill_medge_from_nmesh(mesh, nmesh);
|
||||
|
||||
@@ -987,7 +987,7 @@ class Mesh:
|
||||
@param group: the name of a vertex group.
|
||||
"""
|
||||
|
||||
def assignVertsToGroup(group, vertList, weight, assignmode = AssignModes['REPLACE']):
|
||||
def assignVertsToGroup(group, vertList, weight, assignmode):
|
||||
"""
|
||||
Adds an array (a Python list) of vertex points to a named vertex group
|
||||
associated with a mesh. The vertex list is a list of vertex indices from
|
||||
|
||||
Reference in New Issue
Block a user