Page 1 of 1

How to extrude (with x axis mirror) head of armature

Posted: Sun May 06, 2012 10:21 am
by wretch1958
If I have an armature:
bpy.data.armatures["Armature"]
which consists of a chain of bones:
Bone->Bone.001->Bone.002

How do I get to the various bones in the armature. For example, how would I get to the middle bone (Bone.002), select the head of that bone, and extrude another bone from the head of Bone.002?
All I see when I list
bpy.data.armatures["Armature"].bones
is
...bones["Bone"]
how do I get to Bone.002 etc...

Posted: Sun May 06, 2012 8:51 pm
by CoDEmanX
bpy.data.armatures['Armature'].bones['Bone.002']

if you just added it, switch from edit to object mode or it will not exist!

You can also use children / parent properties, in console for testing e.g.:
bpy.data.armatures['Armature'].bones['Bone'].children[:]

Posted: Mon May 07, 2012 9:46 am
by wretch1958
2 more related questions:

It sounds like EDIT mode maybe makes a copy of actual mesh data and all modifications are to the copy until switching back out of EDIT mode? Is there any good documentation which explains this process?

If I extrude a seoncd bone "Bone2" from the head of "Bone" they are at the same level, so cannot get from one to the other with parent /child relationship, yet they are related (siblings). Is there any way to see the "siblings" of a bone (other bones extruded from the head of that bone)?

Posted: Mon May 07, 2012 10:25 am
by CoDEmanX
http://www.blender.org/documentation/bl ... bone-bones

no, there's no easy way to determine "siblings" for your special case, you should add a parent for them. Otherwise you have 3 root bones, which can't even be connected, if you select and grab one of the root bones, they will move without affecting the other root bones. So there is in fact no relationship. You could walk through all bones via script and check the head/tail locations and infer the relationship "sibling", but would work only if the root heads remained in same location.