[Bf-python] Discussion: Mesh PVert/MVert change?
Ken Hughes
khughes at pacific.edu
Sat Jan 14 08:52:11 CET 2006
I changed the Mesh module so that verts.extend() returns a sequence with
the structure as its input except each item replaced by the MVerts added
to the mesh. It also accepts the same input format as face.extend() and
edges.extend() -- except the input is 3 floats, a vector or a PVert. If
PVerts is given as input, the first instance in the input sequence is
added to the mesh as an MVert, and each subsequent instance uses the MVert.
So for example, this script created two faces which share two vertices:
p1=Mesh.MVert(0,0,0)
p2=Mesh.MVert(0,0,1)
p3=Mesh.MVert(0,1,1)
p4=Mesh.MVert(0,1,0)
facelist=[[p1,p2,p3]]
facelist.append([p2,p3,p4])
me.faces.extend(me.verts.extend(facelist))
The downside of this is PVerts and MVerts are still separate things; if
you later do:
me.faces.extend(me.verts.extend([p1,p3,p4]))
three new MVerts are created for this face. Unless we convert the
PVerts to MVerts permanently on the fly, I don't see a way around this.
Anyway, I haven't commited this to CVS yet since I wanted those of you
who are interested to play around with it first. You can find it at
http://www1.pacific.edu/~khughes/blender/Mesh.c
Ken
More information about the Bf-python
mailing list