In continuation to the discussion to this question on Stackoverflow sambler suggested me to switch here since the questions got more Blender specific.

To sum up, I have to create a Human animation, given frame by frame 3D joint coordinates. Following the answer to my previous post, this is what I have done ->

  1. Opened blender and deleted all the already present objects in it.
  2. Created a new empty and named in 'myrig'
  3. Ran the following code ->

    import csv
    import numpy as np
    import bpy
    mocap_data = {} # The mocapdata dictionary is properly created here, I checked that
    scn = bpy.context.scene
    objs = bpy.data.objects
    rig = objs['myrig']
    for m in mocap_data.keys():
        o = objs.new(m, None)
        c = rig.pose.bones[m].constraints.new('CHILD_OF') # Line 34
        c.target = o

I got the following error,

In line 34 - AttributeError: 'NoneType' object has no attribute 'bones'

What went wrong? As I said in previous post, sorry for not understanding every aspect of the code but I am on a deadline right now. Thanks for the help.


1 Answer 1


You start with a blend file that contains a mesh which defines the appearance of your character. You then have an armature, which is made up of a collection of bones that deforms your character mesh. The armature is then used by an animator to control the position of the character during an animation.

The script you have takes a pre-recorded list of locations and automates the animation of the armature instead of someone manually animating it.

The line rig = objs['myrig'] is referring to the armature named 'myrig' that you have setup to deform your character, this needs to be an armature with bones matching the names in your mocap data, not an empty.

  • $\begingroup$ is there somewhere from where I can download a standard premade 'armature' for a human body? Nothing too fancy, just a simple armature and the mesh around it and the rig, on which I can run the above code. I am assuming such a file can be downloaded and then opened in blender. Do you know where can I find one? $\endgroup$ Nov 13, 2018 at 9:21
  • $\begingroup$ For a rig and mesh, you can find some on blendswap and cgcookie has a few rigged characters available or to make something more to your needs there is ManuelBastioniLab and Makehuman. $\endgroup$
    – sambler
    Nov 13, 2018 at 20:40

You must log in to answer this question.

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