Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

In my script I tried the following:

import bpy

arm = bpy.data.armatures.new('SomeName')
bpy.context.scene.objects.link(arm)

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?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

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('SomeName')

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

bpy.context.scene.objects.link(obj)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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