Blender 3D

How to find which collection contains the desired object

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:

This code will return a list of cameras and collections in which they are located.

Context override

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:

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”.

How to run Blender 2.93 on Windows 7

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.

How to change current tool through the Blender Python API

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:

Ortho lighting

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.

How to import a Python module by the absolute path

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.