[Bf-python] Fix for NMesh face sel
Willian Padovani Germano
wgermano at ig.com.br
Thu Feb 3 04:16:08 CET 2005
joeedh wrote:
> Hi. I've written a intrude tool in bpython!! I works just like in
> Wings, except that you have to manually press ALT-S to move along normal.
> EXCEPT. . .there was a bug in NMesh where flags from the newly added
> Face Select mode weren't being considered. This patch fixes that. I
> need the flags to behave correctly to identify which faces are selected .
Hi Joe,
As you know, there are two face flags regulating selection and
visibility state, etc: one for tfaces (face select mode in 3d view) and
another for normal mfaces (visible in edit mode). NMesh handled the
tface ones with nmesh->flag, since that was the only thing available
when it was written. It's better not to mix them, because Blender
doesn't keep tfaces and mfaces sel/hide states in sync, for ex. sel
states are currently independent unless you enter editmode while in face
select mode.
I added (current cvs) two new attributes to NMFace: sel and hide, to
handle selection and visibility of mesh faces -- the ones we see in edit
mode -- please try and tell me if this is enough.
It's simpler than nmesh->flag bitflag:
import Blender
from Blender import NMesh, Window
in_emode = Window.EditMode()
if in_emode: Window.EditMode(0)
nmesh = NMesh.GetRaw("Mesh")
faces = nmesh.faces
selected = []
for f in faces:
if f.sel:
selected.append(f)
print selected
# invert selection:
for f in faces:
f.sel = 1 - f.sel
nmesh.update()
if in_emode: Window.EditMode(1)
Stephen: (about obj.getData(name_only = True) ... indeed it sounds
better this way, I'll change it in my next commit, unless someone in a
hurry does it first ; ).
--
Willian
More information about the Bf-python
mailing list