Making selected edges in a mesh sequentially active

Many operators in the Blender Python API work based on the currently active element—a vertex, edge, or polygon. But very often, we need to execute such an operator multiple times for several selected, rather than active, elements. To do this, we need to sequentially make each of the selected elements active in a loop and call the desired operator.

Adding an HTML link to a user panel in Blender

Previously, add-on and extension developers could only include an HTML link, such as to a contact form or a website with additional information and documentation, in the add-on/extension’s information section. The link was displayed as a button in the information block in the Preference – Add-ons area. Since Blender 5.2, developers have been able to place HTML links anywhere on the UI panels.

Finding the topmost bone in a rig using the Blender Python API

When working with a complex rig, it’s sometimes necessary to quickly find the topmost bone. Since all bones in the rig are linked using a parent-child relationship, we can write a simple script that will traverse the entire hierarchy, starting with the currently active bone, and find the topmost bone.

Selecting dangling geometry in Blender

The non-manifold geometry in 3D objects—such as individual points, edges, or polygons floating in space, as well as holes in a solid mesh—is selected in Blender using the 3D viewport menu: Select – Select All By Trait – Non Manifold. This command can also be executed using the Blender Python API via the bpy.ops.mesh.select_non_manifold() operator. If we’re working with geometry through a BMesh object, there’s no such special operator. However, we can select such non-manifold geometry ourselves.

Create a new polygon for active object in Blender using BMesh and assign UV coordinates to its vertices

When creating new geometry in Blender using the Python API, we often need to not only create new polygons but also immediately assign them the correct UV coordinates. When working with a BMesh object, this could be done using MeshLoop links between geometry verices and UV points.