当前位置: 首页>>代码示例>>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;未经允许,请勿转载。