def offsetTime(self, offset): if r9Setup.mayaVersion() == 2011: #Autodesk f****d up in 2011 and we need to manage both these attrs cmds.setAttr('%s.offset' % self.audioNode, self.startFrame + offset) cmds.setAttr('%s.endFrame' % self.audioNode, self.length + offset) else: cmds.setAttr('%s.offset' % self.audioNode, self.startFrame + offset)
def offsetTime(self, offset): ''' offset the time of this audioNode instance :param offset: amount to offset ''' if self.isLoaded: if r9Setup.mayaVersion() == 2011: #Autodesk f****d up in 2011 and we need to manage both these attrs cmds.setAttr('%s.offset' % self.audioNode, self.startFrame + offset) cmds.setAttr('%s.endFrame' % self.audioNode, self.length + offset) else: cmds.setAttr('%s.offset' % self.audioNode, self.startFrame + offset)
def wrapper(*args, **kwargs): try: evalmode = None if r9Setup.mayaVersion() >= 2016: evalmode = cmds.evaluationManager(mode=True, q=True)[0] if evalmode == 'parallel': evalManagerState(mode='off') res = func(*args, **kwargs) except: log.info('Failed on evalManager_DG decorator') finally: if evalmode: evalManagerState(mode=evalmode) return res
def wrapper(*args, **kwargs): try: evalmode=None if r9Setup.mayaVersion()>=2016: evalmode=cmds.evaluationManager(mode=True,q=True)[0] if evalmode=='parallel': evalManagerState(mode='off') res = func(*args, **kwargs) except: log.info('Failed on evalManager_DG decorator') finally: if evalmode: evalManagerState(mode=evalmode) return res
def __enter__(self): self.autoKeyState=cmds.autoKeyframe(query=True, state=True) self.timeStore['currentTime'] = cmds.currentTime(q=True) self.timeStore['minTime'] = cmds.playbackOptions(q=True, min=True) self.timeStore['maxTime'] = cmds.playbackOptions(q=True, max=True) self.timeStore['startTime'] = cmds.playbackOptions(q=True, ast=True) self.timeStore['endTime'] = cmds.playbackOptions(q=True, aet=True) self.timeStore['playSpeed'] = cmds.playbackOptions(query=True, playbackSpeed=True) if self.mangage_undo: cmds.undoInfo(openChunk=True) else: cmds.undoInfo(swf=False) if self.manage_em: if r9Setup.mayaVersion()>=2016: self.evalmode=cmds.evaluationManager(mode=True,q=True)[0] if self.evalmode=='parallel': evalManagerState(mode='off')
def evalManagerState(mode='off'): ''' wrapper function for the evalManager so that it's switching is recorded in the undo stack via the Red9.evalManager_switch plugin ''' if r9Setup.mayaVersion()>=2016: if not cmds.pluginInfo('evalManager_switch', q=True, loaded=True): try: cmds.loadPlugin('evalManager_switch') except: log.warning('Plugin Failed to load : evalManager_switch') try: # via the plug-in to register the switch to the undoStack cmds.evalManager_switch(mode=mode) except: log.debug('evalManager_switch plugin not found, running native Maya evalManager command') cmds.evaluationManager(mode=mode) # run the default maya call instead log.debug('EvalManager - switching state : %s' % mode) else: log.debug("evalManager skipped as you're in an older version of Maya")
def evalManagerState(mode='off'): ''' wrapper function for the evalManager so that it's switching is recorded in the undo stack via the Red9.evalManager_switch plugin ''' if r9Setup.mayaVersion() >= 2016: if not cmds.pluginInfo('evalManager_switch', q=True, loaded=True): try: cmds.loadPlugin('evalManager_switch') except: log.warning('Plugin Failed to load : evalManager_switch') try: # via the plug-in to register the switch to the undoStack cmds.evalManager_switch(mode=mode) except: log.debug('evalManager_switch plugin not found, running native Maya evalManager command') cmds.evaluationManager(mode=mode) # run the default maya call instead log.debug('EvalManager - switching state : %s' % mode) else: log.debug("evalManager skipped as you're in an older version of Maya")
def show(cls): if r9Setup.mayaVersion() < 2010: raise StandardError('This tool is not supported in versions of Maya running Python2.5') cls()._showUI()
def show(cls): if r9Setup.mayaVersion()<2010: raise StandardError('This tool is not supported in versions of Maya running Python2.5') cls()._showUI()