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


Python cmds.currentTime函数代码示例

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


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

示例1: buildGhostAnimation

def buildGhostAnimation(*args):
    
    obj = 'ghost_body1'

    # get animation start and end points from ui controls
    animation_start = cmds.intField('animation_start', query=True, value=True)
    animation_end   = cmds.intField('animation_end', query=True, value=True)

    for current_time in range(animation_start, animation_end + 1):
        
        cmds.currentTime(current_time, edit=True)
        locatorPos = cmds.xform('character_locator', q=1, t=True)
        
        x = round(locatorPos[0], 2)
        z = round(locatorPos[2], 2)

        if x % 1 == 0.25 or z % 1 == 0.25:
            cmds.xform(obj, rotation = [0, 11.25, 0])
        elif x % 1 == 0.5 or z % 1 == 0.5:
            cmds.xform(obj, rotation = [0, 22.5, 0])
        elif x % 1 == 0.75 or z % 1 == 0.75:
            cmds.xform(obj, rotation = [0, 33.75, 0])
        elif x % 1 == 0 or z % 1 == 0:
            cmds.xform(obj, rotation = [0, 0, 0])
        else:
            assert False, "Unhandled character position"

        cmds.setKeyframe([obj])
开发者ID:andy-walker,项目名称:pacman-3d,代码行数:28,代码来源:pacTools.py

示例2: dsEmitAlongLocator

def dsEmitAlongLocator(start,end,ss):
    y = start
    x = end
    cmds.currentTime(y)
    
    locX = cmds.getAttr('locator1.translateX')
    locY = cmds.getAttr('locator1.translateY')
    locZ = cmds.getAttr('locator1.translateZ')
    beforePos = [locX,locY,locZ]
    
    while y <= x:
        cmds.currentTime(y)
        locX = cmds.getAttr('locator1.translateX')
        locY = cmds.getAttr('locator1.translateY')
        locZ = cmds.getAttr('locator1.translateZ')
        pos = [locX,locY,locZ]
        
        dist = [pos[0]-beforePos[0],pos[1]-beforePos[1],pos[2]-beforePos[2]]
        val = [dist[0]/ss,dist[1]/ss,dist[2]/ss]

        for i in range(ss):
            beforePos = [beforePos[0]+val[0],beforePos[1]+val[1],beforePos[2]+val[2]]
            cmds.emit( object='trail_pt', pos=(beforePos))
            
        beforePos = pos
        y = y + 1
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:26,代码来源:dsEmitAlongLocatorPath.py

示例3: exportSgKeyData

