3.0

How to get all possible EnumProperty values for function parameters

When passing an EnumProperty value to the function parameters, just like with direct assignment, we must always specify the value from the constant list exactly, otherwise, Blender will throw an error.

For example, specifying an icon for a button in the UI we pass the text identifier to the “icon” parameter of the “layout.operator” function.

If it is not correct, Blender throws an error:

TypeError: UILayout.operator(): error with keyword argument “icon” – enum “ICON” not found in (‘NONE’, ‘QUESTION’, ‘ERROR’,…)

Hiding node groups from menu and search results

When we create complex shaders in Blender, consisting of a large number of node groups, the menu for adding new nodes to the material gets clogged up very quickly. In a long list of node groups, it becomes difficult to find the one we need, and even a search does not always save the day. The list of node groups in the menu can be reduced by hiding unnecessary node group names from it.

Creating the same UI panels in different Blender areas with no code duplication

To create several identical UI panels with the same set of fields and buttons in different areas in Blender, the easiest way is to copy the panel code and replace the parameters that determine in which area the panel will be shown.

The main disadvantage of this method is code duplication, which can make difficulties in the future – when editing panels, changes must be made to each copy of the code, instead of changing it at once for all panels.