In my script I tried the following:

import bpy

arm = bpy.data.armatures.new('SomeName')

and I get the error:

TypeError: bpy_prop_collection[key] = value: invalid, expected a 'Object' type or None, not a 'Armature'

How do I link an armature created with .new() to a scene?


Blender has the concept of:

  • Scene: Reference Objects
  • Objects: Reference Object Data (Mesh, Armature, Lamp. etc)

This is needed so you can (for example) have many instances of the same mesh, which saves memory and allows you to edit without having to manually update copies.

Here is the script modified to work as expected.

import bpy

arm = bpy.data.armatures.new("My Rig")

# create an object
obj = bpy.data.objects.new("My Object", arm)


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.