Python
3D Viewport view direction vector
To get the direction vector of a 3D viewport, for example, to determine the location of the viewport relative to some object in the scene, we can use the region_2d_to_vector_3d function from the view3d_utils module.
Drawing an image with the gpu module in scene and viewport space
Using the GPU module from the Blender Python API, we can draw images in the scene or viewport space. Images can be drawn in the scene coordinate system for intuitive mesh interaction, or in the viewport coordinate system to create custom UI elements.
Drawing an image with the gpu module in scene and viewport spaceRead More »
Clipping values
To clip the value along the boundaries – check if the value goes beyond the specified limits, return the value itself, and if it goes out – the maximum possible boundary value, we can use a very simple function.
Fully override context menu in Blender
While we can append additional items to context menus in Blender, context menus can also be completely redefined. Instead of the basic one, we can get a completely custom context menu with any set and order of items we need.
Make the add-on to be registered in last anywhere
In some cases when Blender starts it is necessary to make the add-on to be registered in last, after all other add-ons have been registered. This may be needed if the add-on conflicts with other add-ons or uses functionality from other add-ons, which should be available already during its registration.
Make the add-on to be registered in last anywhereRead More »
Add-ons loading order
When Blender starts, all active add-ons are loaded sequentially, one after the other. Which add-on will be loaded first is determined by its order in the “bpy.context.preferences.addons” list.
Getting Lattice points coordinates
The Lattice modifier is used to simplify the process of deforming high-poly meshes using simple wireframe objects with a few points – lattice. The lattice is superimposed on the mesh and associated with it, after which, by manipulating its point, we can deform the mesh itself. We can access the coordinates of the lattice points with the Blender Python API through its “points” property.