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.
#Showing a sample code for one color. 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 some API which could enable me to design the Hide/Show functionality.
Thank you! Good day.