Reference/Release Notes/2.91/Python API
< Reference | Release Notes | 2.91
Blender 2.91: Python API
Compatibility
- The Principled BSDF shader has a new Emission Strength input. Material importers and exporters need to be updated to take this into account. (b248ec9)
Scene Ray Cast
The first parameter to the scene.ray_cast() function has changed (e03d53874d, A82ed41ec63). It now receives a Depsgraph instead of a View Layer. This made it possible to fix a crash, and also fixes potential issues when ray-casting is done while rendering (for example from a custom driver function).
# Old call example:
context.scene.ray_cast(context.view_layer, ...)
# New call example:
context.scene.ray_cast(context.view_layer.depsgraph, ...)
The other parameters and the return value has remained the same.
Other changes
- Add
ghostargument toStruct.is_property_set, so it's possible to test if an operator's property is being reused from the last time it was called (d3bcbe10c2). wm.read_homefilenow has ause_factory_startupargument, which can be used as a faster alternative when resetting the file contents for tests sincewm.read_factory_settingsresets preferences (re-registering all add-ons) (cf67ba848f).- Add
UILayout.introspect()for scripts to access the UI layout (for testing/debugging) (428a1aaf73). - New
Mesh.attributesAPI for accessing custom geometry attributes on meshes. This replacesvertex_layers_float,vertex_layers_int,vertex_layers_string,polygon_layers_float,polygon_layers_intandpolygon_layers_string, which are now deprecated. Instead.attributesprovides a single list of geometry attributes for all combinations of geometry element and data types. Further, the data types have been extended with 3D Float Vector, Byte Color and Float Color. (565510b) - New
VolumeGrids.save()function to save volume grids and metadata to disk. (fc76750) - Custom property names can no longer contain
",', or\. These characters can cause problems with drivers and Python and may not have worked properly in the past. (cbae82ba96) - Actions are bound to the type of the datablock they're assigned to; a Camera Data action cannot be asigned to an Object. This "locking" used to happen when the animation was evaluated; now it happens when the Action is assigned. (64583f3e8d)
sys.executablenow points to the Python interpreter (instead of the Blender executable) (04c5471cee). This resolvesmultiprocessingwhich failed to spawn new processes on WIN32.bpy.app.binary_path_pythonhas been deprecated (usesys.executableinstead).- Since porting
bpy.ops.uv.smart_projectto C (850234c1b1),angle_limithas to be given in radians.