Home Coding, Scripting, Shaders

Display Color Channel Script

be_ha
polycounter lvl 9
Offline / Send Message
be_ha polycounter lvl 9

Hi all,

I'm wondering if anyone knows of a script to change the selected object's Display Color Channel from Ambient+Diffuse to None. I can't find anything on google. Any help would be greatly appreciated!

Replies

  • suspectlogic
    Options
    Offline / Send Message
    suspectlogic polycounter lvl 13
    # Toggle between Ambient+Diffuse and None display modes.
    import maya.cmds as cmds
    selectedShapes = cmds.ls(transforms=True, selection = True)

    def SetDisplay(curShape ,curMode):
        if curMode == "Ambient+Diffuse":
            cmds.setAttr(curShape + '.displayColorChannel', 'None', type = 'string')
        else:
            cmds.setAttr(curShape + '.displayColorChannel', 'Ambient+Diffuse', type = 'string')

    for shape in selectedShapes:
        curMode = cmds.getAttr(shape + '.displayColorChannel', asString = True)
        SetDisplay(shape,curMode)
    Here's a quick script to toggle between the two different modes. The ".displayColorChannel" is the attribute you'll want to be getting and setting.




Sign In or Register to comment.