This was going to go in my UV API change proposal, but it’s more complex and will take some actual design changes, so here it is in its own thread.
Someone mentioned in another thread that it would be nice to be able to set more vertex color channels than 1 via Python, which I do indeed agree with. One of the reasons I want to pursue any changes at all is to find a quick, easy way to identify in the BGE preset groups of vertices (i.e. parts of a hair mesh, or specific positions to spawn objects, for example). Vertex color painting works very well as it’s easy to identify and draw exactly what you want where you want, but can be difficult to deal with as you only have 3 channels open to you max. If this were opened up, we would be looking at 24 potential channels to control both the looks and specific dynamics of objects’ meshes.
After a quick test, here are my ideas and general musings.
-
Blender uses only the currently selected vertex color when converting from a Blender mesh to a BGE mesh (when you use the engine). I’m currently uncertain as to what should be done for this. Mixing all of the colors from all channels together on drawing might work alright, but that may not be intended (since the colors Blender is displaying on the mesh could be how you want the mesh to draw). Perhaps some ability to show or hide color channels would be nice?
-
Since vertex colors have the same number of elements as UV maps, hopefully I can learn something from the UV code to apply to vertex colors as well (storing them in an array, passing them from Blender to the BGE, accessing them via Python, etc).
-
The vertex color setting API is somewhat similar to the UV setting API, so I would propose essentially dropping what’s there already in favor of the same simpler API (basically just getRGBA() and setRGBA(), both with optional arguments). This might be expanded on with a showVCol() and hideVCol() function if necessary, but just those two functions would probably be my preference.
Note that this proposal is INSTEAD of the current functions / properties dealing with vertex colors, so they would be basically deleted, or at least deprecated. I personally wouldn’t mind simply getting rid of the extraneous portions of the API, since they’ve been around for so long.
Thoughts?