I was just having another look at a piece of code I wrote for changing 
certain light parameters. 

When I run the code, Id love to be able to read that current value, then 
punch it in the respective field. It would also be cool if the UI Window 
refreshed on light selection, but that might be getting to fancy for my 
python skills!

Here's the code, appreciate any pointers :)

import maya.cmds as cmds

def intensity_value(colour_control): 
    selection = cmds.ls( selection=True )
    for sel in selection:
        cmds.setAttr('{0}.intensity'.format(sel),colour_control) 

def exposure_value(exposure_control): 
    selection = cmds.ls( selection=True )
    for sel in selection:
        cmds.setAttr('{0}.aiExposure'.format(sel),exposure_control)

def sample_value(sample_control): 
    selection = cmds.ls( selection=True )
    for sel in selection:
        cmds.setAttr('{0}.aiSamples'.format(sel),sample_control)

def myWindow():
    if cmds.window('ws_lightParameter', exists = True):
       cmds.deleteUI('ws_lightParameter')
       
    cmds.window('ws_lightParameter')
    cmds.columnLayout() 
    colour_control = cmds.floatSliderGrp(label='Intensity', field=True, 
maxValue=50.0, value=1, cc= intensity_value) 
    exposure_control = cmds.floatSliderGrp(label='Exposure', field=True, 
maxValue=50.0, value=0, cc= exposure_value)
    sample_control = cmds.intSliderGrp(label='Samples', field=True, 
minValue=1, maxValue=50.0, value=1, cc= sample_value)  
    cmds.showWindow('ws_lightParameter')

myWindow()





-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1b9135b6-f842-4dc2-81dd-1cce6a329396%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to