Support Blender Core Development with a monthly contribution.
The creators who share. Access production content and knowledge from the Open Movies.
Latest news and updates on Blender development.
Join the community and help with design, development, docs and more.
A platform to collect and display the Blender Benchmark results.
Documentation on Blender's features, tools and API.
The yearly event that brings together the Blender community in one place.
Download the latest Blender version, or try the beta!
Introduction & copy-pasting
Names & Objects
Stuff on Lists
Collections: Mass-Rename of Objects
For vs. While
Your Own Operator
From Script to Add-on
Roast my Add-on
The Roast of Nature Clicker
Readability & Understandability
Render 10,000 OBJ files
Mass-Rename Bones & Vertex Groups
Rendering from 'all' angles
26th March 2020
Collections! Blender 2.80 replaced groups and scene layers with collections. In this chapter of Scripting for Artists, Sybren explains how to handle them from your scripts.
Join to comment publicly.
27th March 2020 - 10:19
This was very nice. Thank you!
The part about: Handling errors when they occur was cool, thanks for that.
Suggestion for a next series / addition:
Moving a collection called "apples", from collection "fruit", to a collection "lunch"
27th March 2020 - 12:46
*@Henk Kok* Moving a collection is the same as moving an object, except you use coll_from.children.unlink() and coll_to.children.link().
The link to catching an exception is covered by "Handling errors when they occur".
27th March 2020 - 12:48
*@Sybren A. Stüvel* DOH! So obvious. Thank you.
26th April 2020 - 06:40
Thanks Sybren This tutorial is really good to understand 2.8 collection too.. thanks.
hope you will teach about "scene layer" management too.. (with use bpy) ,Then I have one question about un-link.
Each scene have one "Master Collection"(Scene Collection), and we can link "Collection 1" to Master Collection. then we can link "obj1" to "Collection 1"
and Collection1 is child collection of Master Collection.
I expect, when I un-link "obj1" from "Collection1", obj1 is removed from Collection1,
but still in "Master Collection",,
But Blender remove the "obj1" from Master Collection too. then it becom orphan data.
Though I can link "obj1" to "Master Collection" later, but it seems un-necessary step.
Is there any reason,, un-link from "Collection1" (child correction of Master)
un-link from "Master correction" too?
19th August 2020 - 16:09
When I was following along, adding a new collection, the new collection was linked to whichever collection was currently selected in the Outliner. And if the selected item in the Outliner was an object (rather than a collection) the new collection was added as a child of the object.
This raises several questions, but first of which is: How do I select a specific collection using Python? I took a look through the API docs, but nothing jumped out.
19th August 2020 - 21:27
*@Ron Tarrant* I've been researching this now for the better part of a day and finding nothing. Surely there's a way to do this.
1st September 2020 - 23:46
*@Ron Tarrant* Please pop over to https://blender.chat/ and join the Python channel. It's easier to go over your code there and see what exactly you're doing.
14th September 2020 - 09:30
*@Sybren A. Stüvel* I can't find a way to switch Blender Chat to a light theme. Because of an eye condition, it's painful to read light text on a dark background. But thanks anyway.
19th August 2020 - 16:55
Can anyone tell me where the example Python scripts are, the ones that ship with Blender?
20th August 2020 - 14:37
*@Ron Tarrant* Never mind. I found them in C:\Program Files\Blender Foundation\Blender 2.83\2.83\scripts\templates_py\
20th August 2020 - 11:14
Okay, how about this... How do I make a specific collection the active collection?
20th August 2020 - 14:38
*@Ron Tarrant* Never mind. I found a solution here:
29th November 2020 - 21:36
If a collection isn't linked, does it disappear after closing Blender?
21st December 2020 - 15:04
@Leslie Solorzano Why not find out yourself? Just create a collection via Python, so that it's not linked to anything, and save & reload the file.