[Bf-python] Get faces from vertex

Willian Padovani Germano wgermano at ig.com.br
Fri Apr 2 09:19:04 CEST 2004


----- Original Message -----
From: "Tom Musgrove" <tommusgrove__ at hotmail.com>
To: <bf-python at blender.org>
Sent: Friday, April 02, 2004 1:14 AM
Subject: [Bf-python] Get faces from vertex


> Hi,
>
> 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.

=== BTW,

the current 2.32 has support to get / set vertex selection state in
NMesh.  Before, it was already possible indirectly, using the vgrouping
functions added by Joseph, but now you just have to select the vertex or
vertices in edit mode, LEAVE EDIT MODE, then run your script and check
each vert.sel variable to see if the vertice is selected (vert.sel == 1)
or not ( vert.sel == 0).

I said to leave editmode because if you change a mesh via scripting
while it's in editmode, when you leave editmode you lose the changes the
script made.  We should consider making bpython check if editmode is on
and leave it before executing any script.  Anyone against this?  We can
add functions to enter / leave editmode to the API, too.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list