Blender 4.5 LTS: Python API¶
Breaking Changes¶
gpu
¶
gpu.types.GPUShader
constructor is deprecated and will be removed in Blender 5.0. Usegpu.shader.create_from_info()
instead. (9d06508837)shader.program
has been deprecated and will always return-1
. (3562433ae7)
Additions¶
User Interface¶
-
KeyConfig.keymaps.find_match(keymap)
Add a convenience function to find the matching key-map from another key-configuration.
This avoids having to pass multiple arguments to the existing
find
method.(28126b83a5).
-
KeyMap.keymap_items.find_match(keymap, keymap_item)
Add a method to support looking up key-map items from other key-maps.
This allows an add-ons preferences to show the key-map editor for key-map items they define while maintaining the original key-map entries (used by "Reset to Default").
Typically the
find_match
method should be called on key-maps from:context.window_manager.keyconfigs.user
to lookup key-map items which the add-on created in:context.window_manager.keyconfigs.addon
.(4a6d687d53).
-
GIZMO_GT_button_2d
Gizmo typeicon_value
propertyAdd a new
icon_value
property to theGIZMO_GT_button_2d
Gizmo type to support using custom icons values. This allows for the use of user-defined icons (via custom preview collections), or generated icons like material or image previews.This property is also documented in a new Python Template, available from the Text Editor in Templates > Python > Gizmo Simple 2D.
Pipeline & I/O¶
-
Mesh.calc_smooth_groups(use_bitflags=False, use_boundary_vertices_for_bitflags=False)
The Mesh API to compute smooth groups has been updated to also optionally take boundary vertices into account, and not only boundary edges.
This seems to be the expected way to generate smooth groups by some other DCCs and game engines to correctly recompute normals from this data.
See PR#105516 and PR#135248 for details.
Committed as (00de07f752)
blf
¶
-
Support for drawing into an image-buffer with the
blf.bind_imbuf
&blf.draw_buffer
functions.
bpy.app
¶
- Support for
bpy.app.build_options.image_webp
(e94068e8d2)
imbuf
¶
- Support loading images from memory with
imbuf.load_from_buffer
(10e1aaf02c)
Sculpt¶
brush.asset_activate
now performs a blocking load when used in background mode (898e6f3687).sculpt.mask_by_color
now takes in alocation
parameter to specify a region-space mouse position to execute the operator from a script (956a0fad80).
GeometrySet¶
- A new
GeometrySet
API has been added that allows retrieving evaluated geometry data for objects in a much more direct way than before. (29fddf4710) - Documentation