4
$\begingroup$

I'm trying to make a chain of "segments", meaning I have 3 bones in a setup and I'd like to replicate them along the z-axis. I use a for loop to duplicate the entire armature, my object and then rename the bones of each segment. Which works best for vertex groups assignment.

I then use CtrlJ to join the meshes as well as the armatures. When I go into Edit Mode for the mesh, I can just use Remove Doubles to connect the pieces, but here is my problem:

When I join the armatures, I have a chain of bones that are not parented, so I was trying to find a method that does something like this:

for bone in arm.pose.bones:
  i += 1 
  bone[i].parent = bone[i-1]

(pseudocode, but I hope you know what I mean)

But bone parent is read-only and the ops.pose.parent_set() only works if there is an active bone, but I could not figure out how to change the active bone. bone.select seems to always be True, so I'm not entirely sure how to us the ops. I hope there is a better way, like with objects, where you can just assign your parent object/bone.

$\endgroup$

1 Answer 1

4
$\begingroup$

Parenting is done in edit mode where you setup the armature.

arm.pose.bones already indicates it is related to posing bones.

Try:

arm.data.edit_bones['yourBone'].parent = arm.data.edit_bones['parentBone']
$\endgroup$
1
  • $\begingroup$ Thanks for your quick reply, I didn't get that edit_bones was a collection, I thought it was a method and didn't look into it deep enough, so thanks. $\endgroup$
    – Spiderguy
    Commented Feb 18, 2014 at 8:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .