def changeAnim(tsl, kOut, kOutFr): ''' load an animation curve into the keyframeOutliner ''' selItem = cmds.textScrollList(tsl, q=True, selectItem=True) splitSel = selItem[0].split(".") attr = splitSel[1] if (splitSel[1] == "tx"): attr = "translateX" elif (splitSel[1] == "ty"): attr = "translateY" elif (splitSel[1] == "tz"): attr = "translateZ" elif (splitSel[1] == "rx"): attr = "rotateX" elif (splitSel[1] == "ry"): attr = "rotateY" elif (splitSel[1] == "rz"): attr = "rotateZ" elif (splitSel[1] == "sx"): attr = "scaleX" elif (splitSel[1] == "sy"): attr = "scaleY" elif (splitSel[1] == "sz"): attr = "scaleZ" curveName = splitSel[0] + "_" + attr cmds.keyframeOutliner(kOut, e=True, animCurve=curveName)
def changeAnim(tsl, kOut, kOutFr): ''' Function that loads an animation curve into the keyframeOutliner ''' try: # run code, but catch errors # call the getAnimCurve function and assign result to curveName curveName = getAnimCurve(tsl) # check if animation curve exists for the selected attr if (cmds.objExists(curveName)): # edit the keyframeOutliner to load the animation curve cmds.keyframeOutliner(kOut, e=True, animCurve=curveName) # edit the text to specify the animation curve cmds.text('curveTxt', e=True, l="Current Curve: " + curveName) popAnimMenu(tsl) else: # no curve exists OpenMaya.MGlobal.displayWarning( "This attribute lacks an animation curve.") except TypeError: # white space of TSL is being selected OpenMaya.MGlobal.displayWarning( "You have clicked in a blank space, please select an item.") selObj(dTSL.getName(), 0)
def changeAnim(tsl, kOut, kOutFr): ''' load an animation curve into the keyframeOutliner ''' selItem = cmds.textScrollList( tsl, q=True, selectItem=True ) splitSel = selItem[0].split( "." ) attr = splitSel[1] if (splitSel[1] == "tx"): attr = "translateX" elif (splitSel[1] == "ty"): attr = "translateY" elif (splitSel[1] == "tz"): attr = "translateZ" elif (splitSel[1] == "rx"): attr = "rotateX" elif (splitSel[1] == "ry"): attr = "rotateY" elif (splitSel[1] == "rz"): attr = "rotateZ" elif (splitSel[1] == "sx"): attr = "scaleX" elif (splitSel[1] == "sy"): attr = "scaleY" elif (splitSel[1] == "sz"): attr = "scaleZ" curveName = splitSel[0] + "_" + attr cmds.keyframeOutliner( kOut, e=True, animCurve=curveName )
def changeAnim2(tsl, kOut): selItem = cmds.textScrollList( tsl, q=True, selectItem=True ) splitSel = selItem[0].split( "." ) attr="" if (splitSel[1] == "tx"): attr = "translateX" elif (splitSel[1] == "ty"): attr = "translateY" elif (splitSel[1] == "tz"): attr = "translateZ" elif (splitSel[1] == "rx"): attr = "rotateX" elif (splitSel[1] == "ry"): attr = "rotateY" elif (splitSel[1] == "rz"): attr = "rotateZ" elif (splitSel[1] == "sx"): attr = "scaleX" elif (splitSel[1] == "sy"): attr = "scaleY" elif (splitSel[1] == "sz"): attr = "scaleZ" else: attr = splitSel[1] curveName = splitSel[0] + "_" + attr cmds.keyframeOutliner( kOut, e=True, animCurve=curveName )
def changeAnim2(tsl, kOut): selItem = cmds.textScrollList(tsl, q=True, selectItem=True) splitSel = selItem[0].split(".") attr = "" if (splitSel[1] == "tx"): attr = "translateX" elif (splitSel[1] == "ty"): attr = "translateY" elif (splitSel[1] == "tz"): attr = "translateZ" elif (splitSel[1] == "rx"): attr = "rotateX" elif (splitSel[1] == "ry"): attr = "rotateY" elif (splitSel[1] == "rz"): attr = "rotateZ" elif (splitSel[1] == "sx"): attr = "scaleX" elif (splitSel[1] == "sy"): attr = "scaleY" elif (splitSel[1] == "sz"): attr = "scaleZ" else: attr = splitSel[1] curveName = splitSel[0] + "_" + attr cmds.keyframeOutliner(kOut, e=True, animCurve=curveName)
def addCrv(tsl): ''' add animation curves from selected object to the textScrollList ''' # grab selected item from the scene selItem = cmds.ls(sl=True) # list animation curves into variable animCrv = cmds.listConnections(selItem, source=True, t="animCurve") cmds.textScrollList(tsl, e=True, append=animCrv, selectItem=animCrv[0]) cmds.keyframeOutliner('keyOutline', e=True, animCurve=animCrv[0]) '''
def addCrv(tsl): ''' add animation curves from selected object to the textScrollList ''' # grab selected item from the scene selItem = cmds.ls( sl=True ) # list animation curves into variable animCrv = cmds.listConnections( selItem, source=True, t="animCurve" ) cmds.textScrollList( tsl, e=True, append=animCrv, selectItem=animCrv[0] ) cmds.keyframeOutliner( 'keyOutline', e=True, animCurve=animCrv[0] ) '''
def changeAnim( tsl, kOut, kOutFr ): ''' Function that loads an animation curve into the keyframeOutliner ''' try: # run code, but catch errors # call the getAnimCurve function and assign result to curveName curveName = getAnimCurve( tsl ) # check if animation curve exists for the selected attr if ( cmds.objExists( curveName ) ): # edit the keyframeOutliner to load the animation curve cmds.keyframeOutliner( kOut, e=True, animCurve=curveName ) # edit the text to specify the animation curve cmds.text( 'curveTxt', e=True, l="Current Curve: " + curveName ) popAnimMenu( tsl ) else: # no curve exists OpenMaya.MGlobal.displayWarning( "This attribute lacks an animation curve." ) except TypeError: # white space of TSL is being selected OpenMaya.MGlobal.displayWarning( "You have clicked in a blank space, please select an item." ) selObj( dTSL.getName(), 0 )
def keyframeOutliner(*args, **kwargs): if len(args): doPassSelf = kwargs.pop('passSelf', False) else: doPassSelf = False for key in ['dgc', 'dpc', 'dragCallback', 'dropCallback', 'vcc', 'visibleChangeCommand']: try: cb = kwargs[key] if callable(cb): kwargs[key] = _factories.makeUICallback(cb, args, doPassSelf) except KeyError: pass res = cmds.keyframeOutliner(*args, **kwargs) return res
def makeGUI(wWid, wHigh, f1H, f2H, f3H): ''' create the GUI for Mac format ''' # check to see if the GUI exists checkGUI(winName) # create a variable to set the width of the window frWidth = wWid - 10 # create the window win1 = Window(winName, 'Quick SDK GUI', wWid, wHigh) # create columnLayout as main layout cmds.formLayout('mainForm', w=frWidth) # create a frameLayout to encapsulate and label the window elements cmds.frameLayout('mainFrame', label="Quick SDK", borderStyle='etchedIn', w=frWidth) # create formLayout as a pad layout for the Window cmds.formLayout('padForm', h=300) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout('drvrFrame', label="Driver:", borderStyle='etchedIn', collapsable=True) # create formLayout as a pad layout for the Driver Section cmds.formLayout('drvrPadForm', height=f1H) # height is 54 on Mac, 43 on PC # create variable for the textField widths tFld1W = 120 tFld2W = 60 #tFld3W = 80 # create a rowColumnLayout for the Driver Section cmds.rowColumnLayout('drvrMainLayout', nc=4, cw=([1, tFld1W], [2, tFld2W], [3, tFld2W], [4, tFld2W])) # create GUI elements for Driver nTxt = Text('nameTxt', "Name:", 50) aTxt = Text('attrTxt', "Attr:", 50) bTxt1 = Text('blankTxt1', " ", 50) bTxt2 = Text('blankTxt2', " ", 50) global drvr1 drvr1 = TextField('drvrNameFld', tFld1W, "Driver") global drvr2 drvr2 = TextField('drvrAttrFld', tFld2W, "Attribute") lBtn1 = Button('drvrBtn', "Load Sel", tFld2W, Callback(loadSel, drvr1.name, drvr2.name)) lBtn1.setAnn( "Loads a selected driver object and a selected attribute from the channel box." ) selObjBtn = Button('selDrvrBtn', "Sel Obj", tFld2W, Callback(selObj, drvr1.name, 1)) selObjBtn.setAnn( "Selects the driver object specified in the driver field.") # close the driver rowColumnLayout cmds.setParent("..") # close the driver formLayout cmds.setParent("..") # close the driver frameLayout cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout('drvnFrame', label="Driven:", borderStyle='etchedIn', collapsable=True) # create formLayout as a pad layout for the Driven Section cmds.formLayout('drvnPadForm', height=f2H) # height is 105 on Mac, 115 on PC # create a columnLayout cmds.rowLayout('drvnMainLayout', nc=2, cw=([1, 175], [2, 70])) # create a textScrollList for the driven objects and attrs global dTSL dTSL = TSL('drvnTSL', 1, 175, 100, Callback(changeAnim, 'drvnTSL', 'keyOutline', 'keyOutFrame')) # create variables for width values tslBtnW1 = 50 tslBtnW2 = 70 # create a columnLayout to enclose the TSL buttons cmds.columnLayout('tslBtnCol') # consider looping these # create TSL buttons addBtn1 = Button('addBtn', "Add", tslBtnW2, Callback(addObj, dTSL.name)) addBtn1.setAnn( "Adds driven objects an selected attributes to the textScrollList.") rAllBtn1 = Button('remAllBtn', "Remove All", tslBtnW2, Callback(dTSL.clearAll)) rAllBtn1.setAnn("Removes all objects from the textScrollList.") rSelBtn1 = Button('remSelBtn', "Remove Sel", tslBtnW2, Callback(dTSL.clearSel)) rSelBtn1.setAnn("Removes selected objects from the textScrollList.") delAnimBtn1 = Button('delAnimBtn', "Del Keys", tslBtnW2, Callback(delAnim, dTSL.name)) delAnimBtn1.setAnn( "Deletes animation curve associated with this attribute, right click for menu." ) revAnimBtn1 = Button('revAnimBtn', "Reverse", tslBtnW2, Callback(revAnim, dTSL.name)) revAnimBtn1.setAnn( "Reverses the driven values of the animation curve associated with this attribute." ) # create popUpMenu for Del Keys button global animIndexMenu animIndexMenu = cmds.popupMenu('dr1Pop', parent=delAnimBtn1.name, button=3) cmds.menuItem(label="Del Index:") cmds.menuItem(divider=True) cmds.menuItem(label="No animation curves present") # close the driven columnLayout cmds.setParent("..") # close the button rowLayout cmds.setParent("..") # close the driven formLayout cmds.setParent("..") # close the driven frameLayout cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout('valFrame', label="Values:", borderStyle='etchedIn', collapsable=True) # create formLayout as a pad layout for the Value Section cmds.formLayout('valPadForm', height=f3H) # height is 125 on Mac, 111 on PC # create a columnLayout cmds.columnLayout('valMainLayout') # create a rowLayout cmds.rowLayout(nc=2, cw2=[50, 50]) # create text element to identify the value optionMenu vNumTxt1 = Text('valNumTxt1', "Value #: ", 50) # create optionMenu to determine # of SDKs to perform sdkOptName = cmds.optionMenu('sdkOpt', w=50) sdkOptNum = ['1', '2', '3', '4', '5'] for num in sdkOptNum: cmds.menuItem(label=num) # close the rowLayout cmds.setParent("..") # create a rowColumnLayout cmds.rowLayout(nc=2) # create a columnLayout cmds.columnLayout(w=100) # create text elements to identify the value fields blIdTxt1 = Text('blankIdTxt1', " ", 100) drIdTxt1 = Text('driverIdTxt1', "Driver Values: ", 100) dnIdTxt1 = Text('drivenIdTxt1', "Driven Values: ", 100) # close the columnLayout cmds.setParent("..") # create variables to control width values fldVal1 = 40 fldVal2 = 60 # create a rowColumnLayout for the text and value fields cmds.rowColumnLayout(nc=5, w=200, cw=([1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1])) ''' loop the creation of these ''' # create text to describe the floatFields using the Text class valTxtNums = ["1", "2", "3", "4", "5"] valTxtNames = ['valTxt1', 'valTxt2', 'valTxt3', 'valTxt4', 'valTxt5'] valTxt = [] # declare counter i = 0 for num in valTxtNums: valTxt.append(Text(valTxtNames[i], "%s:" % (num), fldVal1)) # increment counter i += 1 # create floatFields for the driver using the FloatField class drValFldNames = [ 'drFltFld1', 'drFltFld2', 'drFltFld3', 'drFltFld4', 'drFltFld5' ] drValFld = [] for name in drValFldNames: drValFld.append(FloatField(name, fldVal1, 0.0, 2)) # create floatFields for the driven using the FloatField class dnValFldNames = [ 'dnFltFld1', 'dnFltFld2', 'dnFltFld3', 'dnFltFld4', 'dnFltFld5' ] dnValFld = [] for name in dnValFldNames: drValFld.append(FloatField(name, fldVal1, 0.0, 2)) # create popupMenus for each floatField # declare counter i = 0 while (i < len(valTxtNums)): # create popupMenu to load attribute values and inverse into driver fields cmds.popupMenu('dr%sPop' % (str(i + 1)), parent=drValFldNames[i], button=3) cmds.menuItem(label="Load Attr Value", c=Callback(loadAttrVal, 'dr', str(i + 1), 1)) cmds.menuItem(label="Load Inverse Value", c=Callback(loadAttrVal, 'dr', str(i + 1), -1)) # create popupMenu to load attribute values and inverse into driven fields cmds.popupMenu('dn%sPop' % (str(i + 1)), parent=dnValFldNames[i], button=3) cmds.menuItem(label="Load Attr Value", c=Callback(loadAttrVal, 'dn', str(i + 1), 1)) cmds.menuItem(label="Load Inverse Value", c=Callback(loadAttrVal, 'dn', str(i + 1), -1)) # increment counter i += 1 # close the rowColumnLayout cmds.setParent("..") # close the rowColumnLayout cmds.setParent("..") # create button to run sdk function sdkBtn = Button('sdkBtn', "Create SDK", 80, Callback(makeSdk, sdkOptName)) sdkBtn.setAnn( "Sets Driven Keyframes based on information provided above to the UI.") # close the columnLayout cmds.setParent("..") # close the formLayout cmds.setParent("..") # close the frameLayout cmds.setParent("..") # create a text object to identify the current animation curve crvTxt = cmds.text('curveTxt', l="Current Curve: No Curve Selected") # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout('keyOutFrame', l="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150) # create a formLayout to contain the keyframeOutliner cmds.formLayout('keyForm') # create a keyframeOutliner keyOut = cmds.keyframeOutliner('keyOutline', dsp="narrow", animCurve='animCurve1') # close the formLayout cmds.setParent("..") # close the frameLayout cmds.setParent("..") # edit the main formLayout cmds.formLayout('mainForm', e=True, af=[('mainFrame', "left", 5), ('mainFrame', "top", 5), ('mainFrame', "right", 5)]) # edit the pad window formLayout cmds.formLayout('padForm', e=True, af=[(drvrFr, "left", 5), (drvrFr, "top", 5), (drvrFr, "right", 5)], ac=[(drvnFr, "top", 5, drvrFr), (valFr, "top", 5, drvnFr), (crvTxt, "top", 5, valFr), (keyFr, "top", 0, crvTxt)], aoc=[(drvnFr, "left", 0, drvrFr), (drvnFr, "right", 0, drvrFr), (valFr, "left", 0, drvrFr), (valFr, "right", 0, drvrFr), (crvTxt, "left", 0, drvrFr), (crvTxt, "right", 0, drvrFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, drvnFr)]) # edit the pad driver formLayout cmds.formLayout('drvrPadForm', e=True, af=[('drvrMainLayout', "left", 5), ('drvrMainLayout', "top", 5), ('drvrMainLayout', "right", 5)]) # edit the pad driven formLayout cmds.formLayout('drvnPadForm', e=True, af=[('drvnMainLayout', "left", 5), ('drvnMainLayout', "top", 5), ('drvnMainLayout', "right", 5)]) # edit the pad value formLayout cmds.formLayout('valPadForm', e=True, af=[('valMainLayout', "left", 5), ('valMainLayout', "top", 5), ('valMainLayout', "right", 5)]) # edit the keyOutline formLayout cmds.formLayout('keyForm', e=True, af=[(keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0)]) # show the window win1.show()
def changeAnim(tsl, kOut): selItem = cmds.textScrollList(tsl, q=True, selectItem=True) cmds.keyframeOutliner(kOut, e=True, animCurve=selItem[0])
def macGUI(): ''' create the GUI for Mac format ''' # check to see if the GUI exists checkGUI() # create a variable to set the width of the window width = 430 # create the window win1 = Window( winName, 'Quick SDK GUI', width, 480 ) # create columnLayout as main layout cmds.formLayout( 'mainForm' ) # create a frameLayout to encapsulate and label the window elements cmds.frameLayout('mainFrame', label="Quick SDK", borderStyle='etchedIn', w=370 ) # create formLayout as a sub layout cmds.formLayout( 'subForm', h=300 ) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout('drvrFrame', label="Driver:", borderStyle='etchedIn' ) # create variable for the textField widths tFld1W = 120 tFld2W = 60 tFld3W = 80 # create a rowColumnLayout for the Driver cmds.rowColumnLayout(nc=3, cw= ([1, tFld1W], [2, tFld2W], [3, tFld3W]) ) # create GUI elements for Driver nTxt = Text( 'nameTxt', "Name:", 50 ) aTxt = Text( 'attrTxt', "Attr:", 50 ) bTxt1 = Text( 'blankTxt1', " ", 50 ) drvr1 = TextField( 'drvrNameFld', tFld1W, "Driver" ) drvr2 = TextField( 'drvrAttrFld', tFld2W, "Attribute" ) lBtn1 = Button('drvrBtn', "Load Selected", tFld3W, scriptName + ".loadSel()") # close the driver rowColumnLayout cmds.setParent( ".." ) # close the driver frameLayout cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout('drvnFrame', label="Driven:", borderStyle='etchedIn' ) # create a columnLayout cmds.columnLayout() # create variable for the tsl selectCommand selCmd=scriptName + ".changeAnim('drvnTSL','keyOutline', 'keyOutFrame')" # create a textScrollList for the driven objects and attrs dTSL = TSL( 'drvnTSL', 1, 100, selCmd ) #cmds.textScrollList( 'drvnTSL', ams=True, h=100, selectCommand=scriptName + ".changeAnim2('drvnTSL','keyOutline')" ) # create variables for width values tslBtnW1 = 50 tslBtnW2 = 70 # create a rowLayout to eonclose the TSL buttons cmds.rowLayout( nc=3, cw3= (tslBtnW1, tslBtnW2, tslBtnW2) ) addBtn1 = Button( 'addBtn', "Add", tslBtnW1, scriptName + ".addObj('drvnTSL')" ) rAllBtn1 = Button( 'remAllBtn', "Remove All", tslBtnW2, scriptName + ".clearAll('drvnTSL')" ) rSelBtn1 = Button( 'remSelBtn', "Remove Sel", tslBtnW2, scriptName + ".clearSel('drvnTSL')" ) # close the button rowLayout cmds.setParent( ".." ) # close the driven columnLayout cmds.setParent( ".." ) # close the driven frameLayout cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout('valFrame', label="Values:", borderStyle='etchedIn' ) # create a columnLayout cmds.columnLayout() # create optionMenu to determine # of SDKs to perform cmds.optionMenu( 'sdkOpt', w=50 ) cmds.menuItem( label='1' ) cmds.menuItem( label='2' ) cmds.menuItem( label='3' ) cmds.menuItem( label='4' ) cmds.menuItem( label='5' ) fldVal1=40 fldVal2=60 ''' flt1 = cmds.floatFieldGrp( 'fld1Grp', nf=5, value1=0.0, value2=0.0, value3=0.0, value4=0.0, value5=0.0, pre=2, cw=( [1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1]) ) ''' # create a rowColumnLayout for the text and value fields cmds.rowColumnLayout(nc=5, cw= ([1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1]) ) # create text to describe the floatFields using the Text class valTxt1 = Text( 'valTxt1', "1:", fldVal1 ) valTxt2 = Text( 'valTxt2', "2:", fldVal1 ) valTxt3 = Text( 'valTxt3', "3:", fldVal1 ) valTxt4 = Text( 'valTxt4', "4:", fldVal1 ) valTxt5 = Text( 'valTxt5', "5:", fldVal1 ) # create floatFields for the driver using the FloatField class drFlt1 = FloatField( 'drFltFld1', fldVal1, 0.0, 2 ) drFlt2 = FloatField( 'drFltFld2', fldVal1, 0.0, 2 ) drFlt3 = FloatField( 'drFltFld3', fldVal1, 0.0, 2 ) drFlt4 = FloatField( 'drFltFld4', fldVal1, 0.0, 2 ) drFlt5 = FloatField( 'drFltFld5', fldVal1, 0.0, 2 ) # create floatFields for the driven using the FloatField class dnFlt1 = FloatField( 'dnFltFld1', fldVal1, 0.0, 2 ) dnFlt2 = FloatField( 'dnFltFld2', fldVal1, 0.0, 2 ) dnFlt3 = FloatField( 'dnFltFld3', fldVal1, 0.0, 2 ) dnFlt4 = FloatField( 'dnFltFld4', fldVal1, 0.0, 2 ) dnFlt5 = FloatField( 'dnFltFld5', fldVal1, 0.0, 2 ) # close the rowColumnLayout cmds.setParent( ".." ) # create variable for the sdk command sdkCmd = scriptName + ".makeSdk( 'drFltFld1', 'drFltFld2', 'drFltFld3', 'drFltFld4', 'drFltFld5', 'dnFltFld1', 'dnFltFld2', 'dnFltFld3', 'dnFltFld4', 'dnFltFld5' )" sdkCmd = scriptName + ".makeSdk()" # create button to run sdk function sdkBtn = Button( 'sdkBtn', "Create SDK", 80, sdkCmd ) # close the columnLayout cmds.setParent( ".." ) # close the frameLayout cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout('keyOutFrame', l="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150 ) # create a formLayout to contain the keyframeOutliner cmds.formLayout( 'keyForm' ) # create a keyframeOutliner keyOut = cmds.keyframeOutliner( 'keyOutline', dsp="narrow", animCurve='animCurve1' ) # close the formLayout cmds.setParent( ".." ) # close the frameLayout cmds.setParent( ".." ) # edit the main formLayout cmds.formLayout( 'mainForm', e=True, af=[ ( 'mainFrame', "left", 5), ('mainFrame', "top", 5) ] ) # edit the sub formLayout cmds.formLayout( 'subForm', e=True, af=[ (drvrFr, "left", 5), (drvrFr, "top", 5), (drvrFr, "right", 5)], ac=[ (drvnFr, "top", 5, drvrFr), (valFr, "top", 5, drvnFr), (keyFr, "top", 5, valFr)], aoc=[ (drvnFr, "left", 0, drvrFr), (drvnFr, "right", 0, drvrFr), (valFr, "left", 0, drvrFr), (valFr, "right", 0, drvrFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, drvnFr)] ) # edit the keyOutline formLayout cmds.formLayout( 'keyForm', e=True, af=[ (keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0) ] ) # show the window win1.show( winName )
def guiCreate(): # if the window exists, delete it if (cmds.window(winName, ex=True)): cmds.deleteUI(winName) width = 430 # create the window cmds.window(winName, w=width, h=480) # create columnLayout as main layout cmds.formLayout('mainForm') # create a frameLayout to encapsulate and label the window elements cmds.frameLayout('mainFrame', label="Quick SDK", borderStyle='etchedIn', w=width - 10) # create columnLayout as main layout cmds.formLayout('subForm', w=width - 20, h=300) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout('drvrFrame', label="Driver:", borderStyle='etchedIn') # create variable for the textField widths tFld1W = 120 tFld2W = 60 tFld3W = 80 cmds.columnLayout() cmds.rowLayout(nc=3, cw3=(tFld1W, tFld2W, tFld3W)) # create GUI elements for Driver cmds.text('nameTxt', l="Name:", w=50) cmds.text('attrTxt', l="Attr:", w=50) blankTxt1 = cmds.text(l=" ") cmds.setParent("..") cmds.rowLayout(nc=3, cw3=(tFld1W, tFld2W, tFld3W)) drvr1 = cmds.textField('drvrNameFld', w=tFld1W) drvr2 = cmds.textField('drvrAttrFld', w=tFld2W) cmds.button('drvrBtn', label="Load Selected", w=tFld3W, c=scriptName + ".loadSel()") cmds.setParent("..") cmds.setParent("..") cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout('drvnFrame', label="Driven:", borderStyle='etchedIn') cmds.columnLayout() # create driven textScrollList cmds.textScrollList('drvnTSL', ams=True, h=100, selectCommand=scriptName + ".changeAnim2('drvnTSL','keyOutline')") tslBtnW1 = 50 tslBtnW2 = 70 cmds.rowLayout(nc=3, cw3=(tslBtnW1, tslBtnW2, tslBtnW2)) cmds.button('addBtn', label="Add", w=tslBtnW1, c=scriptName + ".addObj('drvnTSL')") cmds.button('remAllBtn', label="Remove All", w=tslBtnW2, c=scriptName + ".clearAll('drvnTSL')") cmds.button('remSelBtn', label="Remove Sel", w=tslBtnW2, c=scriptName + ".clearSel('drvnTSL')") cmds.setParent("..") cmds.setParent("..") cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout('valFrame', label="Values:", borderStyle='etchedIn') cmds.columnLayout() fldVal1 = 80 fldVal2 = 40 cmds.rowLayout(nc=3, cw3=(fldVal1, fldVal2, fldVal2)) blankTxt2 = cmds.text(l=" ") cmds.text('drvrFldTxt', l="Driver:", w=fldVal2) cmds.text('drvnFldTxt', l="Driven:", w=fldVal2) cmds.setParent("..") flt1 = cmds.floatFieldGrp('fld1Grp', nf=2, label='1 (Default):', value1=0.0, value2=0.0, pre=2, cw3=(fldVal1, fldVal2, fldVal2)) flt2 = cmds.floatFieldGrp('fld2Grp', nf=2, label='2:', value1=0.0, value2=0.0, pre=2, cw3=(fldVal1, fldVal2, fldVal2)) flt3 = cmds.floatFieldGrp('fld3Grp', nf=2, label='3:', value1=0.0, value2=0.0, pre=2, cw3=(fldVal1, fldVal2, fldVal2)) flt4 = cmds.floatFieldGrp('fld4Grp', nf=2, label='4:', value1=0.0, value2=0.0, pre=2, cw3=(fldVal1, fldVal2, fldVal2)) flt5 = cmds.floatFieldGrp('fld5Grp', nf=2, label='5:', value1=0.0, value2=0.0, pre=2, cw3=(fldVal1, fldVal2, fldVal2)) val1 = 50 val2 = 80 cmds.rowLayout(nc=2, cw2=(val1, val2)) # create optionMenu to determine # of SDKs to perform cmds.optionMenu('sdkOpt', w=val1) cmds.menuItem(label='1') cmds.menuItem(label='2') cmds.menuItem(label='3') cmds.menuItem(label='4') cmds.menuItem(label='5') #fill = " , " #passSdk = ".makeSdk( " + flt1 + fill + flt2 + fill + flt3 + fill + flt4 + fill + flt5 + " )" # create button to run sdk function cmds.button( 'sdkBtn', l="Create SDK", w=val2, c=scriptName + ".makeSdk( 'fld1Grp', 'fld2Grp', 'fld3Grp', 'fld4Grp', 'fld5Grp' )") cmds.setParent("..") cmds.setParent("..") cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements animCvFr = cmds.frameLayout('animCrvFrame', label="Animation Curves:", borderStyle='etchedIn', h=150) cmds.columnLayout() # create driven textScrollList animTSL = cmds.textScrollList('animTSL', h=100, selectCommand=scriptName + ".changeAnim('animTSL','keyOutline')") cmds.rowLayout(nc=3, cw3=(tslBtnW1, tslBtnW2, tslBtnW2)) cmds.button('addBtn2', label="Add", w=tslBtnW1, c=scriptName + ".addCrv('animTSL')") cmds.button('remAllBtn2', label="Remove All", w=tslBtnW2, c=scriptName + ".clearAll('animTSL')") cmds.button('remSelBtn2', label="Remove Sel", w=tslBtnW2, c=scriptName + ".clearSel('animTSL')") cmds.setParent("..") cmds.setParent("..") cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout('keyOutFrame', label="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150) cmds.formLayout('keyForm') #cmds.columnLayout() keyOut = cmds.keyframeOutliner('keyOutline', dsp="narrow", animCurve='animCurve1') cmds.setParent("..") cmds.setParent("..") offVal = 5 # edit the main formLayout cmds.formLayout('mainForm', e=True, af=[('mainFrame', "left", 5), ('mainFrame', "top", 5)]) # edit the sub formLayout cmds.formLayout('subForm', e=True, af=[(drvrFr, "left", 5), (drvrFr, "top", 5)], ac=[(drvnFr, "top", 5, drvrFr), (valFr, "left", 5, drvnFr), (animCvFr, "top", 5, drvnFr), (keyFr, "top", 5, animCvFr)], aoc=[(drvnFr, "left", 0, drvrFr), (valFr, "top", 0, drvnFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, valFr), (animCvFr, "left", 0, drvrFr)]) # edit the keyOutline formLayout cmds.formLayout('keyForm', e=True, af=[(keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0)]) # show the window cmds.showWindow(winName)
def guiCreate(): # if the window exists, delete it if ( cmds.window( winName, ex=True ) ): cmds.deleteUI( winName ) width = 430 # create the window cmds.window( winName, w=width, h=480 ) # create columnLayout as main layout cmds.formLayout( 'mainForm' ) # create a frameLayout to encapsulate and label the window elements cmds.frameLayout('mainFrame', label="Quick SDK", borderStyle='etchedIn', w=width-10 ) # create columnLayout as main layout cmds.formLayout( 'subForm', w=width-20, h=300 ) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout('drvrFrame', label="Driver:", borderStyle='etchedIn') # create variable for the textField widths tFld1W = 120 tFld2W = 60 tFld3W = 80 cmds.columnLayout() cmds.rowLayout( nc=3, cw3= (tFld1W, tFld2W, tFld3W) ) # create GUI elements for Driver cmds.text( 'nameTxt', l="Name:", w=50 ) cmds.text( 'attrTxt', l="Attr:", w=50 ) blankTxt1 = cmds.text( l=" ") cmds.setParent( ".." ) cmds.rowLayout( nc=3, cw3= (tFld1W, tFld2W, tFld3W) ) drvr1 = cmds.textField( 'drvrNameFld', w=tFld1W ) drvr2 = cmds.textField( 'drvrAttrFld', w=tFld2W ) cmds.button( 'drvrBtn', label="Load Selected", w=tFld3W, c=scriptName + ".loadSel()" ) cmds.setParent( ".." ) cmds.setParent( ".." ) cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout('drvnFrame', label="Driven:", borderStyle='etchedIn' ) cmds.columnLayout() # create driven textScrollList cmds.textScrollList( 'drvnTSL', ams=True, h=100, selectCommand=scriptName + ".changeAnim2('drvnTSL','keyOutline')" ) tslBtnW1 = 50 tslBtnW2 = 70 cmds.rowLayout( nc=3, cw3= (tslBtnW1, tslBtnW2, tslBtnW2) ) cmds.button( 'addBtn', label="Add", w=tslBtnW1, c=scriptName + ".addObj('drvnTSL')" ) cmds.button( 'remAllBtn', label="Remove All", w=tslBtnW2, c=scriptName + ".clearAll('drvnTSL')" ) cmds.button( 'remSelBtn', label="Remove Sel", w=tslBtnW2, c=scriptName + ".clearSel('drvnTSL')" ) cmds.setParent( ".." ) cmds.setParent( ".." ) cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout('valFrame', label="Values:", borderStyle='etchedIn' ) cmds.columnLayout() fldVal1=80 fldVal2=40 cmds.rowLayout(nc=3, cw3=( fldVal1, fldVal2, fldVal2 ) ) blankTxt2 = cmds.text( l=" ") cmds.text( 'drvrFldTxt', l="Driver:", w=fldVal2 ) cmds.text( 'drvnFldTxt', l="Driven:", w=fldVal2 ) cmds.setParent( ".." ) flt1 = cmds.floatFieldGrp( 'fld1Grp', nf=2, label='1 (Default):', value1=0.0, value2=0.0, pre=2, cw3=( fldVal1, fldVal2, fldVal2 ) ) flt2 = cmds.floatFieldGrp( 'fld2Grp', nf=2, label='2:', value1=0.0, value2=0.0, pre=2, cw3=( fldVal1, fldVal2, fldVal2 ) ) flt3 = cmds.floatFieldGrp( 'fld3Grp', nf=2, label='3:', value1=0.0, value2=0.0, pre=2, cw3=( fldVal1, fldVal2, fldVal2 ) ) flt4 = cmds.floatFieldGrp( 'fld4Grp', nf=2, label='4:', value1=0.0, value2=0.0, pre=2, cw3=( fldVal1, fldVal2, fldVal2 ) ) flt5 = cmds.floatFieldGrp( 'fld5Grp', nf=2, label='5:', value1=0.0, value2=0.0, pre=2, cw3=( fldVal1, fldVal2, fldVal2 ) ) val1 = 50 val2 = 80 cmds.rowLayout(nc=2, cw2=( val1, val2 ) ) # create optionMenu to determine # of SDKs to perform cmds.optionMenu( 'sdkOpt', w=val1 ) cmds.menuItem( label='1' ) cmds.menuItem( label='2' ) cmds.menuItem( label='3' ) cmds.menuItem( label='4' ) cmds.menuItem( label='5' ) #fill = " , " #passSdk = ".makeSdk( " + flt1 + fill + flt2 + fill + flt3 + fill + flt4 + fill + flt5 + " )" # create button to run sdk function cmds.button( 'sdkBtn', l="Create SDK", w=val2, c=scriptName + ".makeSdk( 'fld1Grp', 'fld2Grp', 'fld3Grp', 'fld4Grp', 'fld5Grp' )" ) cmds.setParent( ".." ) cmds.setParent( ".." ) cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements animCvFr = cmds.frameLayout('animCrvFrame', label="Animation Curves:", borderStyle='etchedIn', h=150 ) cmds.columnLayout() # create driven textScrollList animTSL = cmds.textScrollList( 'animTSL', h=100, selectCommand=scriptName + ".changeAnim('animTSL','keyOutline')" ) cmds.rowLayout( nc=3, cw3= (tslBtnW1, tslBtnW2, tslBtnW2) ) cmds.button( 'addBtn2', label="Add", w=tslBtnW1, c=scriptName + ".addCrv('animTSL')" ) cmds.button( 'remAllBtn2', label="Remove All", w=tslBtnW2, c=scriptName + ".clearAll('animTSL')" ) cmds.button( 'remSelBtn2', label="Remove Sel", w=tslBtnW2, c=scriptName + ".clearSel('animTSL')" ) cmds.setParent( ".." ) cmds.setParent( ".." ) cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout('keyOutFrame', label="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150 ) cmds.formLayout( 'keyForm' ) #cmds.columnLayout() keyOut = cmds.keyframeOutliner( 'keyOutline', dsp="narrow", animCurve='animCurve1' ) cmds.setParent( ".." ) cmds.setParent( ".." ) offVal = 5 # edit the main formLayout cmds.formLayout( 'mainForm', e=True, af=[ ( 'mainFrame', "left", 5), ('mainFrame', "top", 5) ] ) # edit the sub formLayout cmds.formLayout( 'subForm', e=True, af=[ (drvrFr, "left", 5), (drvrFr, "top", 5) ], ac=[ (drvnFr, "top", 5, drvrFr), (valFr, "left", 5, drvnFr), (animCvFr, "top", 5, drvnFr), (keyFr, "top", 5, animCvFr) ], aoc=[ (drvnFr, "left", 0, drvrFr), (valFr, "top", 0, drvnFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, valFr), (animCvFr, "left", 0, drvrFr) ] ) # edit the keyOutline formLayout cmds.formLayout( 'keyForm', e=True, af=[ (keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0) ] ) # show the window cmds.showWindow(winName)
def macGUI(): ''' create the GUI for Mac format ''' # check to see if the GUI exists checkGUI() # create a variable to set the width of the window width = 430 # create the window win1 = Window(winName, 'Quick SDK GUI', width, 480) # create columnLayout as main layout cmds.formLayout('mainForm') # create a frameLayout to encapsulate and label the window elements cmds.frameLayout('mainFrame', label="Quick SDK", borderStyle='etchedIn', w=370) # create formLayout as a sub layout cmds.formLayout('subForm', h=300) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout('drvrFrame', label="Driver:", borderStyle='etchedIn') # create variable for the textField widths tFld1W = 120 tFld2W = 60 tFld3W = 80 # create a rowColumnLayout for the Driver cmds.rowColumnLayout(nc=3, cw=([1, tFld1W], [2, tFld2W], [3, tFld3W])) # create GUI elements for Driver nTxt = Text('nameTxt', "Name:", 50) aTxt = Text('attrTxt', "Attr:", 50) bTxt1 = Text('blankTxt1', " ", 50) drvr1 = TextField('drvrNameFld', tFld1W, "Driver") drvr2 = TextField('drvrAttrFld', tFld2W, "Attribute") lBtn1 = Button('drvrBtn', "Load Selected", tFld3W, scriptName + ".loadSel()") # close the driver rowColumnLayout cmds.setParent("..") # close the driver frameLayout cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout('drvnFrame', label="Driven:", borderStyle='etchedIn') # create a columnLayout cmds.columnLayout() # create variable for the tsl selectCommand selCmd = scriptName + ".changeAnim('drvnTSL','keyOutline', 'keyOutFrame')" # create a textScrollList for the driven objects and attrs dTSL = TSL('drvnTSL', 1, 100, selCmd) #cmds.textScrollList( 'drvnTSL', ams=True, h=100, selectCommand=scriptName + ".changeAnim2('drvnTSL','keyOutline')" ) # create variables for width values tslBtnW1 = 50 tslBtnW2 = 70 # create a rowLayout to eonclose the TSL buttons cmds.rowLayout(nc=3, cw3=(tslBtnW1, tslBtnW2, tslBtnW2)) addBtn1 = Button('addBtn', "Add", tslBtnW1, scriptName + ".addObj('drvnTSL')") rAllBtn1 = Button('remAllBtn', "Remove All", tslBtnW2, scriptName + ".clearAll('drvnTSL')") rSelBtn1 = Button('remSelBtn', "Remove Sel", tslBtnW2, scriptName + ".clearSel('drvnTSL')") # close the button rowLayout cmds.setParent("..") # close the driven columnLayout cmds.setParent("..") # close the driven frameLayout cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout('valFrame', label="Values:", borderStyle='etchedIn') # create a columnLayout cmds.columnLayout() # create optionMenu to determine # of SDKs to perform cmds.optionMenu('sdkOpt', w=50) cmds.menuItem(label='1') cmds.menuItem(label='2') cmds.menuItem(label='3') cmds.menuItem(label='4') cmds.menuItem(label='5') fldVal1 = 40 fldVal2 = 60 ''' flt1 = cmds.floatFieldGrp( 'fld1Grp', nf=5, value1=0.0, value2=0.0, value3=0.0, value4=0.0, value5=0.0, pre=2, cw=( [1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1]) ) ''' # create a rowColumnLayout for the text and value fields cmds.rowColumnLayout(nc=5, cw=([1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1])) # create text to describe the floatFields using the Text class valTxt1 = Text('valTxt1', "1:", fldVal1) valTxt2 = Text('valTxt2', "2:", fldVal1) valTxt3 = Text('valTxt3', "3:", fldVal1) valTxt4 = Text('valTxt4', "4:", fldVal1) valTxt5 = Text('valTxt5', "5:", fldVal1) # create floatFields for the driver using the FloatField class drFlt1 = FloatField('drFltFld1', fldVal1, 0.0, 2) drFlt2 = FloatField('drFltFld2', fldVal1, 0.0, 2) drFlt3 = FloatField('drFltFld3', fldVal1, 0.0, 2) drFlt4 = FloatField('drFltFld4', fldVal1, 0.0, 2) drFlt5 = FloatField('drFltFld5', fldVal1, 0.0, 2) # create floatFields for the driven using the FloatField class dnFlt1 = FloatField('dnFltFld1', fldVal1, 0.0, 2) dnFlt2 = FloatField('dnFltFld2', fldVal1, 0.0, 2) dnFlt3 = FloatField('dnFltFld3', fldVal1, 0.0, 2) dnFlt4 = FloatField('dnFltFld4', fldVal1, 0.0, 2) dnFlt5 = FloatField('dnFltFld5', fldVal1, 0.0, 2) # close the rowColumnLayout cmds.setParent("..") # create variable for the sdk command sdkCmd = scriptName + ".makeSdk( 'drFltFld1', 'drFltFld2', 'drFltFld3', 'drFltFld4', 'drFltFld5', 'dnFltFld1', 'dnFltFld2', 'dnFltFld3', 'dnFltFld4', 'dnFltFld5' )" sdkCmd = scriptName + ".makeSdk()" # create button to run sdk function sdkBtn = Button('sdkBtn', "Create SDK", 80, sdkCmd) # close the columnLayout cmds.setParent("..") # close the frameLayout cmds.setParent("..") # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout('keyOutFrame', l="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150) # create a formLayout to contain the keyframeOutliner cmds.formLayout('keyForm') # create a keyframeOutliner keyOut = cmds.keyframeOutliner('keyOutline', dsp="narrow", animCurve='animCurve1') # close the formLayout cmds.setParent("..") # close the frameLayout cmds.setParent("..") # edit the main formLayout cmds.formLayout('mainForm', e=True, af=[('mainFrame', "left", 5), ('mainFrame', "top", 5)]) # edit the sub formLayout cmds.formLayout('subForm', e=True, af=[(drvrFr, "left", 5), (drvrFr, "top", 5), (drvrFr, "right", 5)], ac=[(drvnFr, "top", 5, drvrFr), (valFr, "top", 5, drvnFr), (keyFr, "top", 5, valFr)], aoc=[(drvnFr, "left", 0, drvrFr), (drvnFr, "right", 0, drvrFr), (valFr, "left", 0, drvrFr), (valFr, "right", 0, drvrFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, drvnFr)]) # edit the keyOutline formLayout cmds.formLayout('keyForm', e=True, af=[(keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0)]) # show the window win1.show(winName)
def changeAnim(tsl, kOut): selItem = cmds.textScrollList( tsl, q=True, selectItem=True ) cmds.keyframeOutliner( kOut, e=True, animCurve=selItem[0] )
def makeGUI( wWid, wHigh, f1H, f2H, f3H ): ''' create the GUI for Mac format ''' # check to see if the GUI exists checkGUI( winName ) # create a variable to set the width of the window frWidth = wWid-10 # create the window win1 = Window( winName, 'Quick SDK GUI', wWid, wHigh ) # create columnLayout as main layout cmds.formLayout( 'mainForm', w=frWidth) # create a frameLayout to encapsulate and label the window elements cmds.frameLayout( 'mainFrame', label="Quick SDK", borderStyle='etchedIn', w=frWidth ) # create formLayout as a pad layout for the Window cmds.formLayout( 'padForm', h=300 ) # create a frameLayout to encapsulate and label the window elements drvrFr = cmds.frameLayout( 'drvrFrame', label="Driver:", borderStyle='etchedIn', collapsable=True ) # create formLayout as a pad layout for the Driver Section cmds.formLayout( 'drvrPadForm', height=f1H ) # height is 54 on Mac, 43 on PC # create variable for the textField widths tFld1W = 120 tFld2W = 60 #tFld3W = 80 # create a rowColumnLayout for the Driver Section cmds.rowColumnLayout( 'drvrMainLayout', nc=4, cw= ( [1, tFld1W], [2, tFld2W], [3, tFld2W], [4, tFld2W] ) ) # create GUI elements for Driver nTxt = Text( 'nameTxt', "Name:", 50 ) aTxt = Text( 'attrTxt', "Attr:", 50 ) bTxt1 = Text( 'blankTxt1', " ", 50 ) bTxt2 = Text( 'blankTxt2', " ", 50 ) global drvr1 drvr1 = TextField( 'drvrNameFld', tFld1W, "Driver" ) global drvr2 drvr2 = TextField( 'drvrAttrFld', tFld2W, "Attribute" ) lBtn1 = Button( 'drvrBtn', "Load Sel", tFld2W, Callback( loadSel, drvr1.name, drvr2.name ) ) lBtn1.setAnn( "Loads a selected driver object and a selected attribute from the channel box." ) selObjBtn = Button( 'selDrvrBtn', "Sel Obj", tFld2W, Callback( selObj, drvr1.name, 1 ) ) selObjBtn.setAnn( "Selects the driver object specified in the driver field." ) # close the driver rowColumnLayout cmds.setParent( ".." ) # close the driver formLayout cmds.setParent( ".." ) # close the driver frameLayout cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements drvnFr = cmds.frameLayout( 'drvnFrame', label="Driven:", borderStyle='etchedIn', collapsable=True ) # create formLayout as a pad layout for the Driven Section cmds.formLayout( 'drvnPadForm', height=f2H ) # height is 105 on Mac, 115 on PC # create a columnLayout cmds.rowLayout( 'drvnMainLayout', nc=2, cw = ( [1, 175], [2, 70] ) ) # create a textScrollList for the driven objects and attrs global dTSL dTSL = TSL( 'drvnTSL', 1, 175, 100, Callback( changeAnim, 'drvnTSL', 'keyOutline', 'keyOutFrame' ) ) # create variables for width values tslBtnW1 = 50 tslBtnW2 = 70 # create a columnLayout to enclose the TSL buttons cmds.columnLayout( 'tslBtnCol' ) # consider looping these # create TSL buttons addBtn1 = Button( 'addBtn', "Add", tslBtnW2, Callback( addObj, dTSL.name ) ) addBtn1.setAnn( "Adds driven objects an selected attributes to the textScrollList." ) rAllBtn1 = Button( 'remAllBtn', "Remove All", tslBtnW2, Callback( dTSL.clearAll ) ) rAllBtn1.setAnn( "Removes all objects from the textScrollList." ) rSelBtn1 = Button( 'remSelBtn', "Remove Sel", tslBtnW2, Callback( dTSL.clearSel ) ) rSelBtn1.setAnn( "Removes selected objects from the textScrollList." ) delAnimBtn1 = Button( 'delAnimBtn', "Del Keys", tslBtnW2, Callback( delAnim, dTSL.name ) ) delAnimBtn1.setAnn( "Deletes animation curve associated with this attribute, right click for menu." ) revAnimBtn1 = Button( 'revAnimBtn', "Reverse", tslBtnW2, Callback( revAnim, dTSL.name ) ) revAnimBtn1.setAnn( "Reverses the driven values of the animation curve associated with this attribute." ) # create popUpMenu for Del Keys button global animIndexMenu animIndexMenu = cmds.popupMenu( 'dr1Pop', parent=delAnimBtn1.name, button=3 ) cmds.menuItem( label="Del Index:" ) cmds.menuItem( divider=True ) cmds.menuItem( label="No animation curves present" ) # close the driven columnLayout cmds.setParent( ".." ) # close the button rowLayout cmds.setParent( ".." ) # close the driven formLayout cmds.setParent( ".." ) # close the driven frameLayout cmds.setParent( ".." ) # create a frameLayout to encapsulate and label the window elements valFr = cmds.frameLayout( 'valFrame', label="Values:", borderStyle='etchedIn', collapsable=True ) # create formLayout as a pad layout for the Value Section cmds.formLayout( 'valPadForm', height=f3H ) # height is 125 on Mac, 111 on PC # create a columnLayout cmds.columnLayout( 'valMainLayout' ) # create a rowLayout cmds.rowLayout( nc=2, cw2= [50, 50] ) # create text element to identify the value optionMenu vNumTxt1 = Text( 'valNumTxt1', "Value #: ", 50 ) # create optionMenu to determine # of SDKs to perform sdkOptName = cmds.optionMenu( 'sdkOpt', w=50 ) sdkOptNum = [ '1', '2', '3', '4', '5' ] for num in sdkOptNum: cmds.menuItem( label=num ) # close the rowLayout cmds.setParent( ".." ) # create a rowColumnLayout cmds.rowLayout(nc=2 ) # create a columnLayout cmds.columnLayout(w=100) # create text elements to identify the value fields blIdTxt1 = Text( 'blankIdTxt1', " ", 100 ) drIdTxt1 = Text( 'driverIdTxt1', "Driver Values: ", 100 ) dnIdTxt1 = Text( 'drivenIdTxt1', "Driven Values: ", 100 ) # close the columnLayout cmds.setParent( ".." ) # create variables to control width values fldVal1=40 fldVal2=60 # create a rowColumnLayout for the text and value fields cmds.rowColumnLayout(nc=5, w=200, cw= ([1, fldVal1], [2, fldVal1], [3, fldVal1], [4, fldVal1], [5, fldVal1]) ) ''' loop the creation of these ''' # create text to describe the floatFields using the Text class valTxtNums = [ "1", "2", "3", "4", "5" ] valTxtNames = [ 'valTxt1', 'valTxt2', 'valTxt3', 'valTxt4', 'valTxt5' ] valTxt = [ ] # declare counter i = 0 for num in valTxtNums: valTxt.append( Text( valTxtNames[i], "%s:" %(num), fldVal1 ) ) # increment counter i += 1 # create floatFields for the driver using the FloatField class drValFldNames = [ 'drFltFld1', 'drFltFld2', 'drFltFld3', 'drFltFld4', 'drFltFld5' ] drValFld = [ ] for name in drValFldNames: drValFld.append( FloatField( name, fldVal1, 0.0, 2 ) ) # create floatFields for the driven using the FloatField class dnValFldNames = [ 'dnFltFld1', 'dnFltFld2', 'dnFltFld3', 'dnFltFld4', 'dnFltFld5' ] dnValFld = [ ] for name in dnValFldNames: drValFld.append( FloatField( name, fldVal1, 0.0, 2 ) ) # create popupMenus for each floatField # declare counter i = 0 while ( i < len( valTxtNums ) ): # create popupMenu to load attribute values and inverse into driver fields cmds.popupMenu( 'dr%sPop' %( str(i+1) ), parent=drValFldNames[i], button=3 ) cmds.menuItem( label="Load Attr Value", c=Callback( loadAttrVal, 'dr', str(i+1), 1 ) ) cmds.menuItem( label="Load Inverse Value", c=Callback( loadAttrVal, 'dr', str(i+1), -1 ) ) # create popupMenu to load attribute values and inverse into driven fields cmds.popupMenu( 'dn%sPop' %( str(i+1) ), parent=dnValFldNames[i], button=3 ) cmds.menuItem( label="Load Attr Value", c=Callback( loadAttrVal, 'dn', str(i+1), 1 ) ) cmds.menuItem( label="Load Inverse Value", c=Callback( loadAttrVal, 'dn', str(i+1), -1 ) ) # increment counter i += 1 # close the rowColumnLayout cmds.setParent( ".." ) # close the rowColumnLayout cmds.setParent( ".." ) # create button to run sdk function sdkBtn = Button( 'sdkBtn', "Create SDK", 80, Callback( makeSdk, sdkOptName ) ) sdkBtn.setAnn( "Sets Driven Keyframes based on information provided above to the UI." ) # close the columnLayout cmds.setParent( ".." ) # close the formLayout cmds.setParent( ".." ) # close the frameLayout cmds.setParent( ".." ) # create a text object to identify the current animation curve crvTxt = cmds.text( 'curveTxt', l="Current Curve: No Curve Selected" ) # create a frameLayout to encapsulate and label the window elements keyFr = cmds.frameLayout( 'keyOutFrame', l="Driven Key Values:", borderStyle='etchedIn', collapsable=True, h=150 ) # create a formLayout to contain the keyframeOutliner cmds.formLayout( 'keyForm' ) # create a keyframeOutliner keyOut = cmds.keyframeOutliner( 'keyOutline', dsp="narrow", animCurve='animCurve1' ) # close the formLayout cmds.setParent( ".." ) # close the frameLayout cmds.setParent( ".." ) # edit the main formLayout cmds.formLayout( 'mainForm', e=True, af=[ ( 'mainFrame', "left", 5), ('mainFrame', "top", 5), ('mainFrame', "right", 5) ] ) # edit the pad window formLayout cmds.formLayout( 'padForm', e=True, af=[ (drvrFr, "left", 5), (drvrFr, "top", 5), (drvrFr, "right", 5)], ac=[ (drvnFr, "top", 5, drvrFr), (valFr, "top", 5, drvnFr), (crvTxt,"top", 5, valFr), (keyFr, "top", 0, crvTxt)], aoc=[ (drvnFr, "left", 0, drvrFr), (drvnFr, "right", 0, drvrFr), (valFr, "left", 0, drvrFr), (valFr, "right", 0, drvrFr), (crvTxt,"left", 0, drvrFr), (crvTxt,"right", 0, drvrFr), (keyFr, "left", 0, drvnFr), (keyFr, "right", 0, drvnFr)] ) # edit the pad driver formLayout cmds.formLayout( 'drvrPadForm', e=True, af=[ ( 'drvrMainLayout', "left", 5), ('drvrMainLayout', "top", 5), ('drvrMainLayout', "right", 5) ] ) # edit the pad driven formLayout cmds.formLayout( 'drvnPadForm', e=True, af=[ ( 'drvnMainLayout', "left", 5), ('drvnMainLayout', "top", 5), ('drvnMainLayout', "right", 5) ] ) # edit the pad value formLayout cmds.formLayout( 'valPadForm', e=True, af=[ ( 'valMainLayout', "left", 5), ('valMainLayout', "top", 5), ('valMainLayout', "right", 5) ] ) # edit the keyOutline formLayout cmds.formLayout( 'keyForm', e=True, af=[ (keyOut, 'top', 0), (keyOut, 'left', 0), (keyOut, 'bottom', 0), (keyOut, 'right', 0) ] ) # show the window win1.show()