Muting nodes by type
If it is necessary to exclude all nodes of a certain type from the shader calculation, they can be muted by their type. The muted node remains in the node tree, retaining all links, but doesn’t affect the final result.
If it is necessary to exclude all nodes of a certain type from the shader calculation, they can be muted by their type. The muted node remains in the node tree, retaining all links, but doesn’t affect the final result.
Custom properties in the Blender Python API can be limited to setting with maximum and minimum values. In this case, the user, entering the desired value to the property field, will not be able to set a value that goes beyond the specified limits.
To set the minimum and maximum limits, we can specify the “min” and “max” parameters in our custom property and assign them the necessary limiting values.
To get all polygons adjacent to the desired one, we can use the “bmesh” module, which provides access to all mesh data in Blender.
When we create a Geometry Nodes node tree by a script, after building the node tree itself, the Geometry Nodes attributes need to be set in order to access these attributes from other areas, for example, from the Shader Node tree.
How to manage the Geometry Nodes attribute by the output of the geometry node treeRead More »
“set” – is something like, you pour whiskey into a glass,
and “update” is like – “Wow, whiskey has appeared in the glass, it needs to drink!”,
and “get” – if your friend asks – “What’s in the glass?”, and you answer – “Whiskey”. Or – “Tea”.
To apply an object modifier with the Blender Python API we can use the “bpy.ops.object.modifier_apply” operator. However, it processes only the active object.
If we need to apply a modifier, for example – Subdivision Surface, to several selected objects, we need to make each of them active, and then call the “modifier_apply” operator.
To append all objects from an external blend file to the scene, we can use the BlendDataLibraries mechanism.
Appending all objects from the external blend-file to the scene with Blender Python APIRead More »
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.
1 2 3 4 5 |
self.layout.operator( "mesh.primitive_cube_add", icon='ICON', text="" ) |
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’,…)
How to get all possible EnumProperty values for function parametersRead More »
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.
Creating the same UI panels in different Blender areas with no code duplicationRead More »
Sometimes it is necessary to register an operator that couldn’t be called by the user directly. For example, if this operator is supposed to be called only by another operator after a series of checks or additional actions.