Creating custom tool in Blender
In Blender version 2.8x and later, a new toolbar has appeared, located in the 3D viewport area on the left side. We can create custom tools and add them to this panel using the Blender Python API.
In Blender version 2.8x and later, a new toolbar has appeared, located in the 3D viewport area on the left side. We can create custom tools and add them to this panel using the Blender Python API.
By default, all objects in Blender are sized in the same units. However, for convenience, we can use the adaptive metric – small objects will show sizes in centimeters and millimeters, large objects – in meters and kilometers.
We can display data in a table-like form in the Blender UI with the row() and column() functions of the layout element in the Panel class, from which we inherit the custom UI panel classes.
Typically links between nodes in Blender are created by simply dragging and dropping between the desired input and output node sockets. However, if necessary, we can also connect nodes using the Blender Python API.
Creating links between Blender nodes using the Python APIRead More »
To remove an existing View Layer using the Blender Python API, we need to execute the remove() method from the list of all view layers of the current scene.
The bl_context parameter is used for placing custom UI panels on the desired tab in the Properties area. The value specified in this parameter is responsible for which tab the user panel will be placed on.
All possible values for the bl_context parameter in UI panel classesRead More »
In the Blender Python API, some operators can only be called in the area they are intended for. If we call such an operator in another area, it will not be executed or Blender will throw an error. To call a context-related operator from an area not intended for it, we need to redefine the context.
To select all objects in Blender with the desired modifier appended using the Blender Python API, we need to loop through all the objects in the scene, check for the presence of the desired modifier and set the object selection flag to True.
Selecting all objects with the desired modifier in BlenderRead More »
We can apply modifiers to an object by sequentially looping through the modifiers list and calling the bpy.ops.object.modifier_apply() operator to apply each of them. However, we can use the fact that the depsgraph already has fully calculated mesh data with modifiers already applied and simply rebuild the object according to this data.
We can open an image/texture in Blender using the Python API by calling the bpy.opa.image.open(…) operator, or directly through the blend data collection by calling the bpy.data.images.load(…) method.
Checking if the desired image type is supported in BlenderRead More »