[Bf-python] Changing BPy Mesh to use more editMesh code

Ken Hughes khughes at pacific.edu
Wed Jul 19 23:44:09 CEST 2006


Long story short: Cam found some bugs in the edge and face delete code 
of the Mesh API, and when Ton looked at the code he wasn't happy with 
the duplication.  He wants Mesh to use the editMesh code for 
manipulation of meshes.  The biggest hinderances to using the existing 
code, though, are
(1) the global G struct
(2) whether the whole Mesh module should be rewritten to work using the 
editMesh structure or just parts of it
(3) the inability to edit more than one mesh at a time

Joe Eagar is planning to remove the G "globalness" from the editMesh 
code, which will definitely take care of (1).  (2) is a different issue, 
mainly a trade-off: either we copy the mesh to an editMesh when we want 
to use those functions and copy the resulting mesh back when they're 
done, or we need to have an .update() method to flush the editMesh 
changes to the mesh structure.  I can't think of a way to do this 
automagically.  Right now, the Mesh module does do the 
copy-back-and-forth for the tool methods like me.quadToTriangle(), and 
.delete() and .extend() can probably do that as well.  I've spend the 
morning looking at me.edges.delete() and it was not too hard to convert.

(3) is only an issue if we decide to implement (2), and Joe's changes 
will probably make it possible anyway.

One side effect of using editMode code will be changes in the behavior 
of some existing methods.  me.edges.delete() for example, will change 
the selection state of edges (and probably verts and faces) since this 
is what editMode does.  In fact, me.edges.delete() will basically do 
nothing more than set the SELECT bit of each face in the input sequence 
and clear all the others.  As such, hopefully we can do this when we 
break the rest of the API anyway.

Ken




More information about the Bf-python mailing list