def toggleToolbar(self, forceOff=None): visible = True if cmds.toolBar(self.toolbar, query=True, exists=True): visible = (False if forceOff else not cmds.toolBar( self.toolbar, query=True, visible=True)) cmds.toolBar(self.toolbar, edit=True, visible=visible) if visible: self.adjustButtonsWidth() else: self.createWin() if visible and len(self.aToolsSets) == 0: self.turnOnCreateNewSetField() if cmds.iconTextButton("selectSetsBtn", query=True, exists=True): if visible: cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath( "specialTools_select_sets_active"), highlightImage=uiMod.getImagePath( "specialTools_select_sets_active")) else: cmds.iconTextButton( "selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage=uiMod.getImagePath( "specialTools_select_sets copy"))
def highlightSelectedButtons(self, onlySelSet=None): aToolsSets = [onlySelSet] if onlySelSet else self.aToolsSets CurrSel = sorted(cmds.ls(selection=True)) if len(CurrSel) > 0: smallDot = uiMod.getImagePath("specialTools_gray_dot_a") bigDot = uiMod.getImagePath("specialTools_gray_dot_c") for loopSet in aToolsSets: if self.isHidden(loopSet): continue if not cmds.objExists(loopSet): continue nodes = sorted(cmds.sets(loopSet, query=True, nodesOnly=True)) if nodes == CurrSel: cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, style='iconAndTextVertical', image=bigDot, highlightImage=bigDot) elif set(CurrSel).issuperset(set(nodes)): cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, style='iconAndTextVertical', image=smallDot, highlightImage=smallDot) else: cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, style='textOnly') else: for loopSet in self.aToolsSets: if self.isHidden(loopSet): continue cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, style='textOnly')
def createLayout(self): cmds.rowLayout(numberOfColumns=5, parent=self.parentLayout) timelineRange = TimelineRange() cmds.iconTextButton( style='iconAndTextVertical', w=self.wb, h=self.hb, image=uiMod.getImagePath("tUtilities_range"), highlightImage=uiMod.getImagePath("tUtilities_range copy"), command=timelineRange.setTimelineRange, annotation="Set timeline range\nRight click for options") timelineRange.popupMenu() cameraTools = CameraTools() cmds.iconTextButton( style='iconAndTextVertical', w=self.wb, h=self.hb, image=uiMod.getImagePath("tUtilities_camera"), highlightImage=uiMod.getImagePath("tUtilities_camera copy"), command=cameraTools.playblastCamera, annotation="Playblast camera\nRight click to select camera") cameraTools.popupMenu()
def createTextField(self, createRename, enterCommand, offCommand): mainLayout = cmds.columnLayout(w=1, columnWidth=self.createRenameLayoutW, parent=self.selSetsLayout, visible=False ) fistRowLayout = cmds.rowLayout(numberOfColumns=3, parent=mainLayout) textField = cmds.textField(height=20, width=self.createRenameLayoutW-21, alwaysInvokeEnterCommandOnReturn=True, parent=fistRowLayout, enterCommand=enterCommand ) # X button text field cmds.iconTextButton(style='iconOnly', h=18, w=18, image=uiMod.getImagePath("specialTools_x"), highlightImage=uiMod.getImagePath("specialTools_x copy"), command=offCommand, annotation="Cancel", parent=fistRowLayout ) cmds.rowLayout(numberOfColumns=len(self.colors)+1, parent=mainLayout) for loopColor in self.colors: colorName = loopColor["name"] colorValue = loopColor["value"] cmds.iconTextButton("colorButton%s%s"%(createRename, colorName), style='iconOnly', bgc=colorValue, height=15, width=15, command=lambda colorName=colorName, *args: enterCommand(colorName=colorName) ) return {"mainLayout":mainLayout, "textField":textField}
def setMode(self, onOff): sel = cmds.ls(selection=True) self.onOff = onOff if onOff: cmds.iconTextButton( self.toolBarButton, edit=True, image=uiMod.getImagePath("specialTools_motion_trail_active"), highlightImage=uiMod.getImagePath( "specialTools_motion_trail_active")) self.setPrefs() self.updateFrameRange() self.createMotionTrail(sel) self.addMessages() self.addScriptJobs() else: cmds.iconTextButton( self.toolBarButton, edit=True, image=uiMod.getImagePath("specialTools_motion_trail"), highlightImage=uiMod.getImagePath( "specialTools_motion_trail copy")) self.removeAllCallbacks()
def setLed(self, state): if not cmds.image("animationCrashRecoveryLed", query=True, exists=True): return self.blinkingRed(False) if state == "on": if self.saveRecommended: image = "ACR_red" ann = "Animation Crash Recovery recommends you to save" G.lastSaveWarning = time.time() if not G.lastSaveWarning else G.lastSaveWarning if time.time() - G.lastSaveWarning >= self.redBlinkingSecs: self.blinkingRed(True) else: image = "ACR_green" ann = "Animation Crash Recovery is ON" G.lastSaveWarning = None cmds.image("animationCrashRecoveryLed", edit=True, image= uiMod.getImagePath(image), ann=ann) elif state == "off": cmds.image("animationCrashRecoveryLed", edit=True, image= uiMod.getImagePath("ACR_off"), ann="Animation Crash Recovery is OFF") elif state == "blinking": self.blinkingLedState = not self.blinkingLedState image = "ACR_white_half" if self.blinkingLedState else "ACR_white_bright" cmds.image("animationCrashRecoveryLed", edit=True, image= uiMod.getImagePath(image), ann="Animation Crash Recovery is saving animation") elif state == "blinking_red": self.blinkingLedState = not self.blinkingLedState image = "ACR_red_half" if self.blinkingLedState else "ACR_red_bright" cmds.image("animationCrashRecoveryLed", edit=True, image= uiMod.getImagePath(image), ann="Animation Crash Recovery HIGHLY recommends you to save")
def toggleAutoSelectMirrorObjects(self, *args): onOff = not cmds.menuItem( "autoSelectMirrorObjectsMenu", query=True, checkBox=True) if args: onOff = not onOff #if checkbox pressed if onOff: cmds.iconTextButton( "mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror_active"), highlightImage=uiMod.getImagePath( "specialTools_mirror_active")) else: cmds.iconTextButton( "mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror"), highlightImage=uiMod.getImagePath("specialTools_mirror copy")) self.setAutoSelectMirrorObjects(onOff) if not args: cmds.menuItem("autoSelectMirrorObjectsMenu", edit=True, checkBox=onOff)
def createSelSetButton(self, selSet): extracted = self.extractInfoFromSelSet(selSet) selSetName = extracted["selSetName"] colorName = extracted["colorName"] colorValue = extracted["colorValue"] cmds.iconTextButton( 'aToolsSetBtn_%s' % selSet, label=' %s ' % selSetName, image=uiMod.getImagePath('specialTools_select_sets_img'), highlightImage=uiMod.getImagePath( 'specialTools_select_sets_highlight_img'), height=self.buttonHeight, bgc=colorValue, command=lambda selSet=selSet, *args: self.selectSet(selSet), dragCallback=lambda *args: self.turnOnRenameSetField(selSet), ann= '%s\n\nLeft click: select\nShift+click: add selection\nCtrl+click: subtract selection\nMiddle click: rename set\nCtrl+Shift+click: delete set\n\nRight click for options' % selSetName, parent=self.selSetsLayout) self.selSetButtonPopUp(selSet) G.deferredManager.sendToQueue( lambda *args: self.saveButtonWidth(selSet), 1, "SS") G.deferredManager.sendToQueue(self.adjustButtonsWidth, 1, "SS")
def toggleAutoSelectMirrorObjects(self, *args): onOff = not cmds.menuItem("autoSelectMirrorObjectsMenu", query=True , checkBox=True) if args: onOff = not onOff #if checkbox pressed if onOff: cmds.iconTextButton("mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror_active"), highlightImage= uiMod.getImagePath("specialTools_mirror_active")) else: cmds.iconTextButton("mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror"), highlightImage= uiMod.getImagePath("specialTools_mirror copy")) self.setAutoSelectMirrorObjects(onOff) if not args:cmds.menuItem("autoSelectMirrorObjectsMenu", edit=True , checkBox=onOff)
def setButtonImg(self, onOff): if onOff: cmds.iconTextButton("microTransformBtn", edit=True, image=uiMod.getImagePath( "specialTools_micro_transform_active"), highlightImage=uiMod.getImagePath( "specialTools_micro_transform_active")) else: cmds.iconTextButton( "microTransformBtn", edit=True, image=uiMod.getImagePath("specialTools_micro_transform"), highlightImage=uiMod.getImagePath( "specialTools_micro_transform copy"))
def toggleToolbar(self, forceOff=None): visible = True if cmds.toolBar(self.toolbar, query=True, exists=True): visible = (False if forceOff else not cmds.toolBar(self.toolbar, query=True, visible=True)) cmds.toolBar(self.toolbar, edit=True, visible=visible) if visible: self.adjustButtonsWidth() else: self.createWin() if visible and len(self.aToolsSets) == 0: self.turnOnCreateNewSetField() if cmds.iconTextButton("selectSetsBtn", query=True, exists=True): if visible: cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets_active"), highlightImage= uiMod.getImagePath("specialTools_select_sets_active")) else: cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage= uiMod.getImagePath("specialTools_select_sets copy"))
def setButtonImg(self, onOff): if onOff: cmds.iconTextButton( "transformAllBtn", edit=True, image=uiMod.getImagePath("specialTools_transform_all%s_active" % self.blendImg), highlightImage=uiMod.getImagePath("specialTools_transform_all%s_active" % self.blendImg), ) else: cmds.iconTextButton( "transformAllBtn", edit=True, image=uiMod.getImagePath("specialTools_transform_all%s" % self.blendImg), highlightImage=uiMod.getImagePath("specialTools_transform_all%s copy" % self.blendImg), )
def copyWorld(self, *args): #print "copyworld" self.selection = cmds.ls(selection=True) if len(self.selection) < 1: return if len(self.selection) > 20: message = "Too many objects selected, continue?" confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' ) if confirm != 'Yes': return cmds.refresh(suspend=True) cmds.undoInfo(stateWithoutFlush=False) self.flushCopyCache(force=True) self.scriptJob() self.sourceObjs = self.selection self.targetObj = "world" for loopObj in self.sourceObjs: matrix = cmds.xform(loopObj, query=True, ws=True, matrix=True) self.copyCache.append(matrix) cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain_active"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain_active copy")) cmds.refresh(suspend=False) cmds.undoInfo(stateWithoutFlush=True)
def createLayout(self): mainLayout = cmds.rowLayout(numberOfColumns=6, parent=self.parentLayout) #manipulator orientation #cmds.iconTextButton("manipOrientButton", style='textOnly', label='-', h=self.hb, annotation="Selected objects", command=updateManipOrient) #launchManipOrient() self.autoSmartSnapKeys = AutoSmartSnapKeys() self.selectionCounter = SelectionCounter() #selection cmds.iconTextButton("selectionCounterButton", style='textOnly', font="smallPlainLabelFont", label='0', h=self.hb, annotation="Selected objects") cmds.popupMenu("selectionCounterButtonMenu", button=1, postMenuCommand=self.selectionCounter.populateMenu) #animation crash recovery cmds.image("animationCrashRecoveryLed", w=14, h=14, annotation="Test") #menu cmds.iconTextButton(style='iconOnly', w=self.wb, h=self.hb, image= uiMod.getImagePath("aTools"), highlightImage= uiMod.getImagePath("aTools copy"), annotation="aTools Menu") self.popUpaToolsMenu() ### # We don't want to perform updates. Internet access won't allow it and we want to control # version releases. ### # self.update = Update() # self.update.about = self.about # self.update.checkUpdates(self, mainLayout) # set default config and startup scripts self.setDefaultConfig()
def createLayout(self): mainLayout = cmds.rowLayout(numberOfColumns=6, parent=self.parentLayout) #manipulator orientation #cmds.iconTextButton("manipOrientButton", style='textOnly', label='-', h=self.hb, annotation="Selected objects", command=updateManipOrient) #launchManipOrient() self.autoSmartSnapKeys = AutoSmartSnapKeys() self.selectionCounter = SelectionCounter() #selection cmds.iconTextButton("selectionCounterButton", style='textOnly', font="smallPlainLabelFont", label='0', h=self.hb, annotation="Selected objects") cmds.popupMenu("selectionCounterButtonMenu", button=1, postMenuCommand=self.selectionCounter.populateMenu) #animation crash recovery cmds.image("animationCrashRecoveryLed", w=14, h=14, annotation="Test") #menu cmds.iconTextButton(style='iconOnly', w=self.wb, h=self.hb, image= uiMod.getImagePath("aTools"), highlightImage= uiMod.getImagePath("aTools copy"), annotation="aTools Menu") self.popUpaToolsMenu() self.update = Update() self.update.about = self.about self.update.checkUpdates(self, mainLayout) # set default config and startup scripts self.setDefaultConfig()
def warningWindow(): formLayout = cmds.setParent(query=True) icon = cmds.image(image= uiMod.getImagePath("ACR_white_bright")) titleText = cmds.text(label="You have newer animation. Do you want to load?", font="boldLabelFont", align="left") messageText = cmds.text(label=message, align="left") buttonLoad = cmds.button(label='Load', command='cmds.layoutDialog(dismiss="load")') buttonMaybe = cmds.button(label='Maybe Later', command='cmds.layoutDialog(dismiss="maybe")', w=100) cmds.formLayout (formLayout, edit=True, width=300, height=height, attachPosition = [ (icon, 'left', 10, 0), (icon, 'top', 10, 0), (titleText, 'top', 10, 0), (messageText, 'left', 10, 0), (messageText, 'top', 0, 30), (buttonLoad, 'left', 10, 0), (buttonLoad, 'bottom', 10, 100), (buttonMaybe, 'bottom', 10, 100) ], attachForm = [ (buttonLoad, 'left', 10), (buttonMaybe, 'right', 10) ], attachControl = [ (titleText, 'left', 10, icon), (buttonLoad, 'right', 5, buttonMaybe) ])
def loadWindow(): mayaFileName = infoData["mayaFileName"] message = "%s\n%s\n\nWarning: Loading crash files after editing your Maya file can lead to unpredictable results."%(mayaFileName, time.ctime(modDate)) formLayout = cmds.setParent(query=True) icon = cmds.image(image= uiMod.getImagePath("ACR_white_bright")) titleText = cmds.text(label="Do you want to load?", font="boldLabelFont", align="left") messageText = cmds.text(label=message, align="left") buttonLoad = cmds.button(label='Load', command='cmds.layoutDialog(dismiss="load")') buttonLoadSel = cmds.button(label='Load On Selection', command='cmds.layoutDialog(dismiss="load_selection")', w=110) cmds.formLayout (formLayout, edit=True, width=300, height=170, attachPosition = [ (icon, 'left', 10, 0), (icon, 'top', 10, 0), (titleText, 'top', 10, 0), (messageText, 'left', 10, 0), (messageText, 'top', 0, 30), (buttonLoad, 'left', 10, 0), (buttonLoad, 'bottom', 10, 100), (buttonLoadSel, 'bottom', 10, 100) ], attachForm = [ (buttonLoad, 'left', 10), (buttonLoadSel, 'right', 10) ], attachControl = [ (titleText, 'left', 10, icon), (buttonLoad, 'right', 5, buttonLoadSel) ])
def createLayout(self): tangents = Tangents() buttons = ["flow", "bounce", "auto", "spline", "linear", "flat", "step"] cmds.rowLayout(numberOfColumns=8, parent=self.parentLayout) for loopButton in buttons: cmds.iconTextButton( style="iconAndTextVertical", image=uiMod.getImagePath("tangents_%s" % loopButton), highlightImage=uiMod.getImagePath("tangents_%s copy" % loopButton), w=self.wb, h=self.hb, command=lambda loopButton=loopButton, *args: tangents.setTangent(loopButton), annotation="%s tangent\\nRight click for options" % str.title(loopButton), ) tangents.popupMenu(loopButton)
def setMode(self, onOff): sel = cmds.ls(selection=True) self.onOff = onOff if onOff: cmds.iconTextButton(self.toolBarButton, edit=True, image=uiMod.getImagePath("specialTools_motion_trail_active"), highlightImage= uiMod.getImagePath("specialTools_motion_trail_active")) self.setPrefs() self.updateFrameRange() self.createMotionTrail(sel) self.addMessages() self.addScriptJobs() else: cmds.iconTextButton(self.toolBarButton, edit=True, image=uiMod.getImagePath("specialTools_motion_trail"), highlightImage= uiMod.getImagePath("specialTools_motion_trail copy")) self.removeAllCallbacks()
def flushCopyCache(self, force=False): if not force and cmds.ls(selection=True) == self.selection: self.scriptJob() return cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain copy")) self.clearLocators() self.copyCache = []
def delWindows(self): if cmds.iconTextButton("selectSetsBtn", query=True, exists=True): cmds.iconTextButton( "selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage=uiMod.getImagePath( "specialTools_select_sets copy")) for loopWin in self.allWin: if cmds.rowLayout(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) if cmds.window(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) if cmds.toolBar(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) self.clearScriptJobs()
def delWindows(self): if cmds.iconTextButton("selectSetsBtn", query=True, exists=True): cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage= uiMod.getImagePath("specialTools_select_sets copy")) for loopWin in self.allWin: if cmds.rowLayout(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) if cmds.window(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) if cmds.toolBar(loopWin, query=True, exists=True): cmds.deleteUI(loopWin) self.clearScriptJobs()
def copy(self, *args): #print "copy" self.selection = cmds.ls(selection=True) if len(self.selection) < 1: cmds.warning("You need to select at least 2 objects.") return if len(self.selection) == 1: self.copyWorld() return if len(self.selection) > 20: message = "Too many objects selected, continue?" confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' ) if confirm != 'Yes': return cmds.refresh(suspend=True) cmds.undoInfo(stateWithoutFlush=False) self.flushCopyCache(force=True) self.scriptJob() self.sourceObjs = self.selection[0:-1] self.targetObj = self.selection[-1] selObjects = utilMod.getNameSpace(self.selection)[1] self.locators = [] self.locatorGroup = animMod.group(name=self.locatorGroupName) G.aToolsBar.align.align([self.locatorGroup], self.targetObj) self.locators.append(self.locatorGroup) for loopObj in self.sourceObjs: nameSpace = utilMod.getNameSpace([loopObj]) loopSelName = "%s_%s"%(nameSpace[0][0], nameSpace[1][0]) locatorName = "fakeConstrain_%s"%loopSelName locator = animMod.createNull(locatorName) self.locators.append(locator) with G.aToolsBar.createAToolsNode: cmds.parent(locator, self.locatorGroup) G.aToolsBar.align.align([locator], loopObj) matrix = cmds.xform(locator, query=True, matrix=True) self.copyCache.append(matrix) self.clearLocators() cmds.select(self.selection) cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain_active"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain_active copy")) cmds.refresh(suspend=False) cmds.undoInfo(stateWithoutFlush=True)
def createSelSetButton(self, selSet): extracted = self.extractInfoFromSelSet(selSet) selSetName = extracted["selSetName"] colorName = extracted["colorName"] colorValue = extracted["colorValue"] cmds.iconTextButton('aToolsSetBtn_%s'%selSet, label=' %s '%selSetName, image=uiMod.getImagePath('specialTools_select_sets_img'), highlightImage=uiMod.getImagePath('specialTools_select_sets_highlight_img'), height=self.buttonHeight, bgc=colorValue, command=lambda selSet=selSet, *args: self.selectSet(selSet), dragCallback=lambda *args: self.turnOnRenameSetField(selSet), ann='%s\n\nLeft click: select\nShift+click: add selection\nCtrl+click: subtract selection\nMiddle click: rename set\nCtrl+Shift+click: delete set\n\nRight click for options'%selSetName, parent=self.selSetsLayout ) self.selSetButtonPopUp(selSet) G.deferredManager.sendToQueue(lambda *args: self.saveButtonWidth(selSet), 1, "SS") G.deferredManager.sendToQueue(self.adjustButtonsWidth, 1, "SS")
def createLayout(self): cmds.rowLayout(numberOfColumns=20, parent=self.parentLayout) #SELECTION SETS SelectSets = selectSets.SelectSets() cmds.iconTextButton("selectSetsBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_select_sets"), highlightImage= uiMod.getImagePath("specialTools_select_sets copy"), w=self.wb, h=self.hb, command=SelectSets.toggleToolbar, annotation="Quick select set groups\nRight click for options") SelectSets.popupMenu() #ALIGN Align = align.Align() cmds.iconTextButton(style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_align"), highlightImage= uiMod.getImagePath("specialTools_align copy"), w=self.wb, h=self.hb, command=Align.alignSelection, annotation="Align selection\nSelect the slaves and a master object\nRight click for options") Align.popupMenu() #MIRROR Mirror = mirror.Mirror() cmds.iconTextButton("mirrorBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_mirror"), highlightImage= uiMod.getImagePath("specialTools_mirror copy"), w=self.wb, h=self.hb, command=Mirror.start, annotation="Mirror values to opposite ctrls\nHighlight the timeline for applying on a range\nRight click for options\n\nCtrl+click: Select mirror objects\nShift+click: Add mirror objects to selection") Mirror.popupMenu() #SPACE SWITCH SpaceSwitch = spaceSwitch.SpaceSwitch() cmds.iconTextButton(style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_space_switcher"), highlightImage= uiMod.getImagePath("specialTools_space_switcher copy"), w=self.wb, h=self.hb, annotation="Space switcher\nIf the constraint controller is not the same as the attribute controller, select it too") SpaceSwitch.popupMenu() #TEMP CUSTOM PIVOT TempCustomPivot = tempCustomPivot.TempCustomPivot() cmds.iconTextButton("TempCustomPivotBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_create_temp_custom_pivot"), highlightImage= uiMod.getImagePath("specialTools_create_temp_custom_pivot copy"), w=self.wb, h=self.hb, command=TempCustomPivot.create, annotation="Temporary custom pivot\nRight click for options") TempCustomPivot.popupMenu() #ANIMATION COPIER AnimationCopier = animationCopier.AnimationCopier() cmds.iconTextButton(style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_copy_animation"), highlightImage= uiMod.getImagePath("specialTools_copy_animation copy"), w=self.wb, h=self.hb, command=AnimationCopier.copyAnimation, annotation="Animation Copier\nRight click for options") AnimationCopier.popupMenu() #FAKE CONSTRAIN FakeConstrain = fakeConstrain.FakeConstrain() cmds.iconTextButton("fakeConstrainBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_fake_constrain"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain copy"), w=self.wb, h=self.hb, command=FakeConstrain.copyPaste, annotation="Fake Constrain\nClick once to copy objects position relative to the last selected\nGo to another frame or select a range and click again to paste\nChanging the current selection will flush the copy cache\n\nRight click for options") FakeConstrain.popupMenu() #MOTION TRAIL MotionTrail = motionTrail.MotionTrail() MotionTrail.toolBarButton = cmds.iconTextButton("motionTrailBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_motion_trail"), highlightImage= uiMod.getImagePath("specialTools_motion_trail copy"), w=self.wb, h=self.hb, command=MotionTrail.switch, annotation="Motion trail\nRight click for options") MotionTrail.popupMenu() #cmds.iconTextButton("motionTrailBtnOLD", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_motion_trail"), highlightImage= uiMod.getImagePath("specialTools_motion_trail copy"), w=self.wb, h=self.hb, command=self.motionTrail, annotation="Motion trail") #MICRO TRANSFORM MicroTransform = microTransform.MicroTransform() cmds.iconTextButton("microTransformBtn", style='iconAndTextVertical', image= uiMod.getImagePath("specialTools_micro_transform"), highlightImage= uiMod.getImagePath("specialTools_micro_transform copy"), w=self.wb, h=self.hb, command=MicroTransform.switch, annotation="Enable micro transform\nRight click for options") MicroTransform.popupMenu() #TRANSFORM ALL TransformAll = transformAll.TransformAll() cmds.iconTextButton ("transformAllBtn", style='iconAndTextVertical', w=self.wb, h=self.hb, image= uiMod.getImagePath("specialTools_transform_all"), highlightImage= uiMod.getImagePath("specialTools_transform_all copy"), command=TransformAll.switch, annotation="Enable transform all keys\nWill affect selected range or all keys if no range is selected\nCtrl+click will toggle blend range mode")
def clear(self, *args): if cmds.iconTextButton("TempCustomPivotBtn", query=True, exists=True): cmds.iconTextButton("TempCustomPivotBtn", edit=True, image= uiMod.getImagePath("specialTools_create_temp_custom_pivot"), highlightImage= uiMod.getImagePath("specialTools_create_temp_custom_pivot copy")) cmds.refresh(suspend=True) currFrame = cmds.currentTime(query=True) loadConstraints = aToolsMod.loadInfoWithScene(self.STORE_NODE, self.CONSTRAINTS) loadLocators = aToolsMod.loadInfoWithScene(self.STORE_NODE, self.LOCATORS) loadCtrls = aToolsMod.loadInfoWithScene(self.STORE_NODE, self.CTRLS) currentFrame = aToolsMod.loadInfoWithScene(self.STORE_NODE, self.CURRENTFRAME) #exit edit mode if cmds.currentCtx() not in self.deniedCtx: cmds.setToolTo(cmds.currentCtx()) if currentFrame: cmds.currentTime(eval(currentFrame)) #get values """ translation = [] rotation = [] if loadCtrls: ctrlObjs = eval(loadCtrls) for loopCtrl in ctrlObjs: translation.append(cmds.xform(loopCtrl, query=True, ws=True, rotatePivot=True)) rotation.append(cmds.xform(loopCtrl, query=True, ws=True, rotation=True)) """ if loadConstraints: constraintObjs = eval(loadConstraints) for loopConstraint in constraintObjs: if cmds.objExists(loopConstraint): cmds.delete(loopConstraint) if loadCtrls and loadLocators: locatorObjs = eval(loadLocators) ctrlObjs = eval(loadCtrls) for n, loopCtrl in enumerate(ctrlObjs): if cmds.objExists(loopCtrl) and cmds.objExists(locatorObjs[n]): G.aToolsBar.align.align([loopCtrl], locatorObjs[n]) for loopLocator in locatorObjs: if cmds.objExists(loopLocator): cmds.delete(loopLocator) cmds.currentTime(currFrame) cmds.refresh(suspend=False)
def highlightSelectedButtons(self, onlySelSet=None): aToolsSets = [onlySelSet] if onlySelSet else self.aToolsSets CurrSel = sorted(cmds.ls(selection=True)) if len(CurrSel) > 0: smallDot = uiMod.getImagePath("specialTools_gray_dot_a") bigDot = uiMod.getImagePath("specialTools_gray_dot_c") for loopSet in aToolsSets: if self.isHidden(loopSet): continue if not cmds.objExists(loopSet): continue nodes = sorted(cmds.sets(loopSet, query=True, nodesOnly=True)) if nodes == CurrSel: cmds.iconTextButton('aToolsSetBtn_%s' % loopSet, edit=True, style='iconAndTextVertical', image=bigDot, highlightImage=bigDot) elif set(CurrSel).issuperset(set(nodes)): cmds.iconTextButton('aToolsSetBtn_%s' % loopSet, edit=True, style='iconAndTextVertical', image=smallDot, highlightImage=smallDot) else: cmds.iconTextButton('aToolsSetBtn_%s' % loopSet, edit=True, style='textOnly') else: for loopSet in self.aToolsSets: if self.isHidden(loopSet): continue cmds.iconTextButton('aToolsSetBtn_%s' % loopSet, edit=True, style='textOnly')
def createTextField(self, createRename, enterCommand, offCommand): mainLayout = cmds.columnLayout(w=1, columnWidth=self.createRenameLayoutW, parent=self.selSetsLayout, visible=False) fistRowLayout = cmds.rowLayout(numberOfColumns=3, parent=mainLayout) textField = cmds.textField(height=20, width=self.createRenameLayoutW - 21, alwaysInvokeEnterCommandOnReturn=True, parent=fistRowLayout, enterCommand=enterCommand) # X button text field cmds.iconTextButton( style='iconOnly', h=18, w=18, image=uiMod.getImagePath("specialTools_x"), highlightImage=uiMod.getImagePath("specialTools_x copy"), command=offCommand, annotation="Cancel", parent=fistRowLayout) cmds.rowLayout(numberOfColumns=len(self.colors) + 1, parent=mainLayout) for loopColor in self.colors: colorName = loopColor["name"] colorValue = loopColor["value"] cmds.iconTextButton("colorButton%s%s" % (createRename, colorName), style='iconOnly', bgc=colorValue, height=15, width=15, command=lambda colorName=colorName, *args: enterCommand(colorName=colorName)) return {"mainLayout": mainLayout, "textField": textField}
def populateSelSetsButtons(self): # + button self.plusBtn = cmds.iconTextButton( style='iconAndTextVertical', h=25, w=25, image=uiMod.getImagePath("specialTools_select_sets_+"), highlightImage=uiMod.getImagePath( "specialTools_select_sets_+ copy"), command=self.turnOnCreateNewSetField, annotation="Create new select set", parent=self.mainLayout) self.selSetsLayout = cmds.rowLayout(numberOfColumns=200, parent=self.mainLayout) # create UI fieldUI = self.createTextField("create", self.createNewSelectSet, self.turnOffCreateNewSetField) self.createNewSetLayout = fieldUI["mainLayout"] self.createNewSetTextField = fieldUI["textField"] #rename UI fieldUI = self.createTextField("rename", self.renameSelectSet, self.turnOffRenameSetField) self.renameSetLayout = fieldUI["mainLayout"] self.renameSetTextField = fieldUI["textField"] #sel sets buttons for loopSet in self.aToolsSets: self.createSelSetButton(loopSet) # Show All Button self.showAllColorsButton = cmds.iconTextButton( style='iconOnly', h=25, w=1, image=uiMod.getImagePath("specialTools_select_sets_show_all"), highlightImage=uiMod.getImagePath( "specialTools_select_sets_show_all copy"), command=self.showAllColors, annotation="Show all colors", parent=self.mainLayout, visible=False) # X button cmds.iconTextButton( style='iconOnly', h=25, w=25, image=uiMod.getImagePath("specialTools_x"), highlightImage=uiMod.getImagePath("specialTools_x copy"), command=self.toggleToolbar, annotation="Hide toolbar", parent=self.mainLayout)
def highlightColorSelection(self): fields = ["create", "rename"] for loopColor in self.colors: loopColorName = loopColor["name"] if loopColorName == G.SS_lastColorUsed: for loopField in fields: cmds.iconTextButton( "colorButton%s%s" % (loopField, loopColorName), edit=True, image=uiMod.getImagePath('specialTools_gray_dot_c'), style='iconOnly') else: for loopField in fields: cmds.iconTextButton("colorButton%s%s" % (loopField, loopColorName), edit=True, style='textOnly')
def populateSelSetsButtons(self): # + button self.plusBtn = cmds.iconTextButton(style='iconAndTextVertical', h=25, w=25, image=uiMod.getImagePath("specialTools_select_sets_+"), highlightImage=uiMod.getImagePath("specialTools_select_sets_+ copy"), command=self.turnOnCreateNewSetField, annotation="Create new select set", parent=self.mainLayout ) self.selSetsLayout = cmds.rowLayout(numberOfColumns=200, parent=self.mainLayout) # create UI fieldUI = self.createTextField("create", self.createNewSelectSet, self.turnOffCreateNewSetField) self.createNewSetLayout = fieldUI["mainLayout"] self.createNewSetTextField = fieldUI["textField"] #rename UI fieldUI = self.createTextField("rename", self.renameSelectSet, self.turnOffRenameSetField) self.renameSetLayout = fieldUI["mainLayout"] self.renameSetTextField = fieldUI["textField"] #sel sets buttons for loopSet in self.aToolsSets: self.createSelSetButton(loopSet) # Show All Button self.showAllColorsButton = cmds.iconTextButton(style='iconOnly', h=25, w=1, image=uiMod.getImagePath("specialTools_select_sets_show_all"), highlightImage=uiMod.getImagePath("specialTools_select_sets_show_all copy"), command=self.showAllColors, annotation="Show all colors", parent=self.mainLayout, visible=False ) # X button cmds.iconTextButton(style='iconOnly', h=25, w=25, image=uiMod.getImagePath("specialTools_x"), highlightImage=uiMod.getImagePath("specialTools_x copy"), command=self.toggleToolbar, annotation="Hide toolbar", parent=self.mainLayout )
def about(self, warnUpdate=None, *args): winName = "aboutWindow" title = "About" if not warnUpdate else "aTools has been updated!" if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName) window = cmds.window( winName, title=title) form = cmds.formLayout(numberOfDivisions=100) pos = 10 minWidth = 300.0 # Creating Elements object = cmds.image(image= uiMod.getImagePath("aTools_big")) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 10)] ) object = cmds.text( label="aTools - Version %s"%VERSION, font="boldLabelFont") cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 80)] ) #========================================= pos += 30 object = cmds.text( label="More info:") cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 80)] ) #========================================= object = cmds.text( label="<a href=\"%s\">aTools website</a>"%SITE_URL, hyperlink=True) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 205)] ) #========================================= pos += 15 object = cmds.text( label="Author: Alan Camilo") cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 80)] ) #========================================= object = cmds.text( label="<a href=\"http://www.alancamilo.com/\">www.alancamilo.com</a>", hyperlink=True) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 205)] ) #========================================= minWidth = 550.0 w = 210 object = cmds.text( label="Do you like aTools?", w=w) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos-50), ( object, 'right', 10)] ) #========================================= object = cmds.iconTextButton(label="Buy Me a Beer!", style="iconAndTextVertical", bgc=(.3,.3,.3), h=45, w=w, command=lambda *args: webbrowser.open_new_tab(DONATE_URL), image= uiMod.getImagePath("beer"), highlightImage= uiMod.getImagePath("beer copy")) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos-30), ( object, 'right', 10)] ) object = cmds.text( label="I really appreciate\nthe support!", w=w) cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos+20), ( object, 'right', 10)] ) if warnUpdate: pos += 40 object = cmds.text( label="aTools has been updated to version %s. What is new?"%VERSION, align="left") cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 10)] ) pos -= 20 #========================================= pos += 40 object = cmds.text( label=WHATISNEW, align="left") cmds.formLayout( form, edit=True, attachForm=[( object, 'top', pos), ( object, 'left', 10)] ) #========================================= for x in xrange(WHATISNEW.count("\n")): pos += 13 pos += 25 cmds.setParent( '..' ) cmds.showWindow( window ) whatsNewWidth = cmds.text(object, query=True, width=True) + 15 wid = whatsNewWidth if whatsNewWidth > minWidth else minWidth cmds.window( winName, edit=True, widthHeight=(wid, pos))
def setButtonImg(self, onOff): if onOff: cmds.iconTextButton("transformAllBtn", edit=True, image=uiMod.getImagePath("specialTools_transform_all%s_active"%self.blendImg), highlightImage= uiMod.getImagePath("specialTools_transform_all%s_active"%self.blendImg)) else: cmds.iconTextButton("transformAllBtn", edit=True, image=uiMod.getImagePath("specialTools_transform_all%s"%self.blendImg), highlightImage= uiMod.getImagePath("specialTools_transform_all%s copy"%self.blendImg))
def setButtonImg(self, onOff): if onOff: cmds.iconTextButton("microTransformBtn", edit=True, image=uiMod.getImagePath("specialTools_micro_transform_active"), highlightImage= uiMod.getImagePath("specialTools_micro_transform_active")) else: cmds.iconTextButton("microTransformBtn", edit=True, image=uiMod.getImagePath("specialTools_micro_transform"), highlightImage= uiMod.getImagePath("specialTools_micro_transform copy"))
def create(self, *args): img = cmds.iconTextButton("TempCustomPivotBtn", query=True, image=True) onOff = (img[-10:-4] == "active") if onOff: self.clear() cmds.select(self.sel) return cmds.undoInfo(openChunk=True) cmds.undoInfo(closeChunk=True) cmds.undoInfo(openChunk=True) cmds.undoInfo(closeChunk=True) cmds.undoInfo(openChunk=True) cmds.undoInfo(closeChunk=True) cmds.undoInfo(openChunk=True) self.clear() getCurves = animMod.getAnimCurves() animCurves = getCurves[0] getFrom = getCurves[1] if animCurves: keyTimes = animMod.getTarget("keyTimes", animCurves, getFrom) self.sel = cmds.ls(selection=True) if not self.sel: return cmds.iconTextButton("TempCustomPivotBtn", edit=True, image= uiMod.getImagePath("specialTools_create_temp_custom_pivot_active"), highlightImage= uiMod.getImagePath("specialTools_create_temp_custom_pivot_active")) targetObj = self.sel[-1] aToolsMod.saveInfoWithScene(self.STORE_NODE, self.CTRLS, self.sel) currentFrame = cmds.currentTime(query=True) aToolsMod.saveInfoWithScene(self.STORE_NODE, self.CURRENTFRAME, currentFrame) locators = [] for loopSel in self.sel: nameSpace = utilMod.getNameSpace([loopSel]) loopSelName = "%s_%s"%(nameSpace[0][0], nameSpace[1][0]) locatorName = "tempCustomPivot_%s"%loopSelName locator = animMod.createNull(locatorName) locators.append(locator) G.aToolsBar.align.align([locator], loopSel) locatorGroup = "tempCustomPivot_group" animMod.group(name=locatorGroup) G.aToolsBar.align.align([locatorGroup], targetObj) with G.aToolsBar.createAToolsNode: cmds.parent(locators, locatorGroup) cmds.select(locatorGroup, replace=True) locators.append(locatorGroup) aToolsMod.saveInfoWithScene(self.STORE_NODE, self.LOCATORS, locators) #parent ctrls to locator constraints = ["%s_tempCustomPivot_constraint"%loopConstraint for loopConstraint in self.sel] aToolsMod.saveInfoWithScene(self.STORE_NODE, self.CONSTRAINTS, constraints) for n, loopSel in enumerate(self.sel): with G.aToolsBar.createAToolsNode: cmds.parentConstraint(locators[n], loopSel, name=constraints[n], maintainOffset=True) constraintNode = "%s.blendParent1"%loopSel if not cmds.objExists(constraintNode): continue cmds.setKeyframe(constraintNode) if keyTimes: for loopTime in keyTimes[0]: cmds.setKeyframe("%s.tx"%locatorGroup, time=(loopTime,loopTime)) if loopTime != currentFrame: cmds.setKeyframe(constraintNode, time=(loopTime,loopTime), value=0) #enter edit mode cmds.setToolTo(cmds.currentCtx()) cmds.ctxEditMode() #scriptjob cmds.scriptJob(runOnce = True, killWithScene = True, event =('SelectionChanged', self.scriptJob_SelectionChanged))
def atoolsIsRetiring(self): winName = "atoolsIsRetiringWindow" title = "aTools is Retiring..." if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName) window = cmds.window(winName, title=title) form = cmds.formLayout(numberOfDivisions=100) pos = 10 minWidth = 300.0 # Creating Elements object = cmds.text( label= "aTools is giving place to animBot, a more robust,\nsmart and intuitive toolset. ", align="left") cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 15 object = cmds.image(image=uiMod.getImagePath("atools_animbot")) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 100 object = cmds.text(label="Three Steps for Full Awesomeness:", fn="boldLabelFont") cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 20 object = cmds.button(label="1) Install animBot and have fun!", bgc=(.3, .3, .3), h=45, w=280, command=installAnimBot) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 45 object = cmds.button(label="2) Watch the launch video.", bgc=(.3, .3, .3), h=45, w=280, command=lambda *args: webbrowser.open_new_tab( "https://youtu.be/DezLHqXrDao")) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 45 object = cmds.button( label="3) Join the community.", bgc=(.3, .3, .3), h=45, w=280, command=lambda *args: webbrowser.open_new_tab( "https://www.facebook.com/groups/1589262684419439")) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 65 object = cmds.text( align="left", label= "The upgrade will be optional and although aTools\nwon't get feature updates, it will be available forever.\nPlease check the community for information about\nanimBot development progress." ) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 80 object = cmds.text(label="Enjoy!") cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 20 object = cmds.text(label="-Alan") cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 20 object = cmds.checkBox(label="Don't show this again", value=False, changeCommand=self.dontShowAgain) cmds.formLayout(form, edit=True, attachForm=[(object, 'top', pos), (object, 'left', 10)]) pos += 20 pos += 10 cmds.setParent('..') cmds.showWindow(window) cmds.window(winName, edit=True, widthHeight=(minWidth, pos))
def createLayout(self): cmds.rowLayout(numberOfColumns=5, parent=self.parentLayout) timelineRange = TimelineRange() cmds.iconTextButton (style='iconAndTextVertical', w=self.wb, h=self.hb, image= uiMod.getImagePath("tUtilities_range"), highlightImage= uiMod.getImagePath("tUtilities_range copy"), command=timelineRange.setTimelineRange, annotation="Set timeline range\nRight click for options") timelineRange.popupMenu() cameraTools = CameraTools() cmds.iconTextButton (style='iconAndTextVertical', w=self.wb, h=self.hb, image= uiMod.getImagePath("tUtilities_camera"), highlightImage= uiMod.getImagePath("tUtilities_camera copy"), command=cameraTools.playblastCamera, annotation="Playblast camera\nRight click to select camera") cameraTools.popupMenu()
def createLayout(self): tweenMachine = TweenMachine() cmds.rowColumnLayout(numberOfColumns=100, parent=self.parentLayout) #linear cmds.text( label=' ', h=1 ) cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_left"), highlightImage= uiMod.getImagePath("tweenMachine_left copy"), command=lambda *args: tweenMachine.setTween("linear_prev"), annotation="Overshoot linear tween") cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image= uiMod.getImagePath("tweenMachine_L"), highlightImage= uiMod.getImagePath("tweenMachine_L copy"), command=lambda *args: tweenMachine.setTween("linear"), annotation="Linear tween") cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_right"), highlightImage= uiMod.getImagePath("tweenMachine_right copy"), command=lambda *args: tweenMachine.setTween("linear_next"), annotation="Overshoot linear tween") #tween cmds.text( label=' ', h=1 ) cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_left"), highlightImage= uiMod.getImagePath("tweenMachine_left copy"), command=lambda *args: tweenMachine.setTween(-50), annotation="Overshoot 50% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(-30), annotation="Overshoot 30% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(-10), annotation="Overshoot 10% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image= uiMod.getImagePath("tweenMachine_key"), highlightImage= uiMod.getImagePath("tweenMachine_key copy"), command=lambda *args: tweenMachine.setTween(0), annotation="Copy previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(10), annotation="Tween 90% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(20), annotation="Tween 80% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(33), annotation="Tween 66% with previous key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image= uiMod.getImagePath("tweenMachine_T"), highlightImage= uiMod.getImagePath("tweenMachine_T copy"), command=lambda *args: tweenMachine.setTween(50), annotation="Tween 50%"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(66), annotation="Tween 66% with next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(80), annotation="Tween 80% with next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(90), annotation="Tween 90% with next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image= uiMod.getImagePath("tweenMachine_key"), highlightImage= uiMod.getImagePath("tweenMachine_key copy"), command=lambda *args: tweenMachine.setTween(100), annotation="Copy next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(110), annotation="Overshoot 10% with next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_mid"), highlightImage= uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(130), annotation="Overshoot 30% with next key"); tweenMachine.popUpColor() cmds.iconTextButton(style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image= uiMod.getImagePath("tweenMachine_right"),highlightImage= uiMod.getImagePath("tweenMachine_right copy"), command=lambda *args: tweenMachine.setTween(150), annotation="Overshoot 50% with next key"); tweenMachine.popUpColor()
def createLayout(self): tweenMachine = TweenMachine() cmds.rowColumnLayout(numberOfColumns=100, parent=self.parentLayout) #linear cmds.text(label=' ', h=1) cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_left"), highlightImage=uiMod.getImagePath("tweenMachine_left copy"), command=lambda *args: tweenMachine.setTween("linear_prev"), annotation="Overshoot linear tween") cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image=uiMod.getImagePath("tweenMachine_L"), highlightImage=uiMod.getImagePath("tweenMachine_L copy"), command=lambda *args: tweenMachine.setTween("linear"), annotation="Linear tween") cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_right"), highlightImage=uiMod.getImagePath("tweenMachine_right copy"), command=lambda *args: tweenMachine.setTween("linear_next"), annotation="Overshoot linear tween") #tween cmds.text(label=' ', h=1) cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_left"), highlightImage=uiMod.getImagePath("tweenMachine_left copy"), command=lambda *args: tweenMachine.setTween(-50), annotation="Overshoot 50% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(-30), annotation="Overshoot 30% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(-10), annotation="Overshoot 10% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image=uiMod.getImagePath("tweenMachine_key"), highlightImage=uiMod.getImagePath("tweenMachine_key copy"), command=lambda *args: tweenMachine.setTween(0), annotation="Copy previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(10), annotation="Tween 90% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(20), annotation="Tween 80% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(33), annotation="Tween 66% with previous key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image=uiMod.getImagePath("tweenMachine_T"), highlightImage=uiMod.getImagePath("tweenMachine_T copy"), command=lambda *args: tweenMachine.setTween(50), annotation="Tween 50%") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(66), annotation="Tween 66% with next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(80), annotation="Tween 80% with next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(90), annotation="Tween 90% with next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hb, image=uiMod.getImagePath("tweenMachine_key"), highlightImage=uiMod.getImagePath("tweenMachine_key copy"), command=lambda *args: tweenMachine.setTween(100), annotation="Copy next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(110), annotation="Overshoot 10% with next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_mid"), highlightImage=uiMod.getImagePath("tweenMachine_mid copy"), command=lambda *args: tweenMachine.setTween(130), annotation="Overshoot 30% with next key") tweenMachine.popUpColor() cmds.iconTextButton( style='iconOnly', marginWidth=0, w=self.ws, h=self.hs, image=uiMod.getImagePath("tweenMachine_right"), highlightImage=uiMod.getImagePath("tweenMachine_right copy"), command=lambda *args: tweenMachine.setTween(150), annotation="Overshoot 50% with next key") tweenMachine.popUpColor()
def highlightColorSelection(self): fields = ["create", "rename"] for loopColor in self.colors: loopColorName = loopColor["name"] if loopColorName == G.SS_lastColorUsed: for loopField in fields: cmds.iconTextButton("colorButton%s%s"%(loopField, loopColorName), edit=True, image=uiMod.getImagePath('specialTools_gray_dot_c'), style='iconOnly') else: for loopField in fields: cmds.iconTextButton("colorButton%s%s"%(loopField, loopColorName), edit=True, style='textOnly')