View Full Version : cmds.attrColorSliderGrp() question

08 August 2012, 04:03 PM
Hey guys,
I'm trying to create a color slider that will control color of multiple selected shaders. The ideal for this purpose will be attrColorSliderGrp command. In the python reference of Maya I found this example :
import maya.cmds as cmds

cmds.window( title='Attr Field Slider Groups' )
objName = cmds.shadingNode('phong', asShader=True)
cmds.attrColorSliderGrp( at='%s.color' % objName )
It's ok, but I can not figure out how to execute this operation on multiple objects?

Another solution will be - use colorSliderGrp command where dragCommand argument will be execute a procedure with setAttr command, looping through the selected objects. But I like attrColorSliderGrp more. :)

08 August 2012, 08:28 PM
short answer, you can't. attr sliders are specifically designed to be linked directly to one and only one attribute. If you want a slider to affect more than one thing you will have to do as you've already suggested and use the drag-change command on a standard slider control.

The other alternative would be to just connect the other multiple attributes to the attribute the slider is controlling...

08 August 2012, 09:52 PM
I second Nathan's suggestion to just create a dummy node with a color attribute on it. Connect this dummy node to all your Shaders, and connect the attrSliderGrp to the dummy node.

Much easier than dealing with drag commands in my opinion...

08 August 2012, 11:37 PM
Thank you guys! I like this idea of create an attribute controlled by attrSliderGrp.

CGTalk Moderation
08 August 2012, 11:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.