1
$\begingroup$

I have a hair rig with a lot of bone chains in a single armature. The bone chains are curved in their rest pose, matching the hair curving down around the character's head. I want to straighten out all the bone chains and save it as a new pose. The problem is that rest pose is already seen as 0,0,0 for rotation. How can I straighten these bone chains?

$\endgroup$
1
$\begingroup$

Script to align child edit bones to the selected edit bone. (The base of hair bones) To use: have your rig in edit mode, and the desired base bone(s) of hair bone chains selected.. As with all scripts save first.

import bpy
context = bpy.context
for eb in context.selected_editable_bones:
    parent = eb        
    v = (eb.tail - eb.head).normalized()

    while len(parent.children):
        bone = parent.children[0]
        bone.head = parent.tail
        bone.tail = parent.tail + bone.length * v
        parent = bone
$\endgroup$
1
$\begingroup$

One option to do that would be to use Auto IK, which is located in 3D Viewport > Toolshelf > Options tab (use T to toggle open/close the Toolshelf). When Auto IK is turned on, you can select last bone of the chain and pull it straight to any direction you want.

Alternatively (necessary if your hair chains are directly connected to head), you could use IK Solvers. In Pose Mode, select the last bone of the chain, key Shift + I, select To New Empty, and in the Properties panel > Bone Constraints tab, set the chain length to the right amount of bones. Then, you can use the empty object created earlier to pull the chain straight.

$\endgroup$
1
$\begingroup$

To align bones regardless of parenting you can temporarily add a copy rotation constraint for each bone, then apply the visual transform by selecting the bone and clicking CTRL+A > Apply visual transform to pose and CTRL+A again > Apply pose as rest posefor it to take effect in the edit mode as well, then you can delete the copy rotation constraint.

$\endgroup$
  • $\begingroup$ Not sure what you are implying re "If don't want to mess with your bones parenting""??? Neither of the other answers change bone hierarchy $\endgroup$ – batFINGER Mar 1 at 20:56
  • $\begingroup$ I meant that your script required that the bones be parented to the bone you want them to be aligned to, in my situation that wasn't the case. anyways, I can delete my answer if it will confuse anyone, since the script solution had nailed it already. $\endgroup$ – Ahmed Ali Mar 8 at 15:56
  • $\begingroup$ NP, . Def. no need to remove answer. Little confusing to me, as bone chain implies parenting Was seeking clarification To align bones regardless of parenting maybe? $\endgroup$ – batFINGER Mar 8 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.