[PROBLEM] Blender Mocap Tools Error

Hi guys,

I have an issue with the Mocap addons in blender 2.66a.
The python console reports this error:

creating Directory
cleaning stuff up
Retargeting pose (Advanced Retarget)
Second pass: retargeting rott translation and clean up
Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\mocap\retarget.py”, line 400, in NLASystemInitialize
NLATracks = enduser_arm.mocapNLATracks[enduser_obj.data.active_mocap]
AttributeError: ‘NoneType’ object has no attribute ‘active_mocap’
File “C:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\mocap\retarget.py”, line 398, in NLASystemInitialize
retargeting done!

If I write:

>>> enduser_obj = bpy.context.active_object
>>> print(enduser_obj)

<bpy_struct, Object(“rig”)>

but

>>> print(enduser_obj.data.active_mocap)
AttributeError: ‘Armature’ object has no attribute ‘activeMocap’

Did something change in the Python api from 2.62 to 2.66a?

Now in Maya I wrote a tool that transfers the Mocap in to a custom rig, and even if i have a very good knowledge of Python, I don’t know the Blender Python api. If anyone could help me, I can fix the addon and share it with the community.

Anyone? Maybe i wrote in the wrong section?

Hello marcosilver2000,
I think the error is due to active object changing to the new stride bone when it is created.

This can be easily fixed adding two lines in the script retarget.py at line 286

from

bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.add()
stride_bone = bpy.context.active_object
stride_bone.name = "stride_bone"
bpy.context.scene.objects.active = act_ob

to

# get current active object in order to restore it later
act_ob = bpy.context.active_object
# create stride object
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.add()
stride_bone = bpy.context.active_object
stride_bone.name = "stride_bone"
# restore active object
bpy.context.scene.objects.active = act_ob

I have the same problem in blender 2.67! This solution not work for me :S
In blender 2.60 the addon work 100% perfect

I can’t active the addon if I change the code. Why?

The fix that pKrime sent me fixes the problem but there is something else that doesn’t work. We both are working on it :slight_smile:

Any news??

But my problem is that in blender 2.67 I can’t to do the same that in blender 2.60
In 2.60 the addon work perfect

Hello everyone:
I think I found the problem, and its easier to solve than you might expect. In the retarget.py file, in the Total retarget function, the last lines look like:


if not name in [tracks.name for tracks in end_arm.mocapNLATracks]:   
     NLATracks = end_arm.mocapNLATracks.add()
     NLATracks.name = name
    else:
        NLATracks = end_arm.mocapNLATracks[name]
    end_arm.active_mocap = name
    print("retargeting done!")

The whole problem is that the end_arm.active_mocap = name in line 555 is not properly indented.
Just change it to look like this:


if not name in [tracks.name for tracks in end_arm.mocapNLATracks]:        
        NLATracks = end_arm.mocapNLATracks.add()
        NLATracks.name = name
    else:
        NLATracks = end_arm.mocapNLATracks[name]
        end_arm.active_mocap = name
    print("retargeting done!")

And you are done.
Hope it helps someone
Cheers

I’m using bvh files from the Carnegie-Mellon site. However, when I parent the model to the armature, the model gets twisted at the knees and assorted pieces get left (see attached pic). Also, I’ve experimented with several bvh files and, for some reason, there’s DIFFERENT little pieces that get left off on each animation. When I initially downloaded this model, these pieces (mostly small things around the head, eyes, etc.) were separate objects and I joined them to the larger object. It’s not always the same pieces from bvh file to bvh file. Thanks in advance.

[ATTACH=CONFIG]264652[/ATTACH]

make sure your rig is perfectly aligned to your mesh then GO pose–>apply–>apply pose as rest. Any mesh pieces that get left behind need to be weight painted. After parenting the bone and mesh you need to import the rig and re-target again.