﻿WEBVTT

00:00:00.800 --> 00:00:02.680
Hello and welcome to another epidose of

00:00:02.680 --> 00:00:04.920
Scripting for Artists. My name is Sybren.

00:00:04.920 --> 00:00:06.800
This episode is about Blender Collections.

00:00:08.040 --> 00:00:10.200
These were introduced in Blender 2.8

00:00:10.200 --> 00:00:12.120
and replaced the numbered Scene Layers and Groups.

00:00:13.560 --> 00:00:15.200
I'm not recording this as usual at the Blender Institute,

00:00:15.200 --> 00:00:17.320
but I'm home right now, as so many of you.

00:00:19.040 --> 00:00:21.320
As a result, the video will be less scripted

00:00:21.320 --> 00:00:23.560
and I won't have any slides to show.

00:00:24.200 --> 00:00:26.320
We'll just dive into Blender

00:00:26.320 --> 00:00:27.440
and I will show things there.

00:00:28.680 --> 00:00:30.680
So in the Outliner here, you can see that

00:00:30.680 --> 00:00:32.320
we have a Scene Collection

00:00:32.680 --> 00:00:34.680
with Suzanne in it, like one object,

00:00:35.040 --> 00:00:36.320
and it has that default collection,

00:00:36.320 --> 00:00:37.120
Collection One.

00:00:37.680 --> 00:00:40.680
So given that, this thing here is called

00:00:40.680 --> 00:00:41.680
the Scene Collection,

00:00:42.000 --> 00:00:44.560
let's look at the scene object

00:00:44.560 --> 00:00:46.320
and see if we can find a Collection property.

00:00:48.800 --> 00:00:49.920
Here we have Suzanne.

00:00:50.560 --> 00:00:52.120
As a reminder,

00:00:52.120 --> 00:00:53.320
here we have the Convenience Variables.

00:00:53.680 --> 00:00:56.120
So capital C stand for "bpy.context"

00:00:56.120 --> 00:00:58.320
and capital D stands for :bpy.data".

00:00:59.920 --> 00:01:02.120
You can't use these in your own script,

00:01:02.120 --> 00:01:03.920
but you can use them here in the console

00:01:03.920 --> 00:01:05.800
while you're figuring things out.

00:01:05.800 --> 00:01:07.440
Let's take a look at

00:01:08.680 --> 00:01:09.000
"C.scene.collection"

00:01:09.320 --> 00:01:11.120
then press Tab,

00:01:11.920 --> 00:01:13.200
and you can see,

00:01:13.200 --> 00:01:14.560
it already has a Collection property.

00:01:16.320 --> 00:01:18.560
We can get its name, is called Master Collection

00:01:18.560 --> 00:01:20.320
because

00:01:20.320 --> 00:01:21.560
 it's the main scene collection.

00:01:24.000 --> 00:01:25.800
And it has a

00:01:26.440 --> 00:01:27.920
property called Objects.

00:01:28.680 --> 00:01:30.120
If you convert that to a List,

00:01:30.440 --> 00:01:33.120
just arrow up and then type List

00:01:33.120 --> 00:01:33.920
with parentheses around the line,

00:01:36.320 --> 00:01:38.440
and there you can see that one object,

00:01:38.440 --> 00:01:39.920
Suzanne, that was here.

00:01:40.800 --> 00:01:43.040
"collection.objects" gives you all the objects

00:01:43.040 --> 00:01:45.200
that are directly linked into that Collection.

00:01:47.120 --> 00:01:48.920
So, let's see what happens

00:01:48.920 --> 00:01:50.680
when we move Suzanne into Collection One.

00:01:51.000 --> 00:01:53.000
It's still indirectly inside the Scene Collection

00:01:53.000 --> 00:01:55.040
because it's inside Collection One,

00:01:55.040 --> 00:01:56.920
and Collection one is inside the Scene Collection,

00:01:58.040 --> 00:02:00.200
but it's no longer in the "scene collection.object".

00:02:03.200 --> 00:02:05.560
If you want to have really everything,

00:02:05.560 --> 00:02:08.200
then look at "all_objects".

00:02:08.560 --> 00:02:10.920
This is like a magical view

00:02:10.920 --> 00:02:12.320
that will give you everything in the Collection itself.

00:02:12.680 --> 00:02:14.440
So it contains everything that Object also contains,

00:02:17.120 --> 00:02:19.000
but then it also contains everything that

00:02:19.000 --> 00:02:21.320
is inside collections in the collection

