当前位置: 首页>>代码示例>>Python>>正文


Python core.playbackOptions函数代码示例

本文整理汇总了Python中pymel.core.playbackOptions函数的典型用法代码示例。如果您正苦于以下问题:Python playbackOptions函数的具体用法?Python playbackOptions怎么用?Python playbackOptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了playbackOptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keys_shift

def keys_shift(targets, incr=0.0, rand=0.0, rand_abs=False, round=False):
    """ This script will copy the keyframes from source to targets from selected channel box attributes
    Args:
        targets [pm.nt.Transform]: target transforms to sequentialize
        incr (float): Increment value through selection by x, 0 is no increment
        rand (float): Randomly shift by x, 0 is no shift
        rand_abs (bool): Random range will be absolute and not include negatives
        round (bool): whether or not to round the key shift value to an integer
    Returns (None)
    Example:
        keys_shift(pm.ls(sl=True), rand=5.0, round=True)
    """
    #Determine Selected attributes from channelbox
    attrs = get_cb_sel_attrs()
    x_shift = 0
    for target in targets:
        ast, aet = pm.playbackOptions(q=True, ast=True), pm.playbackOptions(q=True, aet=True)
        rand_val = 0
        if rand:
            rand_val = random.randrange(-rand*(1-rand_abs), rand)
        x_shift += rand_val
        if round:
            x_shift=int(x_shift)
        pm.keyframe(target, edit=True, at=attrs, relative=True, timeChange=x_shift)
        x_shift += incr
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:lib_keys.py

示例2: duplicateSequence

def duplicateSequence(objects):
	'''duplicates the given objects as groups per frame with properly named objects
	Args:
		objects (list(pm.PyNode)): list of objects to be duplicated every frame
	Returns:
		nothing...yet.
	Usage:
		duplicateSequence(pm.ls(sl=True))
	'''
	for obj in objects:
		topGrp = obj.getParent().name().replace('GRP','ANIM_GRP')
		if pm.objExists(topGrp):
			topGrp = pm.PyNode(topGrp)
		else:
			topGrp = pm.group(em=True,n=topGrp)
		startFrame = pm.playbackOptions(q=True,ast=True)
		endFrame = pm.playbackOptions(q=True,aet=True)
		incr = 1
		grp = pm.group(em=True, n=obj.name().replace('GEO','ANIM_GRP'), p=topGrp)
		i=0
		for frame in range (startFrame, endFrame+1, incr):
			pm.currentTime(frame)
			dup=pm.duplicate(obj, n=obj.name().replace('GEO','%d_GEO'%i))
			dup[0].setParent(grp)
			i+=1
开发者ID:creuter23,项目名称:tools,代码行数:25,代码来源:duplicateSequence.py

示例3: main

def main():
	prefRun()
	#get all renderable cameras in scene
	allCamShapes = pm.ls( type='camera')

	
	cams = []
	for cam in allCamShapes:
		if pm.getAttr(cam+".renderable"):
			cams.append(pm.listRelatives(cam, p=1))
			
	print cams
		
	
	#Get the current frame range from the timeslider
	startTime = pm.playbackOptions(q=True, min=True )
	endTime = pm.playbackOptions(q=True, max=True )
	
	print "Playblasting Cameras:",
	
	#generate playblast for each renderable cam
	for cam in cams:
		pm.playblast(
			cam, 
			startTime=startTime, 
			endTime=endTime, 
			viewer=0, 
			#filename="X:/Projects/GREY11_ANM71_Rewe_Starzone/GR11A71_Shots/GR11A71_Animatic/Animatic_Maya/data/test"+cam[0])
			)
	
	print "for range: %04d - %04d" % (startTime,endTime)
开发者ID:maitelels,项目名称:maya_scripts,代码行数:31,代码来源:tim_playblastRenderableCameras.py

示例4: aw_copyKeys

