def btn_play(): if pm.play( q=True, state=True ): pm.symbolButton( widget['playButton'], e=True, image='interactivePlayback.png' ) pm.play( state=False ) else: pm.symbolButton( widget['playButton'], e=True, image='timestop.png' ) pm.mel.InteractivePlayback()
def tablechanged(self, row, column): self.setNewTextCell(self.ui.instance_tw.item(row, column)) if not self.IsFirstStart: isPlay = pm.play(q=True, state=True) if isPlay: pm.play(state=False) self.updateDynState(1) if isPlay: pm.runtime.InteractivePlayback()
def previewPlay(self): self.curr = pm.currentTime(q=1) self.start = pm.playbackOptions(q=1, min=1) self.end = pm.playbackOptions(q=1, max=1) start = self.Start_SP.value() end = self.End_SP.value() pm.playbackOptions(min=start, max=end) pm.play(state=1) self.Preview_BTN.setStyleSheet("background:red")
def stageMouseRelease(self, event): #delete recordAttr nodes self.isRecording = False; if self.recordingMode: pm.play(state=False) for i in range(0,2): for mAttr in self.attrs[i]: pm.select(mAttr.nodeName()) pm.recordAttr(at = mAttr.longName(), delete=1) pm.currentTime(self._startTime) else: for i in range(0,2): for j in range(0,len(self.attrs[i])): pm.setAttr(self.attrs[i][j], self._startAttrs[i][j])
def BakeAnimationsToBaseLayer(): pm.play(st=False) BinaryImportForUI.BakeAnimations(hirarchy) if (len(animLayerList1) > 0): pm.delete(animLayerList1[0]) if (len(animLayerList2) > 0): pm.delete(animLayerList2[0]) if (len(animLayerList3) > 0): pm.delete(animLayerList3[0]) if (len(animLayerList4) > 0): pm.delete(animLayerList4[0]) bakeAnimUI.hide() ui.show()
def stageMousePress(self, event): self._startTime = pm.currentTime(q=1) self.mouseOrigin[0] = event.x() self.mouseOrigin[1] = event.y() self.isRecording = True for i in range(0,2): self._startAttrs[i] = [] for mAttr in self.attrs[i]: self._startAttrs[i].append(pm.getAttr(mAttr)) if self.recordingMode: timeRange = (pm.playbackOptions(q=1,min=1), pm.playbackOptions(q=1,max=1)) for i in range(0,2): for mAttr in self.attrs[i]: pm.cutKey(mAttr.nodeName(), at=mAttr.longName(), time=timeRange, option='keys') pm.select(mAttr.nodeName()) pm.recordAttr(at = mAttr.longName()) pm.play(record=True)
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
def CreateBakedLayers(): nope1 = 1 nope2 = 1 nope3 = 1 nope4 = 1 if (len(jointMatrixesListAnim1) > 0): if (len(hirarchy) == len(jointNameListAnim1)): animName = BinaryImportForUI.FindAnimName(pathsList1[0]) pathsList1.append(animName) BinaryImportForUI.CreateLayers( animName, hirarchy, nrOFFramesAndJointsAnim1[0], parentRotations, parentOrentations, parentOrentationsInvert, perentMatrixList, perentMatrixListInvers, jointMatrixesListAnim1, animLayerList1) else: sys.stdout.write( 'Error: The number of selected joints for target skeletton and source animation 1 must be the same.' ) nope1 = 0 if (len(jointMatrixesListAnim2) > 0): if (len(hirarchy) == len(jointNameListAnim2)): animName = BinaryImportForUI.FindAnimName(pathsList2[0]) pathsList2.append(animName) BinaryImportForUI.CreateLayers( animName, hirarchy, nrOFFramesAndJointsAnim2[0], parentRotations, parentOrentations, parentOrentationsInvert, perentMatrixList, perentMatrixListInvers, jointMatrixesListAnim2, animLayerList2) else: sys.stdout.write( 'Error: The number of selected joints for target skeletton and source animation 2 must be the same.' ) nope2 = 0 if (len(jointMatrixesListAnim3) > 0): if (len(hirarchy) == len(jointNameListAnim3)): animName = BinaryImportForUI.FindAnimName(pathsList3[0]) pathsList3.append(animName) BinaryImportForUI.CreateLayers( animName, hirarchy, nrOFFramesAndJointsAnim3[0], parentRotations, parentOrentations, parentOrentationsInvert, perentMatrixList, perentMatrixListInvers, jointMatrixesListAnim3, animLayerList3) else: sys.stdout.write( 'Error: The number of selected joints for target skeletton and source animation 3 must be the same.' ) nope3 = 0 if (len(jointMatrixesListAnim4) > 0): if (len(hirarchy) == len(jointNameListAnim4)): animName = BinaryImportForUI.FindAnimName(pathsList4[0]) pathsList4.append(animName) BinaryImportForUI.CreateLayers( animName, hirarchy, nrOFFramesAndJointsAnim4[0], parentRotations, parentOrentations, parentOrentationsInvert, perentMatrixList, perentMatrixListInvers, jointMatrixesListAnim4, animLayerList4) else: sys.stdout.write( 'Error: The number of selected joints for target skeletton and source animation 4 must be the same.' ) nope4 = 0 if nope1 is not 0 and nope2 is not 0 and nope3 is not 0 and nope4 is not 0: jointUI.hide() bakeAnimUI.show() pm.play(f=True) if (len(pathsList1) > 0): bakeAnimUI.AnimNameRef1.addItem(pathsList1[1]) if (len(pathsList2) > 0): bakeAnimUI.AnimNameRef2.addItem(pathsList2[1]) if (len(pathsList3) > 0): bakeAnimUI.AnimNameRef3.addItem(pathsList3[1]) if (len(pathsList4) > 0): bakeAnimUI.AnimNameRef4.addItem(pathsList4[1])
def _enable_time_listener(self): return pm.play(q=True, state=True) or True
def _enable_time_listener(self): if not self._pause_during_playback: return True return not pm.play(q=True, state=True)
def StopPlayback(): """ Stops playback of the current Maya scene (if currently in progress). """ pm.play(state=False)
def ScenePlaybackInProgress(): """ Returns True if the Maya scene is currently 'playing', False otherwise. """ return pm.play(query=True, state=True)
def previewStop(self): pm.playbackOptions(min=self.start, max=self.end) pm.play(state=0) pm.currentTime(self.curr) self.Preview_BTN.setStyleSheet("")