00:02:21.320 --> 00:02:23.040
and the collection in the collection and....

00:02:24.560 --> 00:02:26.120
And as you can see, we have Suzanne.

00:02:28.000 --> 00:02:30.120
So as many things in Blender collections

00:02:30.120 --> 00:02:32.560
have to have a unique name,

00:02:32.560 --> 00:02:36.200
because they are stored in data.

00:02:36.200 --> 00:02:38.800
So we have "bpy.data" or in the console

00:02:39.320 --> 00:02:40.440
"D.collections",

00:02:41.040 --> 00:02:43.000
and this gives us the Collection One.

00:02:43.000 --> 00:02:45.200
It does not contain the Scene Master Collection,

00:02:45.200 --> 00:02:47.040
but it contains all the other collections.

00:02:48.560 --> 00:02:51.320
So here we also can get

00:02:51.320 --> 00:02:52.320
"D.collections("Collection 1").objects"

00:02:54.000 --> 00:02:54.680
and

00:02:55.320 --> 00:02:57.200
convert it to a list to see what's in there.

00:02:57.200 --> 00:02:58.800
And again, of course there is Suzanne in there.

00:02:59.920 --> 00:03:01.920
So this already gives you a way to,

00:03:02.120 --> 00:03:03.800
given the name of a collection,

00:03:04.120 --> 00:03:06.800
iterate over all the objects in that Collection.

00:03:06.800 --> 00:03:08.200
So maybe you want to write an exporter

00:03:08.200 --> 00:03:09.800
that exports

00:03:10.000 --> 00:03:12.000
everything in one particular collection,

00:03:12.560 --> 00:03:14.040
now you know how to access it.

00:03:16.920 --> 00:03:19.560
And I'm saying iterate over the objects,

00:03:19.920 --> 00:03:21.680
let's just take a look at how that would happen

00:03:21.680 --> 00:03:23.320
just to refresh your memory.

00:03:23.680 --> 00:03:25.440
Let's say we have a nice little

00:03:25.440 --> 00:03:27.800
Bohemian Rhapsody going on here

00:03:28.920 --> 00:03:30.800
with four Suzanne in that one Collection.

00:03:31.680 --> 00:03:32.320
If we say

00:03:32.920 --> 00:03:34.920
"list collection.objects",

00:03:34.920 --> 00:03:36.200
then we get all four of them.

00:03:37.680 --> 00:03:39.200
Let's see how it would look like

00:03:39.200 --> 00:03:42.120
in a little more complex code.

00:03:42.560 --> 00:03:45.320
You would basically say

00:03:45.320 --> 00:03:48.040
"coll=D.collections("collection 1")

00:03:52.120 --> 00:03:54.040
and then I can say

00:03:54.560 --> 00:03:55.320
"for ob in coll.objects:

00:03:55.920 --> 00:03:57.560
print("OB name is:(ob.name)")

00:04:04.920 --> 00:04:06.560
And this is a format string, it's really useful.

00:04:07.800 --> 00:04:09.920
 You can just type an F before the opening quotes,

00:04:11.680 --> 00:04:13.920
and then within curly braces,

00:04:13.920 --> 00:04:16.200
you can write any expression like "ob.name".

00:04:19.200 --> 00:04:20.440
And what you can see here,

00:04:23.440 --> 00:04:25.680
it lists all the names of all the object.

00:04:25.680 --> 00:04:27.440
So it loops with the Forloop

00:04:27.440 --> 00:04:29.120
that loops over all the objects in the collection,

00:04:29.440 --> 00:04:31.200
and then does something with it.

00:04:31.200 --> 00:04:33.440
This could be calling an exporter,

00:04:33.440 --> 00:04:34.200
or this could be setting a marterial,

00:04:34.680 --> 00:04:37.040
or it could be changing the name,

00:04:37.040 --> 00:04:38.680
or whatever you want to do of course.

00:04:39.920 --> 00:04:42.680
In our case, it just prints the name.

00:04:45.040 --> 00:04:46.920
So let's take a look at creating a collection from Python.

00:04:48.560 --> 00:04:51.200
This is also done through the "data.collections" collection.

00:04:53.320 --> 00:04:53.800
So

00:04:54.800 --> 00:04:56.800
"D.collections",

00:04:57.000 --> 00:04:59.120
let's take a look, what do we have, a new function.

00:05:00.120 --> 00:05:02.320
So let's type

00:05:02.680 --> 00:05:03.200
"D.collections.new" tab,

00:05:03.560 --> 00:05:05.560
and you can see that you can type "name",

