Files
test/source
Thomas Barlow 9956ef4622 PyAPI: Allow prop collection raw array read access for non-editable props
Non-editable prop collection items would always fall back to the slower
loop in `rna_raw_access`.

This patch changes `RNA_property_collection_raw_array` to only fail with
non-editable items when intending to set values, allowing for the faster
raw array access to occur when reading values in `rna_raw_access`.

This brings the Python API `bpy_prop_collection.foreach_get` performance
of `Mesh.vertex_normals`/`polygon_normals`/`corner_normals` up to the same
speed as generic `FLOAT_VECTOR` attributes with the same domains.

Given a mesh with 393216 corners:

Using `foreach_get` with the "vector" prop and a compatible buffer object:
- Corner vector attribute: ~0.9ms
- Corner normals (before): ~7.9ms
- Corner normals (after):  ~0.9ms

Using `foreach_get` with the "vector" prop and a Python list:
- Corner vector attribute: ~11.0ms
- Corner normals (before): ~18.0ms
- Corner normals (after):  ~11.0ms

Pull Request: https://projects.blender.org/blender/blender/pulls/114063
2023-11-06 15:51:07 +01:00
..