get the name of the selected bones 2.62

Hi everyone,

I’m trying to do a batch action on bones that I have selected, but I can’t find the way to get the name of my selected bones. I can only get the active one.

Thank you for your help.

Mathias.

bpy.context.selected_bones

returns a list of bone objects when you are in edit mode.

So something like:

a=[]
for i in bpy.context.selected_bones:
    a.append(i.name)

would make a list containing the names of the selected bones.

Using bpy.context.selected_bones while in object or pose mode won’t do.

bpy.conetxt.selected_objects

returns a list of selected objects

Sorry for the late reply, I subscribe to the post but didn’t receive an email.

Thank you curlybrace44, that helped me to move to the next step but now I’m stuck again! lol

In fact I’m trying to change the order of rotation to all the bones that I have selected.

so with your help, here is where I am:

  1. select bones
  2. go to edit mode
  3. get the name of the bones

but now I can’t find the way to change the rotation_mode, is it done in Edit mode or pose mode?

thank you.

Mathias.

found it…

mybone = bpy.context.object.pose.bones[‘name’]
mybone.rotation_mode = ‘YZX’

thank you again curlybrace44

Mathias.