[Bf-python] Discussion: Mesh PVert/MVert change?

Ken Hughes khughes at pacific.edu
Thu Jan 12 21:17:57 CET 2006


Toni Alatalo wrote:
> On Thursday 12 January 2006 19:51, Ken Hughes wrote:
> 
>>written some scripts the last few weeks, it seems better to just create
>>a sequence of PVerts and then add with me.faces.extend().
> 
> good to hear you get practical experience :)

Darn closet scripters :-)

>>allow a PVert to change into an MVert.  When a PVert is passed to
> 
> (..)
> 
>>to having a Py_NEW object change into a Py_WRAP object.
> 
> in general, i think it is not a good idea to change objects like that.
> 
> could you add some method/function that does the job, and makes new MVerts 
> based on the PVerts? i think that is usually preferred stylewise: dont change 
> the type of objects, but use them to create new ones of the type you need.

Well, that's what me.verts.extend() does :-)

The issue (that I see) is there currently two separate steps the user 
must take which are cumbersome.  (Actually someone just prior to the 
2.40 release was asking why there wasn't a PFace object and at the time 
I didn't see the issue).  I could make me.verts.extend() accept the same 
style input as face.extend() and return a duplicate sequence with PVerts 
replaced by MVerts.  You could then do:

me.faces.extend(me.verts.extend(verts))

Maybe another approach would be to allow PVerts as args to face.extend() 
but internally split them out separately and create the new mesh verts. 
  It would mean building a separate structure to keep track of this... 
and some extra work since adding faces forces me to add edges too 
(thanks to zr's mesh changes) so I would need to know what new verts 
were added by the edges to reuse in the face.

Ken



More information about the Bf-python mailing list