00:05:08.000 --> 00:05:09.560
and now we have a new collection called "demo".

00:05:11.920 --> 00:05:13.440
You want to use this collection

00:05:13.440 --> 00:05:14.680
as it's given to you, because,

00:05:15.800 --> 00:05:17.000
of course, this is now available at the

00:05:17.440 --> 00:05:20.040
"bpy.data.collections("demo")".

00:05:25.040 --> 00:05:26.680
This happens to the best of us.

00:05:26.680 --> 00:05:28.800
Everybody makes typos. Don't worry about it.

00:05:30.560 --> 00:05:33.000
Given the name "demo",

00:05:33.000 --> 00:05:34.040
we can get the Collection agian.

00:05:34.440 --> 00:05:37.440
And this is a big big pitfall that

00:05:37.440 --> 00:05:39.920
you could fall into, because you may think that

00:05:39.920 --> 00:05:41.440
that Collection you just created

00:05:41.440 --> 00:05:43.040
with an m demo

00:05:43.320 --> 00:05:45.120
will have the m demo.

00:05:45.440 --> 00:05:47.120
Let's take a look at what happens

00:05:47.120 --> 00:05:47.920
when we do it again.

00:05:48.120 --> 00:05:50.440
Exactly the same function call,

00:05:50.440 --> 00:05:52.000
just telling Blender to make me

00:05:52.000 --> 00:05:53.200
a new collection called Demo.

00:05:53.920 --> 00:05:55.680
But this time, we already have a collection

00:05:55.680 --> 00:05:57.200
called Demo. And as I said,

00:05:57.200 --> 00:05:59.320
collections have to have a unique name.

00:06:00.120 --> 00:06:02.320
So what happens is that, it calls a "demo.001",

00:06:02.320 --> 00:06:04.800
actually use from Blender.

00:06:06.120 --> 00:06:08.560
But now the name we asked Blender

00:06:08.560 --> 00:06:10.440
to give the collection is not the same

00:06:10.440 --> 00:06:12.440
as the name the collection was given.

00:06:12.920 --> 00:06:14.800
So if you now access

00:06:17.000 --> 00:06:19.040
"bpy.data.collection("demo")",

00:06:20.040 --> 00:06:22.200
you will see that you get "demo", of course

00:06:22.200 --> 00:06:24.040
and not "demo.001".

00:06:24.800 --> 00:06:27.040
So what I would say is,

00:06:27.040 --> 00:06:29.040
when you create a new collection,

00:06:29.040 --> 00:06:29.440
always assign it to a name

00:06:32.040 --> 00:06:32.800
like this.

00:06:35.200 --> 00:06:36.680
And then you're sure that

00:06:36.680 --> 00:06:37.440
you have the right collection.

00:06:39.320 --> 00:06:40.920
Afterwards you can change the name,

00:06:46.120 --> 00:06:47.560
like "collections.name="sfa""

00:06:50.200 --> 00:06:51.560
and it will have the new name.

00:06:53.920 --> 00:06:56.440
One thing you may notice in the Outliner

00:06:56.440 --> 00:06:57.000
up here,

00:06:58.120 --> 00:06:59.000
is that,

00:06:59.560 --> 00:07:00.560
the name isn't there,

00:07:01.040 --> 00:07:02.920
like the collection is not there yet.

00:07:03.120 --> 00:07:05.320
So it exists in the Blend file,

00:07:05.320 --> 00:07:06.440
it exists in memory,

00:07:07.040 --> 00:07:09.200
but it's not linked to the

00:07:09.200 --> 00:07:10.120
Scene Master Collection yet.

00:07:11.320 --> 00:07:12.800
So how do we do that?

00:07:14.560 --> 00:07:16.040
You go to the Master Collection,

00:07:17.680 --> 00:07:20.040
and then "dot and tab" to just get

00:07:20.040 --> 00:07:21.440
a list of everything in there.

00:07:25.920 --> 00:07:28.200
One thing you'll notice is this property

00:07:28.200 --> 00:07:29.320
called Children.

00:07:30.000 --> 00:07:32.040
That contains all the Child collection.

00:07:32.200 --> 00:07:34.320
That's all the collections

00:07:34.320 --> 00:07:36.120
that are linked into this collection.

00:07:37.920 --> 00:07:39.000
So, let's take a look there.

00:07:43.320 --> 00:07:45.000
There you find a function called Link.

00:07:46.680 --> 00:07:49.800
At this collection as a child of this collection,

