[Bf-python] Mesh.Face() constructor

Chris Want cwant at ualberta.ca
Thu Mar 2 04:31:23 CET 2006


Hi Ken,

It was me alright!

Basically all I'm trying to do is update a piece of code
(a bridge between the python API of the VTK library)
that got broken when the NMesh API stopped allowing edges
as faces with 2 vertices. Since I am updating, I thought
it would be best to move to the Mesh module at this time.

I know that if I have a mesh, I can add a face with
something like:

me.faces.extend(me.verts[i], \
                 me.verts[i+1]), \
                 me.verts[i+2])

But I want to assign vertex colors to the face too
... what is the best way to access this face towards this
end? Do I need to get a handle to the face directly after adding
it using something like f= me.faces[-1] (I think that's how
you get the last item in a list), or is there a better way?
This was the reason I was looking for come kind of constructor
for a face.

One thing that would be good is if the examples in the
docs were updated to show a situation where you are
creating a mesh and verts and faces from scratch, not
just accessing data in a pre-existing mesh.

Regards,
Chris

Ken Hughes wrote:
> Somebody (maybe Hos?) on IRC today was asking why there is no 
> Mesh.Face.New() constructor function in the Mesh API.  I just wanted to 
> tell whoever that was that I'd like to add one, but can't seem to get a 
> consensus from users as to how to implement it.
> 
> The specific problem isn't the constructor itself, but how to 
> efficiently add faces to a mesh.  I'd personally like to just add faces 
> to the mesh and have the API insert the necessary vertices, but brings 
> into question how to avoid -- or allow -- duplicate vertices while doing 
>  so.  Otherwise it could work as NMesh.Face does and require the verts 
> to be created first.
> 
> Ken
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
> 




More information about the Bf-python mailing list