If the object you need is located in a hidden collection, it can be difficult to find it in large scenes.
To find out in which collection the desired object is located by its type, we need to execute the following. For example for cameras:
[(obj.name, obj.users_collection) for obj in bpy.data.objects if obj.type=='CAMERA']
# [('Camera', (bpy.data.collections['camera'],))]
This code will return a list of cameras and collections in which they are located.
Blender add-on template generator updated to version 1.7.0.
- Blender 2.93 template added
- Blender 3.00 template added
One Million Year Old Suzanne by The_Banned_Guy
More awesome Suzanne
The Blender 2.83.16 LTS release is enabled for downloading on the official Blender site.
9 bug was fixed in this version.
Let’s look at how we can use displacement with the “Geometry Nodes” in Blender.
First, add a cylinder (with the 0.1 diameters, without upper and lower closing polygons) to the scene: shift+a – Mesh – Cylinder.
Switch to edit mode (tab) and add edges to make the uniform grid: ctrl+r – 100 – Enter.
Continue reading “Displacement with Geometry Nodes”
AniCam – the Blender 3D add-on that allows the animating camera and render output resolution.
Continue reading “Blender add-on: AniCam”
Some Blender operators can only be called from the workspace for which they are intended.
If you call from the Python console, for example, an operator intended only for working in the 3D Viewport area, the operator will not be executed:
or it will fail with an error message about the incorrect context:
# RuntimeError: Operator bpy.ops.view3d.background_image_add.poll() failed, context is incorrect
However, we can still execute operators from a non-native working area. To do this, we can pass the first implicit parameter to any operator – a pointer to the context of the area in which this operator should be executed. This parameter commonly named the “overridden context”.
Continue reading “Context override”
Since version 2.93, Blender developers moved its API to Python 3.9. This means that Blender will no longer run on computers with Windows 7 operating system because it has no compatibility with this version of Python. In order to continue using the latest versions of Blender, users will have to update their operating system.
However, thanks to the fan-made work of Alexandru Naiman, Blender 2.93 can still be run on Windows 7.
Continue reading “How to run Blender 2.93 on Windows 7”
To switch the active tool from the T-panel in the 3D viewport window, we need to call the appropriate operator and pass the “idname” of the required tool in its “name” parameter.
For example, to enable the “Select Circle” selection toll, we need to call:
Continue reading “How to change current tool through the Blender Python API”
The Blender 2.93 LTS release is now enabled for downloading on the official Blender site.
Continue reading “Blender 2.93 LTS release”
When the scene is lighted with “Spot” or “Point” light sources, the rays from such lamps do not propagate in parallel. This makes noticeable distortion, for example when lighting with textures.
The parallel ray’s propagation (orthogonally to its plane) we can get from the “Sun” lamp, but such light source does not support lightning with textures.
Continue reading “Ortho lighting”
BIS (Blender Interplanety Storage) updated to v.1.10.0.
- The principle of storing meshes has been changed – now meshes are stored completely, with all dependencies.
- All old meshes have been converted to the new format.
- Old format compatibility removed.
- Fixed some issues with materials from the previous version of BIS.
Modules used in Blender scripts and add-ons are located in the same directory as the script or add-on, or in the Blender installation directory by the “blender_version\python\lib\” path. However, it is possible to load a module located elsewhere on the hard drive.
To do this, we need to load the module by its absolute path.
Continue reading “How to import a Python module by the absolute path”
The Blender 2.83.15 LTS release is enabled for downloading on the official Blender site.
1 bug was fixed in this version.
To link a mesh to an armature bone that the mesh retains its current position through the Blender Python API, we need to execute the following code:
Continue reading “How to link a mesh to an armature bone with maintaining its current position”
Blender add-on “Accurate Region Border” updated to v. 1.1.1.
- Changed sliders names for more convenience
- Added confirmation for pressing “To All Scenes” button
To accurately align the bone of one armature with the bone of another armature, we need to correlate the global armature matrices and the local pose-bone matrices.
To do this, we need to execute the following:
armature_to = bpy.data.objects['Armature']
armature_from = bpy.data.objects['Armature.001']
armature_from.matrix_world = armature_to.matrix_world
armature_from.pose.bones.matrix = armature_to.pose.bones.matrix
After executing this code, the first bone of the “Armature.001” will be moved to the position of the first bone of the “Armature”.
The Blender 2.83.14 LTS release is enabled for downloading on the official Blender site.
8 bugs were fixed in this version.
Most often, for quick simplified calculations with the object’s geometry, their Bounding Boxes are used – the minimum parallelepiped into which this object is inscribed. But sometimes the Bounding Sphere – the minimum sphere into which an object can be inscribed – can provide greater accuracy and simplify the calculations. While the location and size of the object’s Bounding Box is available in Blender at once, the Bounding Sphere we need to calculate manually
Let’s write a function that, based on the object list, returns the coordinates of the center of their Bounding Sphere and its radius.
Continue reading “How to calculate the Bounding Sphere for selected objects”
Blender add-on template generator updated to version 1.6.0.
- Blender 2.92 template added
An attempt to invert the transformation matrix with the inverted() method can be failed if, for example, some constraint affects the object for which the initial matrix is calculated.
In this case, Blender will generate an error:
ValueError: Matrix.invert(ed): matrix does not have an inverse
Continue reading “Matrix inverting features”
Unfortunately, Blender’s interface does not support word wrapping and multi-line text blocks. Text lines that are too long to be displayed in the panel are cut off. However, multiline text can still be displayed on the panel using several text elements instead of one.
First, let’s create a simple panel in the N-panel of the 3D Viewport window and place a label element with the desired text on it.
Continue reading “Multiline text in Blender interface panels”