def exportSgKeyData( targetTransformNodes, startFrame, endFrame, step, folderPath=None, exportByMatrix=False, *args ):
    
    import sgBFunction_scene
    import copy
    
    if step < 0.05:
        cmds.error( "Step Must be larger then %.f." % step )
    
    sgBFunction_base.autoLoadPlugin( "sgBDataCmd" )
    if not folderPath: folderPath = sgBFunction_fileAndPath.getDefaultSgKeyDataPath()
    sgBFunction_fileAndPath.makeFolder( folderPath )
    sgBFunction_fileAndPath.removeChildFiles( folderPath )
    
    targetTransformNodeParents = []
    for transformNode in targetTransformNodes:
        targetTransformNodeParents += sgBFunction_dag.getParents( transformNode )
        targetTransformNodeParents.append( transformNode )
    targetTransformNodeParents = list( set( targetTransformNodeParents ) )
    
    sgBFunction_scene.exportTransformData( targetTransformNodeParents, folderPath )
    
    cmds.sgBDataCmd_key( targetTransformNodes, se=1, folderPath= folderPath, ebm=exportByMatrix )
    
    cuTime = copy.copy( startFrame )
    
    while cuTime <= endFrame+1:
        cmds.currentTime( cuTime )
        cmds.sgBDataCmd_key( write=1 )
        cuTime += step

    cmds.sgBDataCmd_key( ee=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:31,代码来源:sgBExcute_data.py

示例4: exportAbc

    def exportAbc(self, root, frameRange=(1,24), suffix="", **kargs):

        self.__abc_files.append(expandFileName('testAnimParticleReadWrite_%s.abc' % suffix))

        # seed on first frame
        cmds.currentTime(1)
        maya.mel.eval("seed(1)")
        
        # First, eval time from one to frameRange start to avoid a possible jump
        for i in range(1,frameRange[0]):
            cmds.currentTime(i)


        # Format argument for extra atrbutes
        argStr = " "
        for item in kargs:
            if isinstance(kargs[item], (tuple,list)):
                for element in kargs[item]:
                    argStr += " -%s %s" % ( item, element )
            else:
               argStr += " -%s %s" % ( item, kargs[item] )

        # Export
        stdoutWrite("writefile: %s" % self.__abc_files[-1])
        cmds.AbcExport(j='-fr %d %d -root %s %s -file ' % (frameRange[0], frameRange[1], root, argStr) + self.__abc_files[-1] )
开发者ID:alembic,项目名称:alembic,代码行数:25,代码来源:animPointPrimitive_nParticle_test.py

示例5: nuke_track_node

def nuke_track_node():
	"""
	creates a nuke track node for the selected transform.
	selection order: trasnform, camera
	"""
	
	selection	= cmds.ls( selection = True )
	point		= selection[0]
	camera		= selection[1]
	cameraShape	= cmds.listRelatives( shapes = True )[0]
	aperture_h	= cmds.camera( camera, hfa=1, q=1)
	aperture_v	= cmds.camera( camera, vfa=1, q=1)
	trackNode	= 'Tracker3 { track1 {{curve x1 '
	tx			= ''
	ty			= ''
	endframe	= 48
	
	for frame in range( 1, endframe + 1 ):
		cmds.currentTime( frame )
		fov_h	= cmds.camera( camera, hfv=1, q=1)
		fov_v	= cmds.camera( camera, vfv=1, q=1)
		track	= get_normalized_screen_position( point, camera, fov_h, fov_v, aperture_h, aperture_v )
		tx		+= str( track[0] * 1280 ) + ' '
		ty		+= str( track[1] * 720 ) + ' '

	trackNode += tx + '} {curve x1 ' + ty + '}}}'
	print '#' * 50
	print '>>> tracker node, copy paste to nuke:'
	print trackNode
开发者ID:danielforgacs,项目名称:code-dump,代码行数:29,代码来源:ford_stabilizer_v0.5.5.py

示例6: exportAndRender

    def exportAndRender(self,
                        renderDir,
                        renderSettings,
                        mitsubaPath,
                        oiiotoolPath,
                        mtsDir, 
                        keepTempFiles,  
                        animation, 
                        frame=None, 
                        verbose=False):

        if frame != None:
            # Calling this can lead to Maya 2016 locking up if you don't have MAYA_RELEASE_PYTHON_GIL set
            # See Readme
            cmds.currentTime(float(frame))
        else:
            frame = 1

        sceneName = self.getScenePrefix()

        scenePrefix = cmds.getAttr("defaultRenderGlobals.imageFilePrefix")
        if scenePrefix is None:
            scenePrefix = sceneName

        outFileName = os.path.join(renderDir, "%s.xml" % scenePrefix)

        # Export scene and geometry
        geometryFiles = MitsubaRendererIO.writeScene(outFileName, renderDir, renderSettings)

        # Render scene, delete scene and geometry
        imageName = self.renderScene(outFileName, renderDir, mitsubaPath, oiiotoolPath,
            mtsDir, keepTempFiles, geometryFiles, animation, frame, verbose,
            renderSettings)

        return imageName
开发者ID:hpd,项目名称:MitsubaForMaya,代码行数:35,代码来源:MitsubaRenderer.py

示例7: _plotter_avrg

 def _plotter_avrg(self):
     '''plots a locator to a vertice or face per keyframe in a timeline'''
     selObj=cmds.ls(sl=1, fl=1)      
     if len(selObj)>0:
         pass
     else:
         print "Select 1 object" 
         return     
     getTopRange=cmds.playbackOptions(q=1, max=1)+1#get framerange of scene to set keys in iteration 
     getLowRange=cmds.playbackOptions(q=1, min=1)-1#get framerange of scene to set keys in iteration 
     edgeBucket=[]
     getRange=arange(getLowRange,getTopRange, 1 )
     getloc=cmds.spaceLocator(n=selObj[0]+"cnstr_lctr")
     cmds.normalConstraint(selObj[0], getloc[0])
     placeloc=cmds.spaceLocator(n=selObj[0]+"lctr")
     for each in getRange:
         cmds.currentTime(each)            
         transform=cmds.xform(selObj, q=1, ws=1, t=1)
         posBucketx=self.array_median_find(transform[0::3])
         posBuckety=self.array_median_find(transform[1::3])
         posBucketz=self.array_median_find(transform[2::3])
         cmds.xform(getloc[0], ws=1, t=(posBucketx, posBuckety, posBucketz))  
         cmds.SetKeyTranslate(getloc[0])
         cmds.xform(placeloc[0], ws=1, t=(posBucketx, posBuckety, posBucketz))
         cmds.SetKeyTranslate(placeloc[0])               
         rotate=cmds.xform(getloc[0], q=True, ws=1, ro=True)
         cmds.xform(placeloc[0], ws=1, ro=rotate)  
         cmds.SetKeyRotate(placeloc[0])
         cmds.currentTime(each)            
开发者ID:edeglau,项目名称:storage,代码行数:29,代码来源:plot.py

示例8: setObjectToShatterCmd

 def setObjectToShatterCmd(self, *args):
     '''
     
     '''
     if not (cmds.draggerContext(self._IScontextTool._mContext, exists = True)):
         
         iMinTime = cmds.playbackOptions(query = True, minTime = True)
         cmds.currentTime(iMinTime, edit = True)       
         
         polySelection = cmds.filterExpand(selectionMask = 12)
         if polySelection:            
             
             if len(polySelection) > 0:                   
                 
                 mBreakNode = cmds.listConnections(polySelection[0], sh = True, type = 'fxBreakGeometry')
                 if not mBreakNode:
                     
                     cmds.button(self._ISaddBtn, edit = True, label = 'Please wait... checking mesh toplogy')
                     self._IScontextTool.checkForNonManifoldMeshes(polySelection[0])
                     cmds.delete(polySelection[0], ch = True)                    
                 
                 self.resetIShatterGUI()
                 self._IScontextTool._mVoroObject = polySelection[0]                
                 cmds.button(self._ISaddBtn, edit = True, label = polySelection[0])
                 cmds.button(self._ISdelBtn, edit = True, enable = True)
                 cmds.button(self._ISprocessBtn, edit = True, enable = True)
                 cmds.checkBox(self._ISborderEdgesCbx, edit = True, enable = True)
                 cmds.checkBox(self._IShideObjectsCbx, edit = True, enable = True)                                                                                                  
                 
         else:
             cmds.confirmDialog(title = 'Oups... IShatter Error', message = 'You must select one mesh object first !', button = 'OK', defaultButton = 'Yes', cancelButton = 'No', dismissString = 'No')            
开发者ID:jeffhong21,项目名称:scripts,代码行数:31,代码来源:IShatterGUI.py

示例9: frameSection

def frameSection(nudge=24):

    curvesShown = cmds.animCurveEditor("graphEditor1GraphEd", query=True, curvesShown=True)
    if not curvesShown:
        return

    firstSelKey = cmds.keyframe(selected=True, query=True, timeChange=True)
    # lastKey     = max(cmds.keyframe(selected=False, query=True, timeChange=True))
    lastKey = cmds.playbackOptions(query=True, maxTime=True)

    if firstSelKey:  # if key is selected
        firstSelKey = min(firstSelKey)
    else:
        # firstSelKey = min(cmds.keyframe(selected=False, query=True, timeChange=True))
        firstSelKey = cmds.playbackOptions(query=True, minTime=True)

        try:
            if G.AM_lastFrameSection + nudge < lastKey and G.AM_lastCurvesShown == curvesShown:
                firstSelKey = G.AM_lastFrameSection + nudge
        except:
            pass

    G.AM_lastFrameSection = firstSelKey
    G.AM_lastCurvesShown = curvesShown

    framePlaybackRange.framePlaybackRangeFn(rangeStart=(firstSelKey - 1), rangeEnd=(firstSelKey + nudge + 2))
    cmds.currentTime(firstSelKey, edit=True)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:27,代码来源:animMod.py

示例10: createKeyFrames

def createKeyFrames(numFrames, boundary):
	'''create the keyframes for the animation'''
	for frame in range(numFrames):
		cmds.currentTime( frame, edit=True )
		for b in boids:

			# How to stop a running maya script:
			# When a script is running in maya, Everything
			# freezes and maya does not repond to input.
			# To get around this maya has to be stopped from
			# the outside. This if-statement looks for a empty file
			# named "stop.maya" anywhere you want in your filesystem.
			# If it is found, maya exits the script. To stop a script,
			# just add this file to your defined path and it exits. When
			# you want to start the script again, just rename it to something
			# else, eg: run.maya.
			if os.path.isfile('C:\\dev\\stop.maya'):
				sys.exit()

			neighborhood = getNeighborhood(b)
			alignment(b, neighborhood)
			separation(b, neighborhood)
			cohesion(b, neighborhood)
			boundary.avoidWalls(b)
			followPath(b)
			obstacleAvoidance(b)
			wander(b)
			b.move(dt)
			b.setKeyFrame(frame)
开发者ID:micnil,项目名称:maya-flocking-boids,代码行数:29,代码来源:flock.py

示例11: walkParticlesProjection

def walkParticlesProjection(camera, particles, step=1, start=None, end=None, pBar=None):
    if start is None:
        start = cmds.playbackOptions(q=True, minTime=True)
    if end is None:
        end   = cmds.playbackOptions(q=True, maxTime=True)
    start = int(start)
    end   = int(end)
        
    #pStep = 0 if pBar is None else int(100 / (end - start + 1))
    pStep = 1

    coords = None
    
    for frame in xrange(start, end + 1):
        #log("... FRAME %d ..." % frame)
        cmds.currentTime(frame)
        
        points = getParticlesProjection(camera, particles, step)
        pid    = 0

        if coords is None:
            coords = [None] * len(points)
        
        for point in points:
            if coords[pid] is None:
                coords[pid] = [None] * (end - start + 1)
                
            coords[pid][frame - start] = point
            pid += 1
            
        if pBar:
            cmds.progressBar(pBar, e=1, s=pStep)
    
    return coords
开发者ID:T00N3,项目名称:T00N3Kit,代码行数:34,代码来源:exportAgiScene.py

示例12: setUp

 def setUp(self):
     cmds.file(new=1, f=1)
     self.cube = cmds.polyCube()[0]
     for i in xrange(1,21,2):
         cmds.currentTime(i)
         pm.setAttr(self.cube + '.tx', i)
         pm.setKeyframe(self.cube + '.tx')
开发者ID:williambong,项目名称:pymel,代码行数:7,代码来源:test_animation.py

示例13: __exit__

    def __exit__(self, *exc_info):

        cmds.autoKeyframe(state=self.autoKeyState)
        cmds.currentTime(self.time)

        if self.selection:
            cmds.select(self.selection)
开发者ID:willhoag,项目名称:AnimTools,代码行数:7,代码来源:decorators.py

示例14: createTrackwayVisualization

def createTrackwayVisualization(trackway):

    references = []

    for foot in trackway:
        references.extend(createMarchingSphere(foot))

    references.append(createHipsIndicator(trackway))
    references.append(createShoulderIndicator(trackway))

    group = cmds.group(*references, world=True, name=name)
    cmds.select(group)

    applyShaders(trackway)
    createRenderEnvironment()

    minTime = min(0, int(cmds.playbackOptions(query=True, minTime=True)))
    maxTime = trackway.duration

    cmds.playbackOptions(
        minTime=minTime, animationStartTime=minTime,
        maxTime= maxTime, animationEndTime=maxTime)

    cmds.currentTime(0, update=True)
    cmds.select(group)
开发者ID:sernst,项目名称:Cadence,代码行数:25,代码来源:Show_GaitVisualizer.py

示例15: testAnimMeshReload

    def testAnimMeshReload(self):

        MayaCmds.polyCube( name = 'mesh')
        MayaCmds.setKeyframe('meshShape.vtx[0:7]', time=[1, 24])
        MayaCmds.setKeyframe('meshShape.vtx[0:7]')
        MayaCmds.currentTime(12, update=True)
        MayaCmds.select('meshShape.vtx[0:7]')
        MayaCmds.scale(5, 5, 5, r=True)
        MayaCmds.setKeyframe('meshShape.vtx[0:7]', time=[12])
        self.__files.append(util.expandFileName('testAnimMeshReadWrite.abc'))
        MayaCmds.AbcExport(j='-fr 1 24 -root mesh -f ' + self.__files[-1])

        # reading test
        MayaCmds.AbcImport(self.__files[-1], mode='open')

        # save as a maya file
        self.__files.append(util.expandFileName('test.mb'))
        MayaCmds.file(rename=self.__files[-1])
        MayaCmds.file(save=True)

        # reload as a maya file
        MayaCmds.file(self.__files[-1], open=True)
        MayaCmds.AbcImport(self.__files[-2], mode='import')

        retVal = True
        mesh1 = '|mesh|meshShape'
        mesh2 = '|mesh1|meshShape'
        for t in range(1, 25):
            MayaCmds.currentTime(t, update=True)
            if not util.compareMesh( mesh1, mesh2 ):
                self.fail('%s and %s were not equal at frame %d' % (mesh1,
                    mesh2, t))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:mayaReload_test.py


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