當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.currentTime方法代碼示例

本文整理匯總了Python中maya.cmds.currentTime方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.currentTime方法的具體用法?Python cmds.currentTime怎麽用?Python cmds.currentTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.currentTime方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: spine_IKToFK

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def spine_IKToFK(fkControls, ikControls, matchMatrix_dict=None):
    """position the IK controls to match, as best they can, the fk controls.
    Supports component: spine_S_shape_01, spine_ik_02

    Args:
        fkControls (list): list of fk controls, IN THE ORDER OF HIERARCHY,
        ["spine_C0_fk0_ctl", ..., ..., "spine_C0_fk6_ctl"]
        ikControls (list): all ik controls
    """
    if matchMatrix_dict is None:
        currentTime = pm.currentTime(q=True)
        matchMatrix_dict = recordNodesMatrices(fkControls,
                                               desiredTime=currentTime)

    attribute.reset_SRT(ikControls)

    for fk in fkControls:
        fk = pm.PyNode(fk)
        fk.setMatrix(matchMatrix_dict[fk.name()], worldSpace=True) 
開發者ID:mgear-dev,項目名稱:mgear_core,代碼行數:21,代碼來源:anim_utils.py

示例2: attrSampling

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def attrSampling(node, attr, minVal, maxVal, interval=1):
    """
    Args:
      node (str)
      attrs (list)
      minVal (float)
      maxVal (float)
      interval (int)
    
    Returns:
      int
    """    
    currTime = cmds.currentTime(q=1)
    currVal = cmds.getAttr('%s.%s' % (node, attr))
    vals = [currVal, currVal+minVal, currVal+maxVal, currVal]

    for i, v in enumerate(vals):
        if i not in [0, len(vals)-1] and (currVal - v) == 0:
            continue
        
        cmds.setKeyframe(node, at=attr, v=v, t=currTime)
        currTime += interval
    return currTime

#---------------------------------------------------------------------- 
開發者ID:WebberHuang,項目名稱:DeformationLearningSolver,代碼行數:27,代碼來源:samplingFunc.py

示例3: attrsSampling

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def attrsSampling(attrData, interval=1):
    """
    Args:
      attrData (dict): {node1: [[attr1, min, max], [attr2, min, max], ...],
                        node2: [[attr1, min, max], [attr2, min, max], ...],
                        ...}
      interval (int)
    
    Returns:
      int
    """
    currTime = cmds.currentTime(q=1)
    for node, attrVals in attrData.iteritems():        
        for vals in attrVals:
            attr, minVal, maxVal = vals
            if not cmds.objExists('.'.join([node, attr])):
                continue
            currTime = attrSampling(node, attr, minVal, maxVal, interval)
            currTime -= 2 * interval
            cmds.currentTime(currTime)
    return currTime+1 * interval

#---------------------------------------------------------------------- 
開發者ID:WebberHuang,項目名稱:DeformationLearningSolver,代碼行數:25,代碼來源:samplingFunc.py

示例4: customAttrsSampling

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def customAttrsSampling(attrData, interval=1):
    """
    Args:
      attrData (dict): {node1: [[attr1, min, max], [attr2, min, max], ...],
                        node2: [[attr1, min, max], [attr2, min, max], ...],
                        ...}
      interval (int)
    
    Returns:
      int
    """
    start = cmds.currentTime(q=1)
    currTime = attrsSampling(attrData, interval)
    end = currTime-1
    utils.trimTimeRange(start, end)
    cmds.currentTime(start) 

#---------------------------------------------------------------------- 
開發者ID:WebberHuang,項目名稱:DeformationLearningSolver,代碼行數:20,代碼來源:samplingFunc.py

示例5: blendShapeSampling

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def blendShapeSampling(node, interval=1):
    """
    Args:
      node (str)
      interval (int)
    
    Returns:
      int
    """
    assert cmds.nodeType(node) == 'blendShape', \
        "node must be a blendShape type"
    start = cmds.currentTime(q=1)
    
    attrs = cmds.listAttr('%s.weight' % node, m=1)
    attrData = {node: [[attr, 0.0, 1.0] for attr in attrs]}
    
    currTime = attrsSampling(attrData, interval)

    end = currTime-1
    utils.trimTimeRange(start, end)
    cmds.currentTime(start)

#---------------------------------------------------------------------- 
開發者ID:WebberHuang,項目名稱:DeformationLearningSolver,代碼行數:25,代碼來源:samplingFunc.py

示例6: setCurrentFrame

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def setCurrentFrame(self, frame):
		""" sets the current frame
			\param		frame <float>
			\return		<bool> success
		"""
		return cmds.currentTime(frame) == frame
	
#	def loadFile(self, filename='', confirm=True):
#		""" Loads the specified filename in the application.
#		
#		Loads the inputed filename into the application, returning true on success
#		args:
#			filename: The filename as a string
#		Returns:
#			a boolean value indicating success
#		"""
#		# Using the prompt argument will affect all future calls to cmds.file, so backup the current
#		# value and restore it later.
#		prompt = cmds.file(query=True, prompt=True)
#		loaded = cmds.file(filename, open=True, prompt=confirm)
#		# restore the previous prompt behavior
#		cmds.file(prompt=prompt)
#		return filename == loaded 
開發者ID:blurstudio,項目名稱:cross3d,代碼行數:25,代碼來源:mayascene.py

