Discover selected vertex

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
isiluin
Posts: 0
Joined: Sat Aug 03, 2013 12:23 pm

Discover selected vertex

Post by isiluin » Sat Aug 03, 2013 10:26 pm

I am trying to discover which vertex (or vertices) of a mesh are selected. I am using the following in the python console:

Code: Select all

>>> obj = bpy.data.objects.get("Cube")
>>> for v in obj.data.vertices:
... print(v, v.select)
...	
which correctly prints a list of the current selection status. If I then select a different vertex (in the 3D view edit mode) and re-run the code fragment the output remains the same (i.e. it does not reflect the changed selection.) If I then change to object mode and back to edit mode the correct selections are returned. Is this the expected behaviour or am I missing something here?

Post Reply