Reference/Release Notes/3.5/Python API
< Reference | Release Notes | 3.5
Python API
Breaking changes
BGL Deprecation
BGL is a direct wrapper around OpenGL calls. The BGL module is deprecated for 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. (rBea1c31a2)
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 (rB6514bb05).
- Mesh vertex positions are now accessible via the builtin
position
attribute (rB1af62cb3). - UV layers are now stored as generic 2D vector attributes on the face corner domain (rB6c774feb)
- The
MeshUVLoop
Python type is deprecated and will be removed in 4.0. Itsdata
collection member is also deprecated, replaced with separate collection members nameduv
,vertex_selection
,edge_selection
, andpin
. Accessing thedata
member is emulated for backwards compatibility for now, but the emulation comes with a performance penalty (rBa82c12ae). - The sharp edge property is now stored as a generic attribute, accessible with the
sharp_edge
name (rBdd9e1ede). - Loose edge status is stored separately internally (rB1ea169d9).
- The
MeshEdge.is_loose
property is no longer editable. - Loose edge status can be recalculated with
Mesh.update(calc_edges_loose=True)
- The
- 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. (rBf7dd7d54) - The active catalog of Asset Browsers can be changed via
bpy.types.FileAssetSelectParams.catalog_id
, it's no longer read-only. (rB80249ce6) - Custom node tree now have a default name set to
NodeTree.bl_label
. (59ce7bf)