I was trying to change the colors of the vertices of a cube in maya using pymel. My goal was to create a shaded cube. However, when I run the following code nothing changes. Any idea?
cube, pcube = pmc.polyCube()
for v in cube.vtx:
v.setColor([1, 0, 0, 1])
print v.getColor()
cube.updateSurface()
To my surprise, the color I set gets printed correctly but the colors of the vertices don't change on the screen. Moreover, when I use setPosition
to change the position of a vertex it actually works fine.
Thanks for your time.
By default display colors is disabled on a shape. Try to go to the object's shape in the attribute editor and under the tab Mesh Component Display tick the Display Colors checkbox.
By script it is also accessible from the property displayColors