00:07:50.440 --> 00:07:52.800
it's a bit cryptic, two times this collection

00:07:52.800 --> 00:07:54.120
referring to different things,

00:07:54.120 --> 00:07:55.440
but I think you get the gist.

00:07:55.920 --> 00:07:59.040
We had our collection in the name Collection.

00:07:59.040 --> 00:08:03.320
So keep your eyes on the Outliner

00:08:03.320 --> 00:08:06.320
while I press enter. There we go.

00:08:06.320 --> 00:08:09.040
And now it is part of the Scene Collection.

00:08:09.040 --> 00:08:12.320
Linking objects into this new collection

00:08:12.320 --> 00:08:14.040
is pretty much the same thing

00:08:14.040 --> 00:08:15.800
as linking other collections into it.

00:08:15.800 --> 00:08:18.320
Instead of using ".children.link",

00:08:18.320 --> 00:08:20.200
you used ".object.link".

00:08:21.680 --> 00:08:23.560
So let's take a look. We have our collection.

00:08:26.440 --> 00:08:27.200
It has

00:08:28.040 --> 00:08:28.800
an empty set of objects.

00:08:30.000 --> 00:08:31.560
Nothing is in there.

00:08:36.200 --> 00:08:38.680
And we can use ".object.Link"

00:08:38.680 --> 00:08:39.920
to link an object to it.

00:08:45.800 --> 00:08:46.560
And like that,

00:08:47.040 --> 00:08:49.680
we can add Suzanne.003 to it.

00:08:49.680 --> 00:08:52.040
Let's put this into a bit more of a script.

00:08:53.200 --> 00:08:55.800
So I'm going to subdivide here,

00:08:56.440 --> 00:08:57.680
change to Text Editor,

00:08:59.680 --> 00:09:01.800
creat your script, call it

00:09:03.200 --> 00:09:06.000
"move stuff.py",

00:09:08.000 --> 00:09:09.680
always start with "bpy".

00:09:10.800 --> 00:09:12.680
Now let's say we want to move

00:09:12.680 --> 00:09:15.000
everything that is inside one collection

00:09:15.000 --> 00:09:16.440
and move it into another.

00:09:17.200 --> 00:09:19.680
So we have to have a

00:09:20.920 --> 00:09:23.000
"coll_from=bpy.data.collections("collection 1")"

00:09:26.320 --> 00:09:28.560
and we have something similar,

00:09:31.120 --> 00:09:33.200
"coll_to=bpy.data.collections("SFA")".

00:09:35.440 --> 00:09:37.000
So now we have our two collections,

00:09:37.320 --> 00:09:40.000
let's loop over 1 and then add all the objects

00:09:40.000 --> 00:09:42.040
that we find into the other.

00:09:42.680 --> 00:09:44.320
So "for ob in coll_from.object:

00:09:44.680 --> 00:09:46.000
coll_to.objects.Link(ob)",

00:09:53.320 --> 00:09:54.680
and this will already

00:09:56.800 --> 00:09:58.320
link all the objects from one collection

00:09:58.320 --> 00:09:58.800
into the other.

00:09:59.680 --> 00:10:03.040
What's left to move, is to unlink

00:10:03.040 --> 00:10:03.800
from the other collection.

00:10:04.200 --> 00:10:06.320
So we need to unlink from "coll from".

00:10:06.920 --> 00:10:09.120
but that also means removing that object

00:10:09.120 --> 00:10:11.040
from "coll_from.objects".

00:10:12.200 --> 00:10:14.680
So that means that by unlinking,

00:10:14.680 --> 00:10:16.200
we're changing that thing

00:10:16.200 --> 00:10:17.000
that we're looping over currently.

00:10:17.560 --> 00:10:19.200
This is not a good idea.

00:10:19.200 --> 00:10:20.120
You shouldn't do this.

00:10:20.920 --> 00:10:22.040
At best it will be unpredictable.

00:10:24.560 --> 00:10:26.320
At worst it will crash Blender,

00:10:26.320 --> 00:10:27.120
and you will lose your data.

00:10:28.440 --> 00:10:31.440
The most simple solution for this,

00:10:31.440 --> 00:10:33.320
there's many of them, but the simplest

00:10:33.320 --> 00:10:35.560
is to keep track of the objects

00:10:35.560 --> 00:10:36.320
that you want to unlink.

00:10:36.800 --> 00:10:40.000
So let's say to unlink is an empty list.

00:10:40.800 --> 00:10:43.000
And in this list, we will keep track

