[Bf-python] Mesh.Face() constructor

Campbell Barton cbarton at metavr.com
Thu Mar 2 17:47:54 CET 2006


I dont have a problem with making a face and then assigning, though for 
performance reasons Id like to be able to do
me.faces.extend( (v1, v2, v3, uv_vec, img, col, flag) )
This would be faster because dummy data dosent need to be assigned and 
then modified later.

This seems not nice design but its easier then what currently has to be 
done. because it saves you having to look back at the faces you have 
added. which is especially tricky when Mesh doesent add ALL the faces 
you have added (because of errors in the face data)

Of course this extended data would be optional. (v1,2,3)

- Cam

Chris Want wrote:
> 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
>>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list