I think you should use Color Set to manage the vertex color. import maya.cmds as cmds # create a color set cmds.polyColorSet(colorSet="my_colorSet", create=True, currentColorSet=True) # assgin color cmds.polyColorPerVertex(rgb=(1,0.4,0.2),alpha=1,cdo=True) # hide color (switch to the original color set) cmds.polyColorSet(colorSet="colorSet1", currentColorSet=True)
在2021年11月18日星期四 UTC+8 01:25:37<[email protected]> 写道: > Hello everyone, > > I’m trying to develop a hide/show functionality using python in Maya. > > I was able to develop a functionality that assigns colors to selected > meshes using the polyColorPerVertex command. > > ``` > cmds.polyColorPerVertex(self.select, rgb=(1,0.5,0), cdo=1) > #I fetch self.select using the cmds.ls (sl-True) command, which I have > declared previously > ``` > > coming to the problem now , I need to develop a Hide/Show functionality , > so far , I’ve tried to turn off the visibility mode , using cdo=0 and it > did not work > > ``` > cmds.polyColorPerVertex(self.select, cdo = 0) > ``` > > I have also tried to set it as a attribute using > ``` > for obj in self.select: > cmds.setAttr('obj.displayColors',False) > ``` > > and I’m gettng the following error > RuntimeError: setAttr: No object matches name: obj.displayColors > > Can someone help me on where I could be going wrong or help me with any > python command which could enable me to design the Hide/Show functionality. > > Thank you! Good day. > > > -- 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/bf9a0396-a1c7-4780-82f2-cf9f6ea9d878n%40googlegroups.com.
