def tgpMakeBC(self, mshChar, deleteRight): startFrame = mc.playbackOptions(query=True, minTime=True) mc.currentTime(startFrame) mySel = mc.ls(sl=True)[0] # my current selection mc.cutKey(mySel, s=True) # delete key command # return records = ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'] for i in range(len(records)): name = "record{0}".format(i + 1) if mc.objExists(name): mc.delete(name) try: mc.setAttr("{0}.{1}".format(mySel, records[i]), 0) except: print("{0}.{1} could not be set".format(mySel, records[i])) # pyml.SetKeyTranslate() pyml.SetKey() currentUnitAngle = mc.currentUnit(q=True, a=True) mc.currentUnit(a="rad") mc.recordAttr(at=records) mc.play(record=True) mc.currentUnit(a=currentUnitAngle)
def removeAttrsToRecord(self, attrs=None, *args): node = cmds.ls(sl=True, l=True)[0] if not attrs: attrs = r9Anim.getChannelBoxSelection() if attrs: cmds.recordAttr(node, at=attrs, delete=True) else: raise StandardError('No Channels selected in the ChannelBox to Set')
def removeAttrsToRecord(self,attrs=None,*args): node=cmds.ls(sl=True,l=True)[0] if not attrs: attrs=r9Anim.getChannelBoxSelection() if attrs: cmds.recordAttr(node,at=attrs,delete=True) else: raise StandardError('No Channels selected in the ChannelBox to Set')
def addAttrsToRecord(self, attrs=None, *args): node = cmds.ls(sl=True, l=True)[0] if not attrs: attrs = r9Anim.getChannelBoxSelection() if attrs: try: if self.rotateInRads and self.currAngularUnits == 'deg': log.info('setting AngularUnits to Radians') cmds.currentUnit(angle='rad') cmds.recordAttr(node, at=attrs) except: pass finally: cmds.currentUnit(angle=self.currAngularUnits) log.info('setting AngularUnits back to Degrees') else: raise StandardError('No Channels selected in the ChannelBox to Set')
def addAttrsToRecord(self,attrs=None,*args): node=cmds.ls(sl=True,l=True)[0] if not attrs: attrs=r9Anim.getChannelBoxSelection() if attrs: try: if self.rotateInRads and self.currAngularUnits=='deg': log.info('setting AngularUnits to Radians') cmds.currentUnit(angle='rad') cmds.recordAttr(node,at=attrs) except: pass finally: cmds.currentUnit(angle=self.currAngularUnits) log.info('setting AngularUnits back to Degrees') else: raise StandardError('No Channels selected in the ChannelBox to Set')