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:
authorKen Hughes <khughes@pacific.edu>2008-03-26 20:29:20 +0300
committerKen Hughes <khughes@pacific.edu>2008-03-26 20:29:20 +0300
commit2976a38fd9aeeadfbcef743ce1663e613b4508b3 (patch)
tree516355774e7506a9dc2c92b9d7c12053e06e3feb /source/blender/python/api2_2x
parent972b0a5218ba166ed648f4053c494af30cfa8c02 (diff)
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.
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r--source/blender/python/api2_2x/Mesh.c2
-rw-r--r--source/blender/python/api2_2x/NMesh.c20
-rw-r--r--source/blender/python/api2_2x/doc/Mesh.py2
3 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index 90b4d899f4f..f37ec1f86c0 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -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 );
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index b443952d1d2..4fb95ecd9eb 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -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);
diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py
index 8b49ce29d54..d8bd7be6566 100644
--- a/source/blender/python/api2_2x/doc/Mesh.py
+++ b/source/blender/python/api2_2x/doc/Mesh.py
@@ -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