Blender 3D

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.

Calculating a rotation matrix from one vector to another

Aligning one plane to another is a common task in 3D modeling. The easiest way to align planes is by using their normal vectors – we need to rotate the original plane so that its normal vector coincides with the normal vector of the plane for which the alignment is performed. Therefore, the task of rotating one plane to another can be reduced to the problem of rotating the normal vector of the first place to the normal vector of the second plane.

Hiding all inputs and outputs on nodes in Blender using Python API

For ease of display, all input and output sockets on nodes, both shader and geometry, can be hidden from the user. Hiding unused node inputs and outputs may be necessary to simplify the visual perception of the node tree, which can be very large and complex and does not need to be overloaded with unnecessary information.