Trying to control miDefaultOptions.contrastR, G,B, A with single attrFieldSliderGrp

the anti-aliasing contrast allows to change value of miDefaultOptions.contrastR, miDefaultOptions.contrastG,miDefaultOptions.contra stB, miDefaultOptions.contrastA with a single attrFieldSliderGrp in Mental Ray quality tab…

so I am trying to do it like [“miDefaultOptions.contrast”+i for i in[“R”,“G”,“B”,“A”]] but at accepts a string only so how can I just use one control to change this using python…?

cmds.attrFieldSliderGrp(“antiAliasControl”,at=[“miDefaultOptions.contrast”+i for i in[“R”,“G”,“B”,“A”]], min=0.0, max=24.0,l=‘Anti Alias’ )

Use a floatSliderGrp and have the changeCommand update all four contrast attributes with the value of the floatSlider.

well, I implemented it this way, but i do not get to see the updating of setAttr in output window like i get to see for it from Quality tab under mental ray


window = cmds.window(title='floatSliderGrp')
cmds.columnLayout()
val=cmds.floatSliderGrp("antiAliasControl", label='Group 2', cc="change()", field=True, minValue=0.0, maxValue=1.0,  value=cmds.getAttr("miDefaultOptions.contrastR") )
cmds.showWindow( window )

def change():
 
    valu = cmds.floatSliderGrp("antiAliasControl", q=True,v=True)
    cmds.setAttr("miDefaultOptions.contrastR", valu)
    cmds.setAttr("miDefaultOptions.contrastG", valu)
    cmds.setAttr("miDefaultOptions.contrastB", valu)
    cmds.setAttr("miDefaultOptions.contrastA", valu)

When you change the slider in the MR quality tab (or through an attrFieldSliderGrp), the command is passed into evalEcho which outputs the command to the script the editor.

You’d have to build the setAttr commands as strings and then print + eval them if you really want to see the command.

wont print cmds.setAttr(“miDefaultOptions.contrastA”, valu) be enough ?

No, that will print the return of setAttr.

you want


print "// %s %s %s;" % ( melCommand, attribname, value)

where you have the name of the mel command, the name of the attribute, and the value. The formatting prints it out in the listener in the mel comment style so it doesn’t get executed if you cut and paste it along with other stuff.

Theo beat me to it

Just means you’re actually working instead of fooling around on the net