I’m struggling to reference UI controls outside of the init any clues how I get around this scope issue??
Thanks
import maya.cmds as cmds
class cameraToolsGUI():
def changePreset(self, arg):
self.spn_filmgateWidth.value = 100 #this line doesn't work.....
# class constructor - builds window, but no show yet
def __init__(self):
self.WIN = cmds.window(widthHeight=(420, 100), title = "Camera Tools")
#cmds.columnLayout(adj=1)
scrollLayout = cmds.scrollLayout(
horizontalScrollBarThickness=16,
verticalScrollBarThickness=16)
cmds.rowColumnLayout( numberOfColumns=1 )
cmds.optionMenu('ddl_cameraPresets', label='Camera Database', changeCommand=self.changePreset)
cmds.floatSliderGrp('spn_filmgateWidth', label='Film Width', field=True, minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=50000, value=0, precision=2)
cmds.showWindow()
def show(self):
cmds.showWindow(self.WIN)