Maya / Python, how to change display layer's colour?
Clash Royale CLAN TAG#URR8PPP
Maya / Python, how to change display layer's colour?
After create a new display layer, how to set colour attribute to that layer?
sel = cmds.ls(selection=True,fl=True)
coneGroup = cmds.group(empty=True,name="cones_#")
dGroup = cmds.createDisplayLayer(coneGroup, n = "cones_cam")
cmds.color(dGroup, (0,0,0))
3 Answers
3
Use need to use setAttr
:
setAttr
sel = cmds.ls(selection=True,fl=True)
coneGroup = cmds.group(empty=True,name="cones_#")
dGroup = cmds.createDisplayLayer(coneGroup, n = "cones_cam")
# Enable the layer's color.
cmds.setAttr(".color".format(dGroup), True)
# Enable the layer's color to use rgb.
cmds.setAttr(".overrideRGBColors".format(dGroup), True)
# Set the layer's color with values between 0-1.
cmds.setAttr(".overrideColorRGB".format(dGroup), 1, 0, 0)
Don't forget to mark this as an accepted answer if all is resolved.
– Green Cell
Feb 27 at 3:27
#code
for shadingEngine in cmds.ls(type="shadingEngine"):
new_shader = cmds.listConnections(shadingEngine, type = 'lambert')[0]
print new_shader
new_sg = mC.sets(renderable=True, noSurfaceShader=True, empty=True)
print new_sg
f=mC.setAttr (new_shader+'.color',values[0],values[1],values[2])
mC.hyperShade(assign=new_shader)
Above code work for the color shading through the surface node you can refer and implies it , Happy hunting for your searches
Code excerpt:
for shadingEngine in cmds.ls(type="shadingEngine"):
new_shader = cmds.listConnections(shadingEngine, type = 'lambert')[0]
print new_shader
new_sg = mC.sets(renderable=True, noSurfaceShader=True, empty=True)
print new_sg
f=mC.setAttr (new_shader+'.color',values[0],values[1],values[2])
mC.hyperShade(assign=new_shader)
The above code works for the color shading through the surface node you can refer and implies it , H.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Wow, it works!! Thank you very much!!!
– user8972552
Feb 27 at 3:25