def setID(): sels = ls(sl=1) if sels!=[]: newshader = shadingNode("lambert",asShader=1) setAttr(newshader+".color",random.random(),random.random(),random.random(),type="double3") select(sels,r=1) hyperShade(a=newshader) meleval('hyperShadePanelMenuCommand("hyperShadePanel1", "deleteUnusedNodes");') else: warning("please select A mesh!!")
def scriptNodeCall(): #This is called by the script node to update the dict ct = meleval("currentTime -q") if ct > AnimationRemapper._lastKey: AnimationRemapper._lastKey = ct AnimationRemapper._mapKeyFrameList.append(ct) AnimationRemapper._mapTimeList.append(time.time()) if ct == AnimationRemapper._startTime: AnimationRemapper._lastKey = AnimationRemapper._startTime AnimationRemapper._mapKeyFrameList = [] #Reset AnimationRemapper._mapTimeList = [] #Reset AnimationRemapper._startRecordingTime = time.time() AnimationRemapper._remapperDict = {}
def cleanUp_main(): unknowncb_value = cmds.checkBox("unknowncb", q=True, v=True) wkheadcb_value = cmds.checkBox("wkheadcb", q=True, v=True) unrefcb_value = cmds.checkBox("unrefcb", q=True, v=True) oigcb_value = cmds.checkBox("oigcb", q=True, v=True) tsmcb_value = cmds.checkBox("tsmcb", q=True, v=True) srefnodecb_value = cmds.checkBox("srefnodecb", q=True, v=True) clnoppcb_value = cmds.checkBox("clnoppcb", q=True, v=True) clbaddiscb_value = cmds.checkBox("clbaddiscb", q=True, v=True) clbadmatcb_value = cmds.checkBox("clbadmatcb", q=True, v=True) if tsmcb_value == 1: fantabox.common.cleanUp_mod( fantabox.common.SJ_TSM_cleanup.TSM_menuCleanup(), u"TSM残留script节点") if oigcb_value == 1: fantabox.common.cleanUp_mod(fantabox.common.k016_check_uuoig(), u"多余Oig节点") if unrefcb_value == 1: fantabox.common.cleanUp_mod(fantabox.common.k007_check_UNKNOWNREF(), u"UNKNOWNREF节点") if wkheadcb_value == 1: fantabox.common.cleanUp_mod(fantabox.common.k005_check_wkHeadsUp(), u"wkHeadsUp节点") if srefnodecb_value == 1: fantabox.common.cleanUp_mod(fantabox.common.k009_check_sharedRef(), u"shareReferenceNode节点") if unknowncb_value == 1: fantabox.common.cleanUp_mod(fantabox.common.k008_check_unknown(), u"未知节点") if clnoppcb_value == 1: fantabox.common.cleanUp_mod(k002_check_novertPolo(), u"无点的Plolygons") if clbaddiscb_value == 1: fantabox.common.cleanUp_mod(k015_check_displink(), u"连接断了的置换节点") if clbadmatcb_value == 1: from maya.mel import eval as meleval meleval( 'hyperShadePanelMenuCommand("hyperShadePanel", "deleteUnusedNodes");' )
def __init__(self, snapKeys=True): #Makes sure that it doesnt create any duplicates self.fps = meleval("currentTimeUnitToFPS") try: self.scriptNode = pm.PyNode("AnimationRemapperScriptNode") self.scriptNode.before.set("pass") except: pm.scriptNode(n="AnimationRemapperScriptNode", stp="python", st=7, bs="pass") self.scriptNode = pm.PyNode("AnimationRemapperScriptNode") if snapKeys: self.snapKeys() self.createUI()
def startRecording(self): if not self._selectedObjects: self._selectedObjects = pm.selected() self.fps = meleval("currentTimeUnitToFPS") pm.play(state=False) #update "class variables" variables AnimationRemapper._startRecordingTime = time.time() AnimationRemapper._startTime = pm.playbackOptions(q=1, min=1) AnimationRemapper._endTime = pm.playbackOptions(q=1, max=1) AnimationRemapper._mapKeyFrameList = [] AnimationRemapper._mapTimeList = [] #Start the scriptNode and set the currentTime to the start of the timerange module = __name__ #Activate the scriptNode self.scriptNode.before.set( "import {0}; {0}.scriptNodeCall()".format(module)) pm.currentTime(AnimationRemapper._startTime ) #Setting the time to start time resets the dict