def aw_copyKeys(source, targets, randomShift=0, increment=0, mo=False):
	'''This script will copy the keyframes from source to targets from selected channel box attributes
	Args:
		source (mayaObject): Source object with animation
		targets (list[mayaObject]): Copy To Targets
		randomShift (int): Randomly shift by x, 0 is no shift
		increment (int): Increment value through selection by x, 0 is no increment
		mo (Boolean): Maintain the Offset or not
	Returns (void): no return
	Example:
		aw_copyKeys(pm.PyNode('pSphere1'), pm.ls(sl=True), randomShift=0, increment=1, mo=True)
	'''
	args=targets
	animSrc=source
	#Determine Selected attributes from channelbox
	pm.language.melGlobals.initVar( 'string', 'gChannelBoxName' )
	attrs = pm.channelBox(pm.language.melGlobals['gChannelBoxName'],q=True,sma=True)
	#Copy Keys from the Graph Editor for main object (deselect other objects before copying)
	if not attrs:
		print 'Nothing selected in channel box, setting copy attributes to default all'
		attrs=['tx','ty','tz','rx','ry','rz','sx','sy','sz','v']
	for arg,i in zip(args, range(len(args))):
		if arg != animSrc:
			for attr in attrs:
				pm.copyKey(animSrc, time = (pm.playbackOptions(q=True,ast=True), pm.playbackOptions(q=True,aet=True)), at=attr,option="curve", hierarchy='none')
				#Paste keys to all objects depending on attributes selected from the channelBox
				offsetCheck = attr in ['tx','ty','tz','rx','ry','rz']
				offsetSeed = ((i+1) * increment) + int(math.floor( random.random() * randomShift))
				pm.pasteKey(arg, option='insert', valueOffset=((offsetCheck * mo) * (arg.attr(attr).get() - animSrc.attr(attr).get())), copies=True, connect=True, at=attr, timeOffset=offsetSeed)
开发者ID:creuter23,项目名称:tools,代码行数:29,代码来源:lib_keys.py

示例5: set_range_from_seq

    def set_range_from_seq(self):
        """sets the playback range from the sequencer node in the scene
        """
        min_frame = self.sequencer.getAttr('minFrame')
        max_frame = self.sequencer.getAttr('maxFrame')

        pm.playbackOptions(ast=min_frame, aet=max_frame, min=min_frame, max=max_frame)
开发者ID:eoyilmaz,项目名称:anima,代码行数:7,代码来源:previs.py

示例6: exportAnimation

    def exportAnimation(self):
        exportFolder = ASSETS_PATH + 'characters/' + self.name + '_std/animations/'
        exportAnimationsPath = os.path.join(CHARACTERS_PATH ,self.name,'animation')
        animFiles = []
        if os.path.isdir(exportAnimationsPath):
            animFiles = [f for f in sorted(os.listdir(exportAnimationsPath)) if f.endswith('.ma') or f.endswith('.ma') ]
        else:
            pm.warning('No animation files found, aborting!')
            return
        #self.logger.info('########### Exporting animations for OGRE ###########')
        for anim in animFiles:
            animFile = os.path.join(exportAnimationsPath,anim)
            pm.openFile(animFile,f=1)
            start = int(pm.playbackOptions(q=1,ast=1))
            end = int(pm.playbackOptions(q=1,aet=1))
            #ogreExport -all -outDir "P:/mixamo_character/assets/characters/EveBavaria_std/animations/" -skeletonClip "EveBavaria_action_unjured_walk_35" startEnd 0 34 frames sampleByFrames 1 -lu pref -scale 1.00 -skeletonAnims -skelBB -np bindPose

            cmd = 'ogreExport -all -outDir "'+ exportFolder + '"'
            cmd += ' -skeletonClip "' + anim.split('.')[0] + '"'
            if 'speak' in anim:
                cmd += ' startEnd 0 1' 
            else:
                cmd += ' startEnd ' + str(start) + ' ' + str(end)
            cmd += ' frames sampleByFrames 1 -lu pref -scale 1.00 -skeletonAnims -skelBB -np bindPose'

            pm.mel.eval(cmd)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:26,代码来源:zoobeMixamo.py

示例7: viewOutHide

def viewOutHide():
    
    transNodeList = []
    
    startTime = pm.playbackOptions(q=1, min=1)
    endTime = pm.playbackOptions(q=1, max=1)
    
    for x in range(int(startTime), int(endTime + 1)):
        pm.currentTime(x)
        transNodeList += viewObjectList(False)
    
    transNodeListS = set(transNodeList)

    allTransNodeList = set()
    
    for x in pm.ls(type='mesh'):
        allTransNodeList.add(x.getParent().name())

    hideList = allTransNodeList - transNodeListS
    
    for x in hideList:
        try:
            pm.setAttr(x + '.v', 0)
        except:
            pass

    pm.currentTime(startTime)
