[Bf-python] Latest update on Mesh module

Ken Hughes khughes at pacific.edu
Mon Oct 17 06:51:35 CEST 2005


This is a follow up to last week's e-mail on the new Mesh module.  I 
mainly wanted to get some feedback before I commit these to CVS, 
possibly sometime this week.

* fixed the mesh.findEdges() method which I'd removed from earlier 
releases; you can pass it one or a sequence of ints or MVerts and it 
will return an int or a list of ints containing either the index in the 
edge list or None.
* added delete() methods for deleting one or more items from the verts, 
edges or faces lists.  I've tried to do this identically to the UI mesh 
editing; deleting verts causes deletion of edges and faces containing 
those verts, etc.
* added more experimental methods for accessing mesh tools; mesh.smooth 
mesh.flipNormals, mesh.toSphere, mesh.subdivide, and mesh.remDoubles. 
These only work if you are not in the edit mode since they use the 
existing editmesh structures (if you call then while in the edit mode, a 
runtime exception is thrown).
* allow assignment to mesh.verts; the argument must either be a sequence 
of MVerts (thick or thin) or a MVertSeq (this allows "m1.verts = 
m2.verts").  The only condition is that the new list must be the same 
size as the current vert list; this brings us back to the discussion of 
what to do if the lists are not the same size, as making the list 
smaller without changing the edge and face lists can have bad 
reprecussion (segfaults).  I can use the code used by the delete() 
methods to adjust this; question is, what is the proper thing to do at 
all.  It's going to have the same implications for assigning to .edges 
and .faces later.

I thought about adding methods to create thick MEdges and MFaces, but I 
couldn't see any benefit; if someone can think of a good use for them, 
I'll be happy to add them in.

So I'm looking now at the other miscellaneous methods in NMesh, with 
future thoughts of replacing NMesh completely.  Should I recode all of 
those methods, or are there some "legacy" ones which don't make much 
sense anymore or are rarely used?  Are they any methods glaringly 
missing, based on recent additions elsewhere in Blender.

Later, I'd like to know people's thoughts on implementing ALL the mesh 
tools, especially things like extrude (I also hope some people try out 
the experimental stuff I've added already for "simple" tools to see that 
they really work OK).

Thanks -- Ken



More information about the Bf-python mailing list