Autodesk tech support (for which my employer pays) is as fast as usual (i.e.: molasses), so I figured I’d ask my question here…
I need to determine the color(s) of a mesh vertex, given a VertexSelection. I've looked at "Understanding Texture Coordinates and Vertex Colors"in the (horrible) MaxScript help file, but the relevant section is poorly worded (and has even retained a significant typo over the course of many years, despite a [promise that it would be corrected](http://forums.cgsociety.org/showpost.php?p=3599504&postcount=5)). What I'm looking at is this:
[li]Take the index of the mesh vertex.[/li][li]Find out which faces reference the index of the face.[/li][li]Note the number of the vertex (1st, 2nd or 3rd - .x, .y or .z) inside each face.[/li][li]For each face referencing the vertex, get the texture face with the same index.[/li][li]Get the index of the respective texture vertex from the face - 1st, 2nd or 3rd / .x, .y or .z[/li][li]The vertex you got corresonds (sic) to the mesh vertex we started with.[/li][/ol]Steps 1 through 3 make enough sense for me to write code and get predictable results (once the typo in step 2 is corrected).
I'm not sure about step 4, though. "For each face referencing the vertex, get the texture face with the same index." Since it has been apparently too much for Autodesk to simply provide a code example these ten years or so, I've had to assume that they meant something like this:
texVertArrays = for face in faces collect (getTVFace m face)
… Where faces is derived from meshop.getFacesUsingVert, and m is obviously a Mesh object.
Assuming that is correct, step 5 is even more vague. "Get the index of the respective texture vertex from the face - 1st, 2nd or 3rd / .x, .y or .z" That's not an explanation, that's a hint. What do they mean by "respective"? With respect to [i]what[/i]? And why am I being directed to get an index of a value between 1 and 3, when I am looking for indeces of texture vertices?
I had to assume that they meant to say that I should use the values derived in step 3 (i.e. the “corner” of each face – 1, 2, or 3 – to which the relevant vertex is assigned) to determine which value in each of my texVertArrays values corresponds to my original vertex:
texVerts = for i = 1 to texVertArrays.count collect (texVertArrays[i])[corners[i]] as Integer
Anyway, assuming I got steps 4 and 5 right, I’m still not getting the proper color values by calling getVertColor $‘mesh’ texVerts[i].
Has anyone successfully pulled this off, or something like it, using MaxScript? (i.e. I’m not interested in a C++ solution.)
P.S. Sorry if I sound peevish in this post (which I am), but after a few years of hell working with 3DS Max, followed by a few years of bliss working with Maya, I'm back on 3DS Max, and I'm consistently rediscovering why I hated it so much (although the MaxScript .NET compatability, which Max didn't have last time I coded for it, is damn nice).