Python

How to show parameters ​​from Geometry Nodes inputs on a custom UI panel

Input parameters from Blender Geometry Nodes are automatically placed on the “Geometry Nodes” modifier panel in the “Properties” window on the modifier tab. However, this tab is not always open, and it is not always convenient to switch to it to adjust values. For quick access to the input parameters of Geometry Nodes, we can duplicate them on the custom panel in the 3D Viewport window.

Operators for globally hiding objects in all project scenes

To hide an object in the 3D Viewport window for the current scene we use the “object.hide_view_set” operator, which calls when we clicking the icon with an “eye” in the outliner. However, to hide the object in the viewport for all scenes of the project at once (clicking on the icon with the “monitor” image) a special operator is not provided. We can make it ourselves.

 

How to apply transformations to a mesh with the Blender Python API

To apply all transformations to an object, all its vertices must be multiplied by its global matrix, the matrix itself must be made identity.

To apply all transformations to the active mesh, we need to execute the following:

Message Bus

In Blender API there is a module that we can use to track the changes of any object’s properties available through the Python API. This module names “Message Bus”.

Let’s look at how we can make an event handler function to track changes to a property. For example – the location of the 3D cursor.