Reference/Release Notes/2.91/Python API

= 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.

Scene Ray Cast
The first parameter to the `scene.ray_cast` function has changed (, 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).

The other parameters and the return value has remained the same.

Other changes

 * Add `ghost` argument to `Struct.is_property_set`, so it's possible to test if an operator's property is being reused from the last time it was called.
 * `wm.read_homefile` now has a `use_factory_startup` argument, which can be used as a faster alternative when resetting the file contents for tests since `wm.read_factory_settings` resets preferences (re-registering all add-ons).
 * Add `UILayout.introspect` for scripts to access the UI layout (for testing/debugging).
 * New `Mesh.attributes` API for accessing custom geometry attributes on meshes. This replaces `vertex_layers_float`, `vertex_layers_int`, `vertex_layers_string`, `polygon_layers_float`, `polygon_layers_int` and `polygon_layers_string`, which are now deprecated. Instead `.attributes` provides 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.
 * New `VolumeGrids.save` function to save volume grids and metadata to disk.
 * 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.
 * 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.
 * `sys.executable` now points to the Python interpreter (instead of the Blender executable) . This resolves `multiprocessing` which failed to spawn new processes on WIN32.
 * `bpy.app.binary_path_python` has been deprecated (use `sys.executable` instead).
 * Since porting `bpy.ops.uv.smart_project` to C, `angle_limit` has to be given in radians.