Operators for globally hiding objects in all project scenes

To hide an object in the 3D Viewport window for the current scene we use the “object.hide_view_set” operator, which calls when we clicking the icon with an “eye” in the outliner. However, to hide the object in the viewport for all scenes of the project at once (clicking on the icon with the “monitor” image) a special operator is not provided. We can make it ourselves.

 

Difference between the “eye” and the “monitor” icons when hiding objects

To hide objects in the 3D Viewport window, we can click the “eye” icon in the outliner near the desired object name (press the “H” shortcode), or we can click the icon with the “monitor” image. In both cases, the object will be hidden.

So, what’s the difference between these two variants?

It is very simple:

Clicking on the “eye” icon hides objects only in the currently active scene of the blend file.

Pressing the icon with the “monitor” hides objects in all scenes of the blend file at once.

How to apply transformations to a mesh with the Blender Python API

To apply all transformations to an object, all its vertices must be multiplied by its global matrix, the matrix itself must be made identity.

To apply all transformations to the active mesh, we need to execute the following:

Message Bus

In Blender API there is a module that we can use to track the changes of any object’s properties available through the Python API. This module names “Message Bus”.

Let’s look at how we can make an event handler function to track changes to a property. For example – the location of the 3D cursor.

Compiling a video from a sequence of frames using the FFmpeg codec

Rendering directly to a video file in Blender is not always useful. More often, a sequence (a set) of frames is received after render, which then, for example, after additional post-processing, must be assembled to the final video file.

We can compile a sequence of frames into a video with Blender itself, with the Visual Screen Editor (VSE). Or we can use third-party codecs, for example, FFmpeg.

Setting colors for Blender collections with the Python API

Since Blender 2.9, the ability to assign color tags has been added for collections. Collection with such tag is displaying in a specific color in the outliner.

The collection color tag value is stored in its “color_tag” property. To change the color label of a collection, we need to assign a certain value to this property.

For example, to mark the current active collection in green: