API

Enabling face orientation color highlighting in Blender using Python API

To enable color highlighting of mesh polygon orientation, we need to on the “Face Orientation” checkbox in the “Viewport Overlays” menu. To turn off the highlighting, we need to uncheck this checkbox. This can be done either manually or using the Blender Python API.

Coloring front and back oriented faces in Blender 4.4

Since Blender 4.4, the color scheme for displaying polygon orientation in the 3D viewport has changed. When in previous versions polygons that had the front orientation (normals are directed “outward” of the mesh) were displayed in blue, then in version 4.4 these polygons are not highlighted at all.

Turning on and off render passes using Blender Python API

Render passes are additional images that are created during rendering and that carry some separate additional information about the render. For example, this could be a depth map – a black and white image in which the brightness of the white color corresponds to the distance of objects from the camera. The creation of such render passes can be turned on in Blender by the user manually in the Properties area on the View Layer tab or using the Blender Python API.

Aligning the origin to the bottom for all selected objects using the Blender Python API

The geometry of objects in Blender is always built around the origin – a point that is taken as the starting point in the object’s local coordinate system. And if the origin does not lie in the plane of the object’s base, it can be difficult to place this object on the surface of another object. We can quickly set the origin to the bottom for all selected objects in the scene, writing a script using the Blender Python API.

Removing custom normals from all selected objects in Blender

Most often, we need to clear custom normals when importing objects from external scenes. We can remove custom normals manually by selecting meshes in the scene and pressing the Clear Custom Split Normals Data button in the Properties panel on the Data tab of the object. However, if there are many such objects, we can write a simple script using Blender Python API that will quickly clear the normals on all selected objects.

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.