API

Enabling and disabling collections using the Blender Python API

We can enable and disable a collection from interaction with the scene by switching the checkbox located in the Outliner opposite the name of the desired collection. In order to do this using the Blender Python API, we need to access the collection through the View Layer of the scene on which the desired collection is located.

Getting a list of data from object properties using list comprehension

Most objects in Blender have multiple lists of data in their structure. For example, inside a “mesh” object there are list with vertices of this mesh, the list of mesh edges, and the list of mesh polygons. And in the structure of each mesh vertex there is, for example, a list with its coordinates along the X, Y and Z axes.

Creating inputs and outputs for node groups in Blender 4.0 using the Python API

In Blender 3.6 and earlier, inputs and outputs for node groups could be created by calling the new() command for the list of inputs or outputs of the node tree. In Blender 4.0, the developers made changes, and the creation of input and output sockets for node trees was moved to the “interface” object.