I lost a bit the overview on all that vertex indexing stuff, that even becomes more complicated with “loops” in bmesh… Can somebody point me to an easy method to read/write the vertex color of a vertex in a mesh? I just check out the possibilities of Blender, Python, and VertexColors in order to mark points/vertices of interest for instance and later use the vertex for further computation (that part I have to come up with yet).
Problem: obj.data.vertex_colors[0].data[0].color accesses a different vertex (by data[0]) than obj.data.vertices[0]
I’ve been looking at the BMesh module, but from_mesh() and to_mesh() don’t make it much easier actually…
Where BMesh is a bmesh object generated by bmesh.from_mesh(). But I haven’t figured out how to access the color valuesl. The above line returns a BMLayerItem, which cannot be indexed, and has “name” and “copy_from” accessible. For instance, if I print(DCLayer.name), it will return “Diffuse Color”. Any help is appreciated.
This is for reading data that is supposed to exist, as it is for an exporter. The normal Blender object contains the vertex colors. Presumably bmesh.to_mesh() brings those values over as well. I know it brings the layer name over.
And vertex groups? I would like to convert vertex weights to vertex colors. I Have no idea of how to start. I found some old examples, but they don’t seem to work.