Page MenuHome

Mesh RNA API: Expose contiguous normal arrays
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Jan 14 2022, 9:00 PM.

Details

Summary

Since vertex and face normals are now stored on the mesh when necessary,
we can expose them as contiguous arrays of vectors in the Python API.
This can give render engines and other addons easy access to they data
for faster access through a regular collection property.

While "Mesh Vertex" still has a "normal" property in RNA, that is only
maintained in order to avoid breaking the existing API, and accessing
it is less efficient than accessing the normals directly.

I made the normal arrays read-only, because modifying them could
put them in an invalid state. This is inline with how we treat the data
internally, and helps keep relationships between data clear.


Maybe there is a simpler way to make a const float[3] property
with RNA, but I don't know of it.

Diff Detail

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Jan 14 2022, 9:00 PM
Hans Goudey (HooglyBoogly) created this revision.

After a small test, all seem that is working OK, but I need to do some more tests.

Yes.. I can confirm that work fine for both cases: vertex and face normals.

This revision is now accepted and ready to land.Jan 18 2022, 11:51 PM