开发者ID:jiwonchoe,项目名称:mayaPy,代码行数:27,代码来源:viewMeshHide.py

示例8: fixedSeed

def fixedSeed():
  sel = pm.selected()
  
  animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
  animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
    
  for attr in sel:
    animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
    animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
    
    xVal = attr.rotateX.get()
    yVal = attr.rotateY.get()
    zVal = attr.rotateZ.get()
  
    print animStartTime
    print animEndTime
    print xVal
    print yVal
    print zVal
      
    while animStartTime<=animEndTime:
      attr.rotateX.set(xVal+random.uniform(-.1,.1))
      attr.rotateY.set(yVal+random.uniform(-.1,.1))
      attr.rotateZ.set(zVal+random.uniform(-.1,.1))
      pm.setKeyframe(attribute="rotate", time=animStartTime)
      animStartTime+=1
开发者ID:maitelels,项目名称:maya_scripts,代码行数:26,代码来源:tim_bakeJitter.py

示例9: writeRetimeFile

    def writeRetimeFile(viz, pubShot):
        '''
        Write the animated data on the currentTime attribute to a txt file.
        '''
        tmpPath = None
        # Return None if the attribute is not keyed.
        
        if pm.keyframe('%s.currentTime'%viz, query=True, keyframeCount=True):
            # get framelist from pod
            podFile = str(pm.getAttr('%s.podFile'%viz))
            ggcp = GtoGeometryCachePod.fromPodFile(podFile)
            ggcp.startFrame = pm.playbackOptions(q=True, animationStartTime=True)
            ggcp.endFrame = pm.playbackOptions(q=True, animationEndTime=True)
            frameList = ggcp.frameNumberList()
#             offset = float(pm.getAttr('%s.timeOffset'%viz))
#             frameList = [frame + offset for frame in ggcp.frameNumberList()]
            
            # Get curve data
            animCurveData = list()
            for frame in frameList:
                value = pm.keyframe(viz, query=True, time=[frame], attribute='currentTime', eval=True)
                assert len(value) == 1, '%s keyframes found for time %s. One expected.' % (len(value), frame)
                animCurveData.append([frame, value[0]])

            # Write it out to a temp file
            selCharName = str(pm.getAttr('%s.label'%viz))
            if not tmpPath:
                name = '_'.join(['animLib', 'bd', pubShot, selCharName, 'retime.txt'])
                tmpPath = os.path.join(tempfile.gettempdir(), name)
            fh = open(tmpPath, 'w')
            for time, value in animCurveData:
                fh.write('%s %s\n' % (time, value))
            fh.close()
            
        return tmpPath
开发者ID:davidkaplan,项目名称:tippett-codesamples,代码行数:35,代码来源:animLib.py

示例10: _bakeAnim

    def _bakeAnim(self, root):
        '''
        Given root:
        - Bake the heirarchy animation data
        - Reset timeline to 1 if wasn't already set to 1
        '''
        print 'Starting: bakeAnim()...'
        # Getting time range from scene
        startFrame = int( pm.playbackOptions(q=1, min=1) )
        endFrame = int( pm.playbackOptions(q=1, max=1) )

        pm.select(root, hi=1, r=1)

        # Set timeline to start at frame 1
        if startFrame != 1:
            if startFrame < 1:
                tChange = (-(startFrame))+1
            elif startFrame > 1:
                tChange = (-(startFrame-1))
        
            pm.keyframe(e=1, time=(startFrame, endFrame), relative=1, timeChange=tChange)
            pm.playbackOptions(e=1, min=1, max=endFrame+tChange )
            
        pm.bakeResults(root, 
                       t=(startFrame, endFrame), 
                       simulation=True, hi='below' )
        
        print 'bakeAnim(): Baked anim onto %s' % root
        print 'bakeAnim(): Range baked: %s - %s' % (startFrame, endFrame) 
        print 'End: bakeAnim()'
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:30,代码来源:RR_AnimExporter.py

