Reference/Release Notes/3.2/Python API

= Python API =

Text Editor

 * Python exceptions from the text editor are now displayed in the info-space (as well as the console)..
 * Soft keywords are now syntax highlighted.

Additions

 * `Context.temp_override` has been added to support temporarily setting the context which can be useful after loading a file (for example) where the context is cleared making many operators fail to run.
 * `Context.path_resolve` now supports resolving attributes such as "active_object", "scene" ... etc. Expressions such as `context.path_resolve("active_object.modifiers[0].name")` now work as expected.
 * `Text.region_from_string` & `Text.region_as_string` methods can be used to get and set the selection, optionally passing in the region to access..
 * `mathutils.Color` gained methods to convert between the scene linear color space and sRGB, CIE XYZ, ACES and Linear Rec.709. Most values returned by Blender APIs are in scene linear color space, with the notable exception of user interface theming colors which are in sRGB.
 * Persistent handlers in `bpy.app.handlers` can now use methods from a class.

Breaking Changes

 * `XrActionMapItem.user_paths` collection property replaces `XrActionMapItem.user_path0/user_path1`. Similarly, `XrActionMapBinding.component_paths` collection property replaces `XrActionMapBinding.component_path0/component_path1`. This allows XR actions to have a variable amount of bindings instead of being limited to 2 per action.
 * `gpu.shader.code_from_builtin` it is no longer compatible with Blender's internal gpu module and had to be removed.
 * The `MeshVertex.normal` property is now read-only, which prevents confusion due to the way vertex normals are calculated on-demand.
 * Tweak events have been removed from `KeyMapItem.type`. (`EVT_TWEAK_L`, `EVT_TWEAK_M`, `EVT_TWEAK_R`)
 * Instead of special types, regular mouse button types should be used (`LEFTMOUSE`, `MIDDLEMOUSE`, `RIGHTMOUSE`) with the `KeyMapItem.value` set to `CLICK_DRAG`. Directional dragging can be specified by setting `KeyMapItem.direction`.


 * The value of motion events (`MOUSEMOVE`, `INBETWEEN_MOUSEMOVE`) is now always `NOTHING`, instead of the previous `PRESS` / `RELEASE` event's value.
 * Sequence properties `frame_still_start` and `frame_still_end` have been removed. Same functionality can be now achieved by setting negative `frame_offset_start` or `frame_offset_end`
 * Adding a new Geometry Nodes modifier doesn't automatically populate it with a new node tree anymore.

Deprecation

 * The primitive drawing types `'LINE_LOOP'` and `'TRI_FAN'` used in `GPUBatch` have been deprecated as they will be removed in future releases.


 * Passing the context to operators as a dictionary) has been deprecated as part of the inclusion of `Context.temp_override` which should be used instead.




 * `Mesh.vertex_colors` is deprecated and will be removed in a future release. The new sculpt paint tools can now create color attributes, found in `Mesh.attributes` with type `BYTE_COLOR` and `FLOAT_COLOR`. Importers and exporters are recommended to support both types of color attributes, and attributes in general. Different from the old vertex colors, color attribute values are in scene linear color space instead of sRGB color space. For file formats that require sRGB colors, `mathutils.Color.from_scene_linear_to_srgb` can perform the conversion.