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

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
wretch1958
Posts: 0
Joined: Thu Mar 29, 2012 6:26 am

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

Post by wretch1958 » Sun May 06, 2012 10:21 am

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...

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Sun May 06, 2012 8:51 pm

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[:]
I'm sitting, waiting, wishing, building Blender in superstition...

wretch1958
Posts: 0
Joined: Thu Mar 29, 2012 6:26 am

Post by wretch1958 » Mon May 07, 2012 9:46 am

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)?

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Mon May 07, 2012 10:25 am

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.
I'm sitting, waiting, wishing, building Blender in superstition...

Post Reply