2.93

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.

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:

How to arrange objects along a curve without distortion

The simplest way to arrange objects along a curve in Blender is to use two modifiers: “Array” and “Curve”. However, in this case, the object is distorted – its shape adjusts to the shape of the curve. In some cases, for example, when designing curbs or tank tracks, this is undesirable.

There are several ways to arrange objects along a curve without distortion. One of them is to use an intermediate mesh.

Setting up the scene environment for convenient retopology

To make our retopology process faster and easier, the scene environment may be slightly adjusted.

 

First, let’s enable snapping, set “Face” mode, and enable snapping to “Active” in the “Snapping With” section.

Also, check the “Backface Culling” checkbox so that the active retopology points do not magnetize to the backside of the processed mesh.

Context override

Some Blender operators can only be called from the workspace for which they are intended.

If you call from the Python console, for example, an operator intended only for working in the 3D Viewport area, the operator will not be executed:

or it will fail with an error message about the incorrect context:

However, we can still execute operators from a non-native working area. To do this, we can pass the first implicit parameter to any operator – a pointer to the context of the area in which this operator should be executed. This parameter commonly named the “overridden context”.