Blender

Creating a custom UI window in Blender using PySide

The Blender Python API provides add-on developers with quite a wide range of options for designing a user interface. However, sometimes the built-in capabilities of the Blender API may not be enough. We can create a window with a UI that is completely independent of the built-in API by connecting and using the PySide module.

Getting the active property value in Blender using context

To get the current active object in a Blender scene, we usually use the context and its context.object (or context.active_object) property. Similarly, when working with the interface, we can access the context to get the currently active property – the value of the field in the Blender UI over which we hover the cursor or on which we clicked with the mouse. The context.property value is used for this.

Quickly renaming data blocks to match object names in Blender

When we assign or change the name of an object in Blender, we work at the object level. However, all objects also have a data block – a pointer to the actual object data, which also have names. The name of the data block can be seen by clicking on the corner arrow to the left of the object name in the outliner.

Assigning real indices to vertices created in bmesh

When we work with the bmesh object through the Blender Python API to create new geometry, all created vertices receive an index equal to -1. Although we can fully interact and control the created vertices, the lack of a numbered index can make it somewhat difficult to perceive the geometry and debug the code.