示例7: setAnimValue

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def setAnimValue(plug, value, tangentType=None):
    '''
    Sets key if the channel is keyed, otherwise setAttr
    '''

    if mc.keyframe(plug, query=True, name=True):
        mc.setKeyframe(plug, value=value)
        if tangentType:
            time = mc.currentTime(query=True)
            itt = tangentType
            ott = tangentType
            if tangentType == 'step':
                itt = 'linear'
            mc.keyTangent(plug, time=(time,), edit=True, itt=itt, ott=ott)

    mc.setAttr(plug, value) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:18,代碼來源:ml_utilities.py

示例8: scaleTime

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def scaleTime(percent=100, selectionOption=1, pivotOption=0):

    value = percent/100.0
    keySel = _getKeySelection(selectionOption)

    timePivot = 0
    if pivotOption == 0:
        timePivot = mc.currentTime(query=True)
    else:
        times = keySel.getSortedKeyTimes()
        if pivotOption == 1:
            timePivot = times[0]
        elif pivotOption == 2:
            timePivot = times[-1]
        elif pivotOption == 3:
            timePivot = (times[0]+times[-1])/2

    keySel.scaleKey(timeScale=value, timePivot=timePivot) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:20,代碼來源:ml_animCurveEditor.py

示例9: bakeSprings

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def bakeSprings(model=None):
    """Bake the automatic spring animation to animation curves

    Args:
        model (dagNode): The rig top node
    """

    # filters the root node from selection
    if not model:
        model = getRootNode()

    print("Using root: {}".format(model))

    # first clear animation
    clearSprings(model)

    # bake again
    springNodes = getControlers(model, gSuffix=PLOT_GRP_SUFFIX)
    if springNodes:

        start = pm.playbackOptions(q=True, min=True)
        end = pm.playbackOptions(q=True, max=True)
        ct = start
        for i in range(int(end - start) + 1):
            pm.currentTime(int(ct))
            pm.setKeyframe(springNodes, insertBlend=True, attribute='rotate')
            ct += 1 
開發者ID:mgear-dev,項目名稱:mgear_core,代碼行數:29,代碼來源:anim_utils.py

示例10: doItByUI

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def doItByUI(self):
        """Gather UI settings to execute transfer
        """
        startFrame = self.startFrame_value.value()
        endFrame = self.endFrame_value.value()
        onlyKeyframes = self.onlyKeyframes_check.isChecked()

        # based on user input, decide where to flatten animation
        bakeToIk = self.comboBoxSpaces.currentIndex()

        self.bakeAnimation(self.fkControls,
                           self.ikControls,
                           startFrame,
                           endFrame,
                           bakeToIk=bakeToIk,
                           onlyKeyframes=onlyKeyframes)

        # Refresh the viewport by toggling time, refresh/dgdirty do not work
        pm.currentTime(startFrame)
        pm.currentTime(endFrame)
        # set the new space value in the synoptic combobox
        if self.comboObj is not None:
            self.comboObj.setCurrentIndex(self.comboBoxSpaces.currentIndex())

        for c in pyqt.maya_main_window().children():
            if isinstance(c, AbstractAnimationTransfer):
                c.deleteLater() 
開發者ID:mgear-dev,項目名稱:mgear_core,代碼行數:29,代碼來源:anim_utils.py

示例11: rewind

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def rewind():
    cmds.currentTime(1)    
    cmds.playbackOptions(minTime=1) 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:5,代碼來源:maya_warpper.py

示例12: snapshot

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def snapshot(path = None, width = 96, height = 96):
    current_image_format = cmds.getAttr("defaultRenderGlobals.imageFormat")
    cmds.setAttr("defaultRenderGlobals.imageFormat", 32) # *.png
    #path = "/Users/liorbenhorin/Library/Preferences/Autodesk/maya/2015-x64/scripts/pipeline/thumb.png"
    cmds.playblast(cf = path, fmt="image", frame = cmds.currentTime( query=True ), orn=False, wh = [width,height], p=100, v=False)
    cmds.setAttr("defaultRenderGlobals.imageFormat", current_image_format)
    
    if os.path.isfile(path):
        return path
    else:
        return False 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:13,代碼來源:maya_warpper.py

示例13: _maintained_time

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def _maintained_time():
    """Context manager for preserving (resetting) the time after the context"""

    current_time = cmds.currentTime(query=1)
    try:
        yield
    finally:
        cmds.currentTime(current_time) 
開發者ID:bumpybox,項目名稱:pyblish-bumpybox,代碼行數:10,代碼來源:capture.py

示例14: currentFrame

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def currentFrame(self):
		""" returns the current frame
			\return		<float> frame
		"""
		return cmds.currentTime(query=True) 
開發者ID:blurstudio,項目名稱:cross3d,代碼行數:7,代碼來源:mayascene.py

示例15: createMush

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentTime [as 別名]
def createMush(self):
        mesh = self.sourceField.text()
        if not mesh:
            return
        if cmds.objExists(mesh + '_Mush'):
            print(mesh + '_Mush already exists!')
            return
        cmds.currentTime(cmds.playbackOptions(q=True, min=True))
        dup = cmds.duplicate(mesh, inputConnections=True, n=mesh + '_Mush')
        cmds.deltaMush(dup, smoothingIterations=20, smoothingStep=0.5, pinBorderVertices=True, envelope=1) 
開發者ID:duncanskertchly,項目名稱:dm2skin,代碼行數:12,代碼來源:dm2skin.py


注:本文中的maya.cmds.currentTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。