Closed RealDanTheMan closed 5 months ago
Proposed solution only creates a copy when vertex colors are valid, when their length == vertex count
Looks good thanks for the fix! Is there a sample mesh we could add to unit tests for this (or something in tests/corpus
maybe?)
Hey @mikedh, I have added the test case along with a simple subdivided cube model for it, the cube is filled with magenta vertex color.
The test case has to actually validate the values stored in the vertex color to prove success, because even if the vertex color access fails it falls back on some default or pre-calculated values, in my test cases without the fix they were reading [102 102 102 255]
instead of expected [255 0 255 255]
Awesome test and fix looks good, thanks for the PR!
Without the fix GLTF loading will fail assigning vertex color properly down the line when colors are converted to RGBA which attempts to modify the buffer contents directly, as a result raising exception.
https://github.com/mikedh/trimesh/blob/7853a5ebae3b35275f4d8d65cbc48bcd3a3c8a40/trimesh/visual/color.py#L583