[Bf-python] Mesh API and UV faces

Ken Hughes khughes at pacific.edu
Wed Feb 1 07:58:11 CET 2006


Cam and I were talking in IRC about how the Mesh module handles UV 
faces.  Currently it doesn't allow the user to read or write to the uv 
attributes if the mesh doesn't have any UV faces (me->tface == NULL). 
This is making it awkward for importer scripts since they have to create 
  at least one face before me.faceUV can be set (this is not entirely my 
idea; in the Blender UI, you can't set the TexFace button if the mesh 
doesn't have any faces either).

His suggestion is to allow setting (and possibly getting) the face.uv 
attribute to allocate me->tface if it doesn't exist, instead of throwing 
an exception as it does now.  The alternative is what Cam's doing now:

for f in newFaces:
   me.faces.extend(f)
   try:
	me.faces[-1].uv = (u,v)
   except:
	me.faceUV = 1
	me.faces[-1].uv = (u,v)

Any comments?

Ken



More information about the Bf-python mailing list