API

Removing a modifier from all selected objects using Blender Python API

Assigning and removing modifiers in Blender is done separately for each object. However, if we need to, for example, remove a modifier from many objects in a complex scene, removing them from each object individually will be long and inefficient. Using the Blender Python API, we can write a simple script that will remove modifiers from all selected objects in the scene.

Moving a material from one object material slot to another in Blender

To move a material from one material slot to another, we can click the up or down arrow button in the object’s material panel. In this case, the material in the currently selected slot will move up (or down) by one position. This method of moving and sorting materials is very slow and not very convenient.

How to get a partial transform matrix from an existing one

When rotating or moving an object using transformation matrices, in some cases we need to be able to extract a part of it from the entire rotation/movement. For example, when rotating an object by 180 degrees, we need to rotate it not at once, but in several steps, each time rotating it by 30 degrees. Linear interpolation of matrices can help us with this.

Comparing vectors

In order to compare two vectors – to determine whether both vectors point to the same place, we need to compare the coordinates of both vectors and if they are equal, then the vectors are also equal. However, the coordinates of the vectors are specified by float values, the comparison of which for equality, due to the peculiarities of storing this type in computer memory, is never accurate.