00:10:43.000 --> 00:10:44.680
of whatever we want to unlink later.

00:10:45.120 --> 00:10:46.000
So we can say,

00:10:46.320 --> 00:10:47.920
"to unlink.append(ob)"

00:10:51.560 --> 00:10:53.120
And once this Forloop is done,

00:10:53.920 --> 00:10:54.680
we can

00:10:55.560 --> 00:10:57.920
unloop over this and unlink everything.

00:10:57.920 --> 00:11:00.320
So "for ob in to unlink",

00:11:03.000 --> 00:11:05.320
"coll_from.objects.unlink(ob)",

00:11:08.680 --> 00:11:09.680
and this will work.

00:11:10.320 --> 00:11:11.320
Let's give it a try.

00:11:17.320 --> 00:11:19.120
My script field, of course,

00:11:20.560 --> 00:11:22.000
let's take a look at the console.

00:11:23.560 --> 00:11:25.440
If we look at the terminal

00:11:25.440 --> 00:11:26.200
from which I started Blender,

00:11:26.680 --> 00:11:28.920
you can see that it gives me a runtime error,

00:11:28.920 --> 00:11:32.000
Objects Suzanne .003

00:11:32.000 --> 00:11:33.120
already in collection SFA.

00:11:33.920 --> 00:11:34.800
Fair enough.

00:11:35.120 --> 00:11:37.000
It doesn't like us linking an object

00:11:37.000 --> 00:11:38.560
that is already in there.

00:11:39.920 --> 00:11:42.560
There's basically two ways

00:11:42.560 --> 00:11:43.200
to avoid your script breaking

00:11:43.920 --> 00:11:45.560
because of an error like this.

00:11:46.680 --> 00:11:49.000
One is to avoid the error to begin with,

00:11:49.000 --> 00:11:51.680
the other is to handle the error when it occurs.

00:11:51.680 --> 00:11:54.040
I think in this case,

00:11:54.040 --> 00:11:57.000
it's easiest to just catch the error and make sure

00:11:57.000 --> 00:11:58.920
our script keeps running when that happens.

00:11:58.920 --> 00:12:02.120
The error says that line #8 is the problem.

00:12:02.120 --> 00:12:04.200
So let's take a look at line #8.

00:12:06.680 --> 00:12:09.560
So line 8 is this line in the code.

00:12:09.560 --> 00:12:12.440
It's delinking itself,

00:12:12.440 --> 00:12:12.920
of course, that goes wrong.

00:12:13.560 --> 00:12:16.560
You can tell Python to

00:12:16.560 --> 00:12:19.000
give this line a try and see what happens.

00:12:20.680 --> 00:12:21.920
Literally you say try,

00:12:22.440 --> 00:12:24.920
and then a colon, and like the "Forloop",

00:12:24.920 --> 00:12:26.560
and the "If",and the other things we've seen,

00:12:26.560 --> 00:12:28.200
and in a column,

00:12:28.200 --> 00:12:29.320
you have to indent the rest.

00:12:30.000 --> 00:12:32.800
That indicate what it needs to try.

00:12:34.440 --> 00:12:36.560
And then when we look at the terminal,

00:12:36.560 --> 00:12:37.440
we saw the

00:12:37.800 --> 00:12:38.800
runtime error

00:12:39.560 --> 00:12:41.040
that is right over here.

00:12:42.440 --> 00:12:45.000
That is the type of the exception.

00:12:45.000 --> 00:12:47.000
I won't go into detail as to what it all means.

00:12:48.560 --> 00:12:49.800
Just know that

00:12:50.000 --> 00:12:51.320
you have to type it here.

00:12:51.680 --> 00:12:53.200
So that Python knows that,

00:12:55.200 --> 00:12:58.560
if an exception occurs in this try block,

00:13:00.040 --> 00:13:00.800
of this type,

00:13:02.200 --> 00:13:04.200
then execute this code over here.

00:13:05.120 --> 00:13:06.800
And in our case, this is fine.

00:13:07.120 --> 00:13:08.680
This happens

00:13:09.040 --> 00:13:10.920
when the object is already in the collection,

00:13:11.440 --> 00:13:13.320
which means that we're happy

00:13:13.320 --> 00:13:14.920
because we wanted to link it there, it already is there,

00:13:14.920 --> 00:13:16.680
so it is all fine, so we can let this pass,

00:13:16.680 --> 00:13:20.000
which literally means just type "pass" there.

00:13:20.000 --> 00:13:22.120
This tells Python,

