PDA

View Full Version : cmds.attrColorSliderGrp() question


Irakli
08-06-2012, 05: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.columnLayout()
cmds.attrColorSliderGrp( at='%s.color' % objName )
cmds.showWindow()
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. :)

NaughtyNathan
08-06-2012, 09: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...

rgkovach123
08-06-2012, 10: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...

Irakli
08-07-2012, 12:37 AM
Thank you guys! I like this idea of create an attribute controlled by attrSliderGrp.

CGTalk Moderation
08-07-2012, 12:37 AM
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.