[Bf-python] Get faces from vertex
Roland Hess
rolandh at reed-witting.com
Fri Apr 2 14:04:52 CEST 2004
> > I'd like to give blender a particular vertice number of an object (or
>> alternatively the position of the vertice), and have blender return
>> the faces which that vertice is part of.
>(...)
>> Is there something in blender python that could give me this
>> information?
>
>Hi Tom,
>
>There are no hard-coded speed-ups -- we can add them if necessary -- but
>for a given mesh you can iterate over the list of faces, searching for
>the index of a particular vertex. This way you get all faces that
>vertex is connected to. From this info you can manage to get which
>vertices are connect to a given vertex, too.
>
This is the way I solved the problem in BlenderPeople when building
the search tree for the ground mesh. You have to iterate over all of
the faces in the mesh, comparing each vert of the current face to the
one you're testing for. If it's a match, you add that face object to
your list. There is no back-link built into the vertex structure
within Blender that points up to faces. I suppose the way to approach
this thing would be to write a function that builds an index of
faces/verts when called. You can than have a function(s) that uses
this index to give you the info you need. You would call the indexing
function once per mesh. If the mesh changed, you would need to call
it again before any more lookups were made.
--
Roland Hess (harkyman)
http://www.harkyman.com
Digital Prepress/Network Administrator
Reed & Witting Company
More information about the Bf-python
mailing list