The problme is that you sorted the points list (and got it out of order 
from the original vertex list) and then used that to as the basis for 
building your normalized list of values.  So, ignoring optimization or 
anything, just put the comprehension on the for loop at line 19: for val in 
[p[1] for p in pointsList]
instead of reusing the pointsDirList that you used to determine the 
min/max.  That should get it back to working.

On Monday, May 1, 2017 at 3:10:00 PM UTC-4, Aren Voorhees wrote:
>
> I have an old script that assigns vertex colors to a mesh, based on the 
> vert's position (can be used to create worldspace gradients - useful for 
> world position offset vertex animation in real-time applications).  Anyway, 
> I'm working on re-writing this tool using the python API to hopefully make 
> it quicker on dense meshes.  This is my first time really trying to use the 
> api, so I'm kind of stumbling my way through it.  I've found a way to get 
> the point positions and a list of vertex IDs on a given mesh.  However, 
> those two lists don't correspond to each other so when I run the below 
> code, it doesn't assign the right vert colors to the correct mesh.  Is 
> there some way I can make the two lists, or two sets of information match 
> together to fix this issue? (Note: Currently I'm just trying to create a Y 
> gradient which is why I am just getting 2nd value for each point).
>
> https://pastebin.com/s3fGRPNG
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4b4ca7a7-c19a-412a-be80-ed16d05b352a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to