I'm off work for a couple of weeks so can't verify anything, but you can do
some checks to find out the cause.

Each time through your loop, instead of using polyColorPerVertex in the if
statement, assign its result to a variable, then print it out, then use it
in the if statement. Something like:
col = cmds.polyColorPerVertex(i, q=True, r=True)[0]
print col, col == 0.456
if col == 0.456:
    etc

That will tell you if you're actually getting the colours you expect, and
also tell you if Python thinks the value is close enough to 0.456 that it
considers them equal. It may be that you need to check if col > 0.456-0.001
and col < 0.456+0.001 because it might be really close but not quite equal.

On Sun, 23 Dec. 2018, 8:35 pm James Kim <jamesjk1...@gmail.com wrote:

> So i've come across an interesting problem.
> it seems maya can only select vertexes with color index 1.0 or 0.0. i
> cannot seem to get the code to select from any ranges inbetween. I've tried
> the other flags on the polyColorPerVertex and nothing seems to work.
>
> as an example
>
> import maya.cmds as cmds
>
>
> sel = cmds.ls(sl=True)[0]
> vNum = cmds.polyEvaluate(v=True)
> vList = cmds.ls('pPlane1.vtx[:]', flatten = True)
>
> for i in vList:
> if cmds.polyColorPerVertex(i, q=True, r=True)==[1.0]:
> cmds.select(i,add=True)
>
> will select all the verts with color info 1.0
>
> but
>
> import maya.cmds as cmds
>
>
> sel = cmds.ls(sl=True)[0]
> vNum = cmds.polyEvaluate(v=True)
> vList = cmds.ls('pPlane1.vtx[:]', flatten = True)
>
> for i in vList:
> if cmds.polyColorPerVertex(i, q=True, r=True)==[.456]:
> cmds.select(i,add=True)
>
> will give me nothing.
>
> Thank you
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python_inside_maya/cv7E_-VVtdQ/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/9f8fd2fd-ffd9-4112-8a79-42ec1ce9399f%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/9f8fd2fd-ffd9-4112-8a79-42ec1ce9399f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAA27_yLR%2BYtyFTU%3DJCsSvbQ8w2ss1Coq4Gs4HgT0LJnp70VVLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to