Skip to content

Python API

Breaking changes

BGL Deprecation

BGL is a direct wrapper around OpenGL calls. The BGL module is deprecated and since Blender 3.4 has been replaced with the gpu module. From this release it will not work when using the Metal backend. Add-ons and scripts that uses the bgl module are warned about the deprecation and should use the gpu module in stead.

Class Registration

Registering classes with the names matching existing built-in types now raises an error (52f521dec4).

Node Group Sockets

Virtual sockets are the extra sockets added to group input and output nodes. Previously connecting a link to them would create an input or output in the corresponding node group. That feature was meant as a UI/UX feature though, and is now implemented differently in Blender and doesn't happen automatically. The correct way to add a group input from Python is to use node_tree.inputs.new(...) (7026096099).

Grease Pencil

Auto-masking settings were moved from brush to tool settings, for details see 4c182aef7c.

Motion Tracking

The internal storage of the optical center (principal point) has been changed in 7dea18b3aa to a normalized space.

The normalized space refers to coordinate (0, 0) corresponding to the frame center, (-1, -1) the left bottom frame corner, (1, 1) is the top right frame corner. This notation is available via clip.tracking.camera.principal_point property.

For some algorithms it is convenient to operate in the pixel space. For those usecases the new clip.tracking.camera.principal_point_pixels property has been added.

The old clip.tracking.camera.principal has been removed to avoid ambiguous naming in the API.

Armature Modifier

An old bug where the effect of the Invert Vertex Group toggle of the Armature modifier was inverted when Multi-Modifier was active was fixed. (ea1c31a244)

Scripts creating complex armature modifier setups need updating to check the exact blender version:

modifier.use_multi_modifier = True
if bpy.app.version_file < (3, 5, 8):  # Blender bug T103074
    modifier.invert_vertex_group = True

Data Transer

For bpy.ops.object.datalayout_transfer operator, VCOL has been split into COLOR_VERTEX and COLOR_CORNER for different color domains (93d84e87b2, eae36be372).

Internal Mesh Format

The mesh data structure refactoring from earlier releases has continued in 3.5. See the similar section in the 3.4 release notes.

  • The active and default (for render) color attributes are now stored as strings, making it easier to change them and access the correct attributes (6514bb05ea).
  • Mesh vertex positions are now accessible via the builtin position attribute (1af62cb3bf).
  • UV layers are now stored as generic 2D vector attributes on the face corner domain (6c774feba2)
  • The MeshUVLoop Python type is deprecated and will be removed in 4.0. Its data collection member is also deprecated, replaced with separate collection members named uv, vertex_selection, edge_selection, and pin. Accessing the data member is emulated for backwards compatibility for now, but the emulation comes with a performance penalty (a82c12ae32).
  • The sharp edge property is now stored as a generic attribute, accessible with the sharp_edge name (dd9e1eded0).
  • Loose edge status is stored separately internally (1ea169d90e).
    • The MeshEdge.is_loose property is no longer editable.
    • Loose edge status can be recalculated with Mesh.update(calc_edges_loose=True)
  • Data access is generally faster than before when accessed with the attribute API (i.e. mesh.attributes["sharp_edge"]), but slightly slower than before when accessed with the old properties.

Bundled Libraries

Python bindings for the following libraries are now bundled with Blender, and available to use by add-ons.

Other Changes

  • The users site-packages are now available by default without having to use --python-use-system-env (72c012ab4a)
  • New ModifierData.execution_time property that can be used for profiling and optimization. It's not exposed in the UI yet (8adebaeb7c).
  • New object.modifiers.move() method for reordering modifiers without using operators. (f7dd7d5454)
  • The active catalog of Asset Browsers can be changed via bpy.types.FileAssetSelectParams.catalog_id, it's no longer read-only. (80249ce6e4)
  • Custom node tree now have a default name set to NodeTree.bl_label. (59ce7bf)