當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。