In Blender 2.79 Python API we can add a new object to a scene with:
1 |
bpy.context.scene.objects.link(new_object) |
If we try to do this in Blender 2.80, it throws an error:
‘bpy_prop_collection’ object has no attribute ‘link’
In Blender 2.80 API new objects mast be linked not to the scene, but to the scene collections:
To link a new object to the active scene collection:
1 |
bpy.context.scene.collection.objects.link(new_object) |
To link a new object to the collection by its name:
1 |
bpy.data.collections['collection_name'].objects.link(new_object) |
Gracias…….. familia blender
you can also assign object to a scene without using context, by:
Yes. Thank you!