Tutorials

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.

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.

Ortho lighting

When the scene is lighted with “Spot” or “Point” light sources, the rays from such lamps do not propagate in parallel. This makes noticeable distortion, for example when lighting with textures.

The parallel ray’s propagation (orthogonally to its plane) we can get from the “Sun” lamp, but such light source does not support lightning with textures.

How to calculate the Bounding Sphere for selected objects

Most often, for quick simplified calculations with the object’s geometry, their Bounding Boxes are used – the minimum parallelepiped into which this object is inscribed. But sometimes the Bounding Sphere – the minimum sphere into which an object can be inscribed – can provide greater accuracy and simplify the calculations. While the location and size of the object’s Bounding Box is available in Blender at once, the Bounding Sphere we need to calculate manually

Let’s write a function that, based on the object list, returns the coordinates of the center of their Bounding Sphere and its radius.

Localization of Blender add-ons – with API

The classic way of localizing a Blender add-on (translating it into different languages) is convenient because requires just a single Blender Python API call – to get the currently used locale. This way is maximum universal, but Blender would not be Blender if it did not provide users an ability to localize add-ons through its own API.

The principle of creating multilingual add-ons using the Blender Python API is not much different from the classical one – we need to create a dictionary with all the variants of translations for all text strings from our add-on and use this dictionary in the localization.