1
$\begingroup$

I created a rig from a motion capture in MotionBuilder 2012. It's just a simple rig with a few motion tracks and now I want to do the rest of the work in Blender 2.72, but have problems with the rig representation in Edit mode.

I exported a BVH file in MotionBuilder and imported it into Blender and all motions are correct and look like expected. In Pose mode the rig has the expected T shape in the first key frame and all other key frames look correct, too. However, when I go into Edit mode the shoulders and arms, as well as the neck and the head, point straight down. Additionally, the whole rig is rotated by 90° around the X axis. It is unclear to me why I see this behavior in Edit mode.

Here you can get the BLEND file that illustrates the problem. In that "wrong" Edit mode position I can't skin the rig and if I try to put it in form the new angles influence the movements.

Do you know a better way to get the rig in Blender?

$\endgroup$
1
$\begingroup$

Re target copy rig with new rest pose.


Similarly to this answer,

Select rig, and run the following script (takes a minute-ish). You will get a new copy rig, with rest pose the same as the T-pose in frame 1 of original, and animation adjusted to fit new rest pose.

import bpy
from bpy import context

remove_constraints = True
scene = context.scene
scene.frame_set(1) # TPOSE frame
rig1 = context.object
# copy the rig and armature
rig2 = rig1.copy()
rig2.data = rig2.data.copy()
scene.objects.link(rig2)
scene.objects.active = rig2
bpy.ops.object.mode_set(mode='POSE')
# apply the pose in frame 1
bpy.ops.pose.armature_apply()
if not rig2.animation_data:
    rig2.animation_data_create()
# remove animation from dupe
rig2.animation_data.action = None
# add copy transform constraint to each bone
for pb in rig2.pose.bones:
    ct = pb.constraints.get(pb.name)    
    if ct is not None:
        ct.influence = 1
        continue
    ct = pb.constraints.new('COPY_TRANSFORMS')
    ct.name = pb.name
    ct.target = rig1
    ct.subtarget = pb.name

action = rig1.animation_data.action
f = action.frame_range.x
# add a keyframe to each frame of new rig
while f < action.frame_range.y:
    scene.frame_set(f)
    for pb in rig2.pose.bones:
        #pb2 = rig1.pose.bones.get(pb.name)
        m = rig2.convert_space(pb, pb.matrix, to_space='LOCAL')
        if pb.rotation_mode == 'QUATERNION':
            pb.rotation_quaternion = m.to_quaternion()
            pb.keyframe_insert("rotation_quaternion", frame=f)
        else:

        # add rot mode checking 
            pb.rotation_euler = m.to_euler(pb.rotation_mode)
            pb.keyframe_insert("rotation_euler", frame=f)
        pb.location = m.to_translation()

        pb.keyframe_insert("location", frame=f)
    f += 1

# set constraints to zero or remove entirely.
for pb in rig2.pose.bones:
    ct = pb.constraints.get(pb.name)    
    if ct is not None:
        if remove_constraints:
            pb.constraints.remove(ct)
        else:
            ct.influence = 0
$\endgroup$
  • $\begingroup$ Good one. feel free to upvote too 8^)... $\endgroup$ – batFINGER Oct 8 '17 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.