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


Python cmds.timeControl方法代码示例

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


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

示例1: parse_active_scene

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def parse_active_scene():
    """Parse active scene for arguments for capture()

    *Resolution taken from render settings.

    """

    time_control = mel.eval("$gPlayBackSlider = $gPlayBackSlider")

    return {
        "start_frame": cmds.playbackOptions(minTime=True, query=True),
        "end_frame": cmds.playbackOptions(maxTime=True, query=True),
        "width": cmds.getAttr("defaultResolution.width"),
        "height": cmds.getAttr("defaultResolution.height"),
        "compression": cmds.optionVar(query="playblastCompression"),
        "filename": (cmds.optionVar(query="playblastFile")
                     if cmds.optionVar(query="playblastSaveToFile") else None),
        "format": cmds.optionVar(query="playblastFormat"),
        "off_screen": (True if cmds.optionVar(query="playblastOffscreen")
                       else False),
        "show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
                       else False),
        "quality": cmds.optionVar(query="playblastQuality"),
        "sound": cmds.timeControl(time_control, q=True, sound=True) or None
    } 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:27,代码来源:capture.py

示例2: addCallbacks

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def addCallbacks(self):
        """
        Add callbacks that will clear all marker information on the timeline 
        every time a new file is created or a file is opened. It also adds 
        callback to determine if the markers are sliding.
        """
        # after new scene
        self.newID = OpenMaya.MSceneMessage.addCallback(
            OpenMaya.MSceneMessage.kAfterNew, 
            self.readFromCurrentScene
        )
        
        # after open scene
        self.openID = OpenMaya.MSceneMessage.addCallback(
            OpenMaya.MSceneMessage.kAfterOpen, 
            self.readFromCurrentScene
        )

        # timeline press callbacks
        cmds.timeControl(
            utils.getMayaTimeline(), 
            edit=True, 
            pressCommand=self.pressCommand,
            releaseCommand=self.releaseCommand,
        ) 
开发者ID:robertjoosten,项目名称:maya-timeline-marker,代码行数:27,代码来源:ui.py

示例3: removeCallbacks

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def removeCallbacks(self):
        """
        Remove Callbacks.
        """
        # remove api callbacks
        for id_ in [self.newID, self.openID]:
            if not id_:
                continue
                
            OpenMaya.MMessage.removeCallback(id_)

        # remove timeline callbacks
        cmds.timeControl(
            utils.getMayaTimeline(), 
            edit=True, 
            pressCommand="", 
            releaseCommand=""
        )
        
    # ------------------------------------------------------------------------ 
开发者ID:robertjoosten,项目名称:maya-timeline-marker,代码行数:22,代码来源:ui.py

示例4: frameRange

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def frameRange(start=None, end=None):
    '''
    Returns the frame range based on the highlighted timeslider,
    or otherwise the playback range.
    '''

    if not start and not end:
        gPlayBackSlider = mm.eval('$temp=$gPlayBackSlider')
        if mc.timeControl(gPlayBackSlider, query=True, rangeVisible=True):
            frameRange = mc.timeControl(gPlayBackSlider, query=True, rangeArray=True)
            start = frameRange[0]
            end = frameRange[1]-1
        else:
            start = mc.playbackOptions(query=True, min=True)
            end = mc.playbackOptions(query=True, max=True)

    return start,end 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:19,代码来源:ml_utilities.py

示例5: pressCommand

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def pressCommand(self, *args):
        """
        Press callback on the timeline, this callback registers the current
        selected frames, if the user settings determine that the frame range
        is not important ( no automated shifting of markers ), no range will 
        be stored.
        """
        # variable
        timeline = utils.getMayaTimeline()

        # restore sound scrub
        cmds.timeControl(timeline, edit=True, beginScrub=True)

        # get visible range
        rangeVisible = cmds.timeControl(
            timeline,
            q=True, 
            rangeVisible=True
        )
        
        # check if range needs to be stored
        if not rangeVisible or not self.menu.moveA.isChecked():
            return

        # save range
        self._range = utils.getTimelineRange() 
开发者ID:robertjoosten,项目名称:maya-timeline-marker,代码行数:28,代码来源:ui.py

示例6: getTimelineRange

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def getTimelineRange():
    """
    Read the current timeline selection and convert it into a range list.

    :return: Frame range of timeline selection
    :rtype: list
    """
    r = cmds.timeControl(getMayaTimeline(), query=True, ra=True )
    return range(int(r[0]), int(r[1]))

    
# ---------------------------------------------------------------------------- 
开发者ID:robertjoosten,项目名称:maya-timeline-marker,代码行数:14,代码来源:utils.py

示例7: qeury_active_sound_node

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def qeury_active_sound_node():
    aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
    sound = cmds.timeControl(aPlayBackSliderPython, q=1, s=1)
    if sound:
        return sound
    else:
        return None 
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:9,代码来源:maya_warpper.py

示例8: playback_selection_range

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def playback_selection_range():
    aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
    time_selection = cmds.timeControl( aPlayBackSliderPython, q=True,rng=True )[1:-1]
    start = round(float(time_selection.split(":")[0]))
    end = round(float(time_selection.split(":")[1]))
    
    if start+1 == end:
        return None
    else:
        return [start, end] 
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:12,代码来源:maya_warpper.py

示例9: _getStartAndEnd

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def _getStartAndEnd():
    '''
    Only return start and end if frame range is highlighted. Otherwise use all available animation.
    '''

    gPlayBackSlider = mm.eval('$temp=$gPlayBackSlider')
    if mc.timeControl(gPlayBackSlider, query=True, rangeVisible=True):
        start, end = mc.timeControl(gPlayBackSlider, query=True, rangeArray=True)
        return start, end-1
    return None, None 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:12,代码来源:ml_copyAnim.py

示例10: selectedFrameRange

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def selectedFrameRange(self):
        '''
        Sets the keySelection time to the selected frame range, returns false if frame range not selected.
        '''

        gPlayBackSlider = mm.eval('$temp=$gPlayBackSlider')
        if mc.timeControl(gPlayBackSlider, query=True, rangeVisible=True):
            self._timeRangeStart, self._timeRangeEnd = mc.timeControl(gPlayBackSlider, query=True, rangeArray=True)
            return True
        return False 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:12,代码来源:ml_utilities.py

示例11: get_time_slider_range

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import timeControl [as 别名]
def get_time_slider_range(highlighted=True,
                          withinHighlighted=True,
                          highlightedOnly=False):
    """Return the time range from Maya's time slider.

    Arguments:
        highlighted (bool): When True if will return a selected frame range
            (if there's any selection of more than one frame!) otherwise it
            will return min and max playback time.
        withinHighlighted (bool): By default Maya returns the highlighted range
            end as a plus one value. When this is True this will be fixed by
            removing one from the last number.

    Returns:
        list: List of two floats of start and end frame numbers.

    """
    if highlighted is True:
        gPlaybackSlider = mel.eval("global string $gPlayBackSlider; "
                                   "$gPlayBackSlider = $gPlayBackSlider;")
        if cmds.timeControl(gPlaybackSlider, query=True, rangeVisible=True):
            highlightedRange = cmds.timeControl(gPlaybackSlider,
                                                query=True,
                                                rangeArray=True)
            if withinHighlighted:
                highlightedRange[-1] -= 1
            return highlightedRange
    if not highlightedOnly:
        return [cmds.playbackOptions(query=True, minTime=True),
                cmds.playbackOptions(query=True, maxTime=True)] 
开发者ID:Colorbleed,项目名称:maya-capture-gui,代码行数:32,代码来源:lib.py


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