I try to get the selected vertices and edges in edit mode.
There are many ways to get the selected object, but I don’t want the whole object… how can I do it?
In edit mode use: Ctrl I to revert the selection than use H to hide this part! (Alt -H = unhide).
Ok, but I want to get the selected vertices in my python script (with hiding, I have always the whole object if I use scn= Blender.Scene.GetCurrent() and object= scn.objects.active)
You can’t, bottom line :rolleyes:
mesh = Blender.Scene.GetCurrent().objects.active.data sel_verts = [v for v in mesh.verts if not v.hidden and v.selected]
but don’t forget to toggle out of edit mode when making that list!
… else python will return what was selected when you entered edit mode rather than what the current state is.
Thank you! It’s what I wanted.
The vertex’s selection state (selected=1). Note: a Mesh will return the selection state of the mesh when EditMode was last exited. A Python script operating in EditMode must exit EditMode before getting the current selection state of the mesh.