示例11: importAnimation

    def importAnimation(self, speak=0,lib=1):
        print 'Importing Animation'
        rigFile = os.path.join(CHARACTERS_PATH,self.name,'rigging',self.name + '.ma')
        pm.openFile(rigFile,f=1)
        if lib:
            importAnimPath = ANIM_LIB_PATH
        else:
            fbxPath = os.path.split(self.fbxFile)[0]
            importAnimPath = fbxPath + '/' + 'animations/'

        animFiles = [f for f in os.listdir(importAnimPath) if f.endswith('.fbx')]
        #self.logger.info('########### Importing animations from library ############')
        for anim in animFiles:
            pm.mel.eval('FBXImportFillTimeline -v 1;')
            cmd = 'FBXImport -f "' + importAnimPath + anim+ '" -caller \"FBXMayaTranslator\" -importFormat \"fbx;v=0\"'
            pm.mel.eval(cmd)
            #self.logger.info('Imported %s ', (importAnimPath + anim))
            #pm.importFile(importAnimPath + anim, type='FBX',mergeNamespacesOnClash=0,rpr=anim.split('.')[0],options = 'v=0;',loadReferenceDepth = 'all')
            start = pm.playbackOptions(q=1,ast=1)
            end = pm.playbackOptions(q=1,aet=1)
            pm.bakeResults( 'shadowJoint',t=(start,end), simulation=True )

            self.saveAnimation(anim.split('.')[0])

            pm.openFile(rigFile,f=1)

        if speak:
            #self.logger.info('Creating speak anims ')
            for anim in speakAnims:
                pm.openFile(rigFile,f=1)
                animationFile = os.path.join(CHARACTERS_PATH,self.name,'animation',anim + '.ma')
                #self.logger.info('%s created',animationFile)
                pm.saveAs(animationFile,f=1)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:33,代码来源:zoobeMixamo.py

示例12: copyZoobeAnimations

    def copyZoobeAnimations(self,zoobeChar):
        print 'Importing Zoobe Animations'


        if zoobeChar:
            sourceChar = 'source:' + zoobeChar
            fuseChar = self.name

            rigFile = os.path.join(CHARACTERS_PATH,self.name,'rigging',self.name + '.ma')

            zoobeCharFolder = os.path.join(ANIM_LIB_PATH,zoobeChar)
            if os.path.isdir(zoobeCharFolder):
                animFiles = [f for f in os.listdir(zoobeCharFolder) if (f.endswith('.ma') or f.endswith('.mb'))]
                animFile = '/home/zoobe/mixamo/testproject/incoming/animLib/violet/violet_angry_action_01.ma'
                #self.copyAnimation(animFile,sourceChar,fuseChar,0,300)

                for anim in animFiles:
                    print animFile
                    animPath = os.path.join(zoobeCharFolder,anim)
                    print animPath 
                    pm.openFile(animPath,f=1)
                    start = pm.playbackOptions(q=1,ast=1)
                    end = pm.playbackOptions(q=1,aet=1)
                    print start, end
                    self.copyAnimation(animPath,sourceChar,fuseChar,start,end)
                    print 'saving animation %s'%anim.split('.')[0]

                    self.saveAnimation(anim.split('.')[0])
            else:
                pm.warning('Did not find %s char folder'%zoobeChar)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:30,代码来源:zoobeMixamo.py

示例13: togglePlaybackSpeed

def togglePlaybackSpeed():
    """Toggle between Real-time and Every Frame playback"""

    newSpeed = not bool( pm.playbackOptions( playbackSpeed=True, query=True ) )
    pm.playbackOptions( playbackSpeed=newSpeed )

    pm.headsUpDisplay( 'HUDPlaybackSpeed', edit=True )
    print 'Playback Speed: %s' % ( 'Every Frame', 'Real-time' )[newSpeed]
开发者ID:kinetifex,项目名称:maya-kinetifex,代码行数:8,代码来源:display.py

示例14: setCamPlaybackRange

def setCamPlaybackRange():
    modelPanel = pm.playblast(activeEditor=True).split('|')[-1]

    activeCam  = pm.PyNode( pm.modelPanel( modelPanel, q=True, camera=True ) )
    startFrame = activeCam.startFrame.get()
    endFrame   = activeCam.endFrame.get()

    pm.playbackOptions(min=endFrame, max=startFrame)
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:8,代码来源:general.py

示例15: set_framesField

	def set_framesField(self):
		interv_int = self.interv_int.value()
		orbit_int = self.orbit_int.value()
		value = interv_int * orbit_int

		self.frames_int.setValue(value)
		pm.setAttr("defaultRenderGlobals.endFrame", value)
		pm.playbackOptions(maxTime=value, e=True)
开发者ID:Huston94,项目名称:Orbital_Light_Previewer,代码行数:8,代码来源:orbitLights_UI.py


注:本文中的pymel.core.playbackOptions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。