Skip to main content
changed title to reflect question
Link
gandalf3
  • 158.3k
  • 60
  • 612
  • 1.1k

How to list all the selectionsselected elements in python?

Tweeted twitter.com/#!/StackBlender/status/415569460784029696
Source Link
Bleeding Fingers
  • 1.6k
  • 3
  • 14
  • 13

How to list all the selections?

If I select a face of a cube and switch over to the internal Python console and pass:

bpy.context.selected_objects

I get:

[bpy.data.objects['Cube']]

instead of something like [bpy.data.objects['Cube'].f[1]].

Coming from Maya I was looking for something like:

import pymel.core as pc

print pc.ls(sl=True)

which in the above case would return the face id.

Same thing applies for vertices and edges.

How can I go about getting a detailed selection list programmatically?