Reference/Release Notes/3.2/Python API
< Reference | Release Notes | 3.2
Python API
Text Editor
- Python exceptions from the text editor are now displayed in the info-space (as well as the console). (rB2d2baeaf).
- Soft keywords are now syntax highlighted. (c6ed879f9a)
Additions
Context.temp_overridehas 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. (f438344cf2)Context.path_resolvenow supports resolving attributes such as "active_object", "scene" ... etc. Expressions such ascontext.path_resolve("active_object.modifiers[0].name")now work as expected. (7bb8eeb3a8)Text.region_from_string&Text.region_as_stringmethods can be used to get and set the selection, optionally passing in the region to access. (rBf49a736f).mathutils.Colorgained 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. (469ee7f)- Persistent handlers in
bpy.app.handlerscan now use methods from a class. (0f583d9d60)
Breaking Changes
XrActionMapItem.user_pathscollection property replacesXrActionMapItem.user_path0/user_path1. Similarly,XrActionMapBinding.component_pathscollection property replacesXrActionMapBinding.component_path0/component_path1. This allows XR actions to have a variable amount of bindings instead of being limited to 2 per action. (rB6a8709ba)gpu.shader.code_from_builtinit is no longer compatible with Blender's internal gpu module and had to be removed. (rB3e98331a)- The
MeshVertex.normalproperty is now read-only, which prevents confusion due to the way vertex normals are calculated on-demand. (891268aa82) - 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 theKeyMapItem.valueset toCLICK_DRAG. Directional dragging can be specified by settingKeyMapItem.direction. (4986f71848, 7e4c031328)
- The value of motion events (
MOUSEMOVE,INBETWEEN_MOUSEMOVE) is now alwaysNOTHING, instead of the previousPRESS/RELEASEevent's value 52af3b20d4. - Sequence properties
frame_still_startandframe_still_endhave been removed. Same functionality can be now achieved by setting negativeframe_offset_startorframe_offset_end(rB8ca9ce09) - Adding a new Geometry Nodes modifier doesn't automatically populate it with a new node tree anymore (08b4b657b6).
Deprecation
- The primitive drawing types
'LINE_LOOP'and'TRI_FAN'used inGPUBatchhave been deprecated as they will be removed in future releases. (rBe2d8b6dc)
- Passing the context to operators as a dictionary) has been deprecated as part of the inclusion of
Context.temp_overridewhich should be used instead. (f438344cf2)
# Deprecated API bpy.ops.object.delete({"selected_objects": objects_to_delete}) # New API with context.temp_override(selected_objects=objects_to_delete): bpy.ops.object.delete()
Mesh.vertex_colorsis deprecated and will be removed in a future release. The new sculpt paint tools can now create color attributes, found inMesh.attributeswith typeBYTE_COLORandFLOAT_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_srgbcan perform the conversion.