00:13:22.560 --> 00:13:24.800
don't do anything here, ignore the error,

00:13:25.000 --> 00:13:26.120
nothing happened, really.

00:13:27.800 --> 00:13:28.560
The next line is,

00:13:29.560 --> 00:13:31.560
of course, still important.

00:13:31.560 --> 00:13:33.440
Because we still want to handle this

00:13:33.440 --> 00:13:34.800
althuogh the object moved.

00:13:35.560 --> 00:13:37.120
The linking went bad because it was already there.

00:13:37.120 --> 00:13:38.920
It still needs to be unlinked

00:13:38.920 --> 00:13:40.680
from the original collection,

00:13:40.680 --> 00:13:42.120
so we can just keep going.

00:13:42.440 --> 00:13:44.120
And this should fix our code.

00:13:46.440 --> 00:13:47.320
Let's give it a try.

00:13:49.120 --> 00:13:50.200
And there we have it,

00:13:50.800 --> 00:13:52.040
all the objects have been

00:13:52.200 --> 00:13:53.440
moved into SFA,

00:13:53.920 --> 00:13:55.560
have been taken away from Collection.

00:13:57.560 --> 00:13:59.320
And of course, we can do the opposite.

00:13:59.320 --> 00:14:00.440
We can say,

00:14:03.680 --> 00:14:05.320
flip the names around, run the script again.

00:14:06.440 --> 00:14:07.200
And they're back again

00:14:07.680 --> 00:14:09.320
where they started.

00:14:10.120 --> 00:14:12.800
So this is how you can move objects

00:14:12.800 --> 00:14:13.440
between Collections.

00:14:15.040 --> 00:14:17.440
One final thing we could do,

00:14:17.920 --> 00:14:20.000
which maybe is a little bit useless,

00:14:20.000 --> 00:14:20.800
Bbt just to give a demo.

00:14:22.040 --> 00:14:24.000
We can also remove the collection

00:14:24.000 --> 00:14:26.040
that we moved everything from.

00:14:26.040 --> 00:14:27.680
That would be

00:14:28.320 --> 00:14:29.800
"bpy.data.collections.remove(coll_from)",

00:14:38.560 --> 00:14:41.680
let's flip them around again.

00:14:41.680 --> 00:14:43.120
We moved all the objects from collection 1 to SFA.

00:14:44.120 --> 00:14:46.120
And then once that is done, we remove the Collection.

00:14:48.120 --> 00:14:49.040
And there we go.

00:14:49.200 --> 00:14:51.000
Now Collection 1 is gone.

00:14:51.920 --> 00:14:53.200
All the objects have been moved again.

00:14:53.800 --> 00:14:55.120
And that's how you work with collections

00:14:55.120 --> 00:14:55.920
from Python.

00:14:56.320 --> 00:14:58.000
To end this episode,

00:14:58.320 --> 00:15:00.560
let's take another look at the Outliner.

00:15:02.000 --> 00:15:04.000
There are a few toggles you can set,

00:15:04.000 --> 00:15:06.000
like the Restriction toggles.

00:15:06.000 --> 00:15:08.800
Let's take a look. If I want to change

00:15:09.560 --> 00:15:11.920
the viewport rendering of this collection,

00:15:12.320 --> 00:15:14.440
you can see in the Points and Tooltip

00:15:14.440 --> 00:15:16.320
which you can enable in the User Preferences,

00:15:16.320 --> 00:15:17.120
can see that

00:15:18.000 --> 00:15:20.560
"bpy.data.collection.SFA.hide viewport"

00:15:20.560 --> 00:15:22.800
is that thing to go to.

00:15:23.320 --> 00:15:25.120
Let's take a look there.

00:15:25.120 --> 00:15:25.680
We take "bpy.data.collections(SFA).hide)",

00:15:30.440 --> 00:15:32.800
there we already have,

00:15:32.800 --> 00:15:34.120
Hide Render, Hide Select, Hide Viewport.

00:15:37.680 --> 00:15:39.320
And you can just set them to "True",

00:15:40.800 --> 00:15:41.800
back to "False",

00:15:42.560 --> 00:15:44.000
and you can play around with this.

00:15:46.440 --> 00:15:48.200
And it pretty much does what you would expect

00:15:48.200 --> 00:15:50.040
from clicking on the icons.

00:15:50.920 --> 00:15:52.680
So that's it.

00:15:52.680 --> 00:15:54.120
If you have any questions, leave comments.

00:15:54.560 --> 00:15:56.000
I'll see you in the next episode.