def increment_time(): CONFIG[CURRENT_TIME_KEY] = CONFIG[CURRENT_TIME_KEY] + CONFIG['TIME_INCREMENT'] pm.playbackOptions(loop='once', maxTime=CONFIG['MAX_TIME']) currentTime = get_current_time() maxTimeBuffer = get_max_time()-10 if (currentTime >= maxTimeBuffer): increase_max_time()
def setPlaybackRange_ofCamera(self, camera): if not camera.hasAttr("frameRange"): return pm.playbackOptions(min=camera.startFrame, max=camera.endFrame, ast=camera.startFrame, aet=camera.endFrame)
def AddClip(self): """ Add new animation to table """ # Add row rowPosition = self.rowCount() self.insertRow(rowPosition) # Enabled enabledCheck = QCheckBox() enabledCheck.setFixedSize(24, 24) enabledCheck.setChecked(True) enabledCheck.setGeometry(10, 10, 24, 24) self.setCellWidget(rowPosition, 0, enabledCheck) # Animation name name = QLineEdit() name.setText("Anim0") self.setCellWidget(rowPosition, 1, name) # Frame start/end def CreateFrameBox(): spinBox = QSpinBox() spinBox.setRange(-9999, 9999) return spinBox start = CreateFrameBox() start.setValue(int(pm.playbackOptions(q=True, min=True))) end = CreateFrameBox() end.setValue(int(pm.playbackOptions(q=True, max=True))) self.setCellWidget(rowPosition, 2, start) self.setCellWidget(rowPosition, 3, end) # Return row position so we can read data from this row return rowPosition
def setFrameRange(start, end, timeUnit): pm.playbackOptions(minTime=start) pm.playbackOptions(maxTime=end) time = 'film' if timeUnit == 'PAL(25 fps)': time = 'pal' elif timeUnit == 'NTSC(30 fps)': time = 'ntsc' elif timeUnit == 'Game(15 fps)': time = 'game' pm.currentUnit(time=time)
def clear_keyframes(self, currentMaxTime=CONFIG['MAX_TIME']): #currentMaxTime = pm.playbackOptions(query=True, maxTime=True) #CONFIG['MAX_TIME'] = currentMaxTime self.currentTime = 1 for joint in self.jointList: #print joint joint.clear_keyframes(currentMaxTime) #Clear All the key frames for every joint #pm.refresh(force=True) if (self.has_target()): self.target.clear_keyframes(currentMaxTime) CONFIG[CURRENT_TIME_KEY] = CONFIG['MIN_TIME'] CONFIG['MAX_TIME'] = CONFIG['INITIAL_MAX_TIME'] #print CONFIG['MAX_TIME'] pm.playbackOptions(maxTime= CONFIG['MAX_TIME'])
def reset_time(): #Clear All the key frames for every joint currentMaxTime = pm.playbackOptions(query=True, maxTime=True) #print 'woo' #print currentMaxTime for hand in HANDS: #print jointKey #pm.cutKey(jointKey, time=(1, currentMaxTime), option='keys') for finger in hand: finger.clear_keyframes() pm.refresh(force=True) CONFIG[CURRENT_TIME_KEY] = CONFIG['MIN_TIME'] CONFIG['MAX_TIME'] = CONFIG['INITIAL_MAX_TIME']
def setDefault(self, ctrl): # Camera ctrl.focalLength.set(35.0) ctrl.overscan.set(1) ctrl.startFrame.set(pm.playbackOptions(q=True, min=True)) ctrl.endFrame.set(pm.playbackOptions(q=True, max=True)) # Tumble ctrl.tumbleTranslateZ.set(24) ctrl.tumbleRotateX.set(-30) ctrl.tumbleRotateY.set(45) ctrl.tumbleRotateZ.set(0) # Shake ctrl.timeOffset.set(3) ctrl.shakeAmplitude1.set(3) ctrl.shakeFrequency1.set(0.8) ctrl.shakeAmplitude2.set(0) ctrl.shakeFrequency2.set(10) ctrl.shakeTranslateX.set(0.2) ctrl.shakeTranslateY.set(0.2) ctrl.shakeTranslateZ.set(0.2) ctrl.shakeRotateX.set(1) ctrl.shakeRotateY.set(1) ctrl.shakeRotateZ.set(1)
def increase_max_time(): CONFIG['MAX_TIME'] = CONFIG['MAX_TIME'] + 200 pm.playbackOptions(maxTime=CONFIG['MAX_TIME'])
def setRange(self): ctrl = self.getCtrl() startFfame = ctrl.startFrame.get() endFrame = ctrl.endFrame.get() #pm.playbackOptions(min=startFfame, max=endFrame, ast=startFfame, aet=endFrame) pm.playbackOptions(min=startFfame, max=endFrame)
def getFrameRange(): start = pm.playbackOptions(q=True, minTime=True) end = pm.playbackOptions(q=True, maxTime=True) return [start, end]