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


Python cmds.optionVar方法代码示例

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


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

示例1: parse_active_scene

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [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: _on_task_changed

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def _on_task_changed(*args):

    _update_menu_task_label()

    workdir = api.Session["AVALON_WORKDIR"]
    if os.path.exists(workdir):
        logger.info("Updating Maya workspace for task change to %s", workdir)

        _set_project()

        # Set Maya fileDialog's start-dir to /scenes
        frule_scene = cmds.workspace(fileRuleEntry="scene")
        cmds.optionVar(stringValue=("browserLocationmayaBinaryscene",
                                    workdir + "/" + frule_scene))

    else:
        logger.warning("Can't set project for new context because "
                       "path does not exist: %s", workdir) 
开发者ID:getavalon,项目名称:core,代码行数:20,代码来源:pipeline.py

示例3: checkLastOptionVar

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def checkLastOptionVar(self, optionVarName, preferableName, typeList):
        """ Verify if there's a optionVar with this name or create it with the preferable given value.
            Returns the lastValue found.
        """
        lastValueExists = cmds.optionVar(exists=optionVarName)
        if not lastValueExists:
            # if not exists a last optionVar, set it to preferableName if it exists, or to the first value in the list:
            if preferableName in typeList:
                cmds.optionVar( stringValue=(optionVarName, preferableName) )
            else:
                cmds.optionVar( stringValue=(optionVarName, typeList[0]) )
        # get its value puting in a variable to return it:
        resultValue = cmds.optionVar( query=optionVarName )
        # if the last value in the system was different of json files, set it to preferableName or to the first value in the list also:
        if not resultValue in typeList:
            if preferableName in typeList:
                resultValue = preferableName
            else:
                resultValue = resultValue[0]
        return resultValue 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:22,代码来源:dpAutoRig.py

示例4: run

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def run(*args, **kwargs):  # @UnusedVariable
    """ Menu run execution

    Args:
        *args: Variable length argument list.
        **kwargs: Arbitrary keyword arguments.
    """

    # get check-box state
    state = args[0]

    if state:
        cmds.optionVar(intValue=("mgear_dag_menu_OV", 1))
    else:
        cmds.optionVar(intValue=("mgear_dag_menu_OV", 0))

    # runs dag menu right click mgear's override
    mgear_dagmenu_toggle(state) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:20,代码来源:dagmenu.py

示例5: test_parse_active_scene

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def test_parse_active_scene():
    """parse_active_scene() works"""

    parsed = capture.parse_active_scene()
    reference = {
        "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")
    }

    for key, value in reference.items():

        assert parsed[key] == value 
开发者ID:abstractfactory,项目名称:maya-capture,代码行数:25,代码来源:tests.py

示例6: upToDateCheck

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def upToDateCheck(revision, prompt=True):
    '''
    This is a check that can be run by scripts that import ml_utilities to make sure they
    have the correct version.
    '''

    if not '__revision__' in locals():
        return

    if revision > __revision__:
        if prompt and mc.optionVar(query='ml_utilities_revision') < revision:
            result = mc.confirmDialog( title='Module Out of Date',
                                       message='Your version of ml_utilities may be out of date for this tool. Without the latest file you may encounter errors.',
                                       button=['Download Latest Revision','Ignore', "Don't Ask Again"],
                                       defaultButton='Download Latest Revision', cancelButton='Ignore', dismissString='Ignore' )

            if result == 'Download Latest Revision':
                mc.showHelp(GITHUB_ROOT_URL+'ml_utilities.py', absolute=True)
            elif result == "Don't Ask Again":
                mc.optionVar(intValue=('ml_utilities_revision', revision))
        return False
    return True 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:24,代码来源:ml_utilities.py

示例7: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def ui():
    '''
    User interface for arc tracer
    '''

    globalScale = 1
    if mc.optionVar(exists='ml_arcTracer_brushGlobalScale'):
        globalScale = mc.optionVar(query='ml_arcTracer_brushGlobalScale')

    with utl.MlUi('ml_arcTracer', 'Arc Tracer', width=400, height=180, info='''Select objects to trace.
Choose camera space or worldspace arc.
Press clear to delete the arcs, or retrace to redo the last arc.''') as win:

        win.buttonWithPopup(label='Trace Camera', command=traceCamera, annotation='Trace an arc as an overlay over the current camera.',
                            shelfLabel='cam', shelfIcon='flowPathObj')#motionTrail
        win.buttonWithPopup(label='Trace World', command=traceWorld, annotation='Trace an arc in world space.',
                            shelfLabel='world', shelfIcon='flowPathObj')
        win.buttonWithPopup(label='Retrace Previous', command=retraceArc, annotation='Retrace the previously traced arc.',
                            shelfLabel='retrace', shelfIcon='flowPathObj')
        win.buttonWithPopup(label='Clear Arcs', command=clearArcs, annotation='Clear all arcs.',
                            shelfLabel='clear', shelfIcon='flowPathObj')
        fsg = mc.floatSliderGrp( label='Line Width', minValue=0.1, maxValue=5, value=globalScale)
        mc.floatSliderGrp(fsg, edit=True, dragCommand=partial(setLineWidthCallback, fsg)) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:25,代码来源:ml_arcTracer.py

示例8: changeOptionDegree

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def changeOptionDegree(self, degreeOption, *args):
        """ Set optionVar to choosen menu item.
        """
        cmds.optionVar(stringValue=('dpAutoRigLastDegreeOption', degreeOption))
        self.degreeOption = int(degreeOption[0]) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:7,代码来源:dpAutoRig.py

示例9: createPreset

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def createPreset(self, *args):
        """ Just call ctrls create preset and set it as userDefined preset.
        """
        newPresetString = self.ctrls.dpCreatePreset()
        if newPresetString:
            # create json file:
            resultDic = self.createJsonFile(newPresetString, PRESETS, '_preset')
            # set this new preset as userDefined preset:
            self.presetName = resultDic['_preset']
            cmds.optionVar(remove="dpAutoRigLastPreset")
            cmds.optionVar(stringValue=("dpAutoRigLastPreset", self.presetName))
            # show preset creation result window:
            self.info('i129_createPreset', 'i133_presetCreated', '\n'+self.presetName+'\n\n'+self.langDic[self.langName]['i134_rememberPublish']+'\n\n'+self.langDic[self.langName]['i018_thanks'], 'center', 205, 270)
            # close and reload dpAR UI in order to avoide Maya crash
            self.jobReloadUI() 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:17,代码来源:dpAutoRig.py

示例10: setAutoCheckUpdatePref

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def setAutoCheckUpdatePref(self, currentValue, *args):
        """ Set the optionVar for auto check update preference as stored userDefAutoCheckUpdate read variable.
        """
        cmds.optionVar(intValue=('dpAutoRigAutoCheckUpdate', int(currentValue))) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:6,代码来源:dpAutoRig.py

示例11: autoCheckUpdate

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def autoCheckUpdate(self, *args):
        """ Store user choose about automatically check for update in an optionVar.
            If active, try to check for update once a day.
        """
        firstTimeOpenDPAR = False
        # verify if there is an optionVar of last autoCheckUpdate checkBox choose value by user in the maya system:
        autoCheckUpdateExists = cmds.optionVar(exists='dpAutoRigAutoCheckUpdate')
        if not autoCheckUpdateExists:
            cmds.optionVar(intValue=('dpAutoRigAutoCheckUpdate', 1))
            firstTimeOpenDPAR = True
        
        # get its value puting in a variable userDefAutoCheckUpdate:
        self.userDefAutoCheckUpdate = cmds.optionVar(query='dpAutoRigAutoCheckUpdate')
        if self.userDefAutoCheckUpdate == 1:
            # verify if there is an optionVar for store the date of the lastest autoCheckUpdate ran in order to avoid many hits in the GitHub server:
            todayDate = str(datetime.datetime.now().date())
            lastAutoCheckUpdateExists = cmds.optionVar(exists='dpAutoRigLastDateAutoCheckUpdate')
            if not lastAutoCheckUpdateExists:
                cmds.optionVar(stringValue=('dpAutoRigLastDateAutoCheckUpdate', todayDate))
            # get its value puting in a variable userDefAutoCheckUpdate:
            lastDateAutoCheckUpdate = cmds.optionVar(query='dpAutoRigLastDateAutoCheckUpdate')
            if not lastDateAutoCheckUpdate == todayDate:
                # then check for update:
                self.checkForUpdate(verbose=False)
                cmds.optionVar(stringValue=('dpAutoRigLastDateAutoCheckUpdate', todayDate))
        
        # force checkForUpdate if it's the first time openning the dpAutoRigSystem in this computer:
        if firstTimeOpenDPAR:
            self.checkForUpdate(verbose=True)
        
        
    
    
    ###################### End: UI
    
    
    ###################### Start: Rigging Modules Instances 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:39,代码来源:dpAutoRig.py

示例12: _shelf_error_fix

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def _shelf_error_fix(self):

        # FIXES error in shelf.mel. reassigns optionVars for this shelf 
        shelves = cmds.shelfTabLayout(
            self.layout, query=True, tabLabelIndex=True)
        for index, shelf in enumerate(shelves):
            if shelf == self.name:
                cmds.optionVar(
                    stringValue=("shelfName{i}".format(i=index+1), str(shelf))
                ) 
开发者ID:Clemson-DPA,项目名称:dpa-pipe,代码行数:12,代码来源:shelf.py

示例13: get_option_var_state

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def get_option_var_state():
    """ Gets dag menu option variable

    Maya's optionVar command installs a variable that is kept on Maya's
    settings so that you can use it on future sessions.

    Maya's optionVar are a quick and simple way to store a custom variable on
    Maya's settings but beware that they are kept even after mGear's uninstall
    so you will need to run the following commands.

    Returns:
        bool: Whether or not mGear's dag menu override is used

    Example:
        The following removes mgears dag menu optionVar

        .. code-block:: python

           from maya import cmds

           if not cmds.optionVar(exists="mgear_dag_menu_OV"):
               cmds.optionVar(remove="mgear_dag_menu_OV")
    """

    # if there is no optionVar the create one that will live during maya
    # current and following sessions
    if not cmds.optionVar(exists="mgear_dag_menu_OV"):
        cmds.optionVar(intValue=("mgear_dag_menu_OV", 0))

    return cmds.optionVar(query="mgear_dag_menu_OV") 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:32,代码来源:dagmenu.py

示例14: insert_recent_file

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def insert_recent_file(path):
    cmds.optionVar(stringValueAppend=('RecentFilesList', path)) 
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:4,代码来源:maya_warpper.py

示例15: _disabled_inview_messages

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import optionVar [as 别名]
def _disabled_inview_messages():
    """Disable in-view help messages during the context"""
    original = cmds.optionVar(q="inViewMessageEnable")
    cmds.optionVar(iv=("inViewMessageEnable", 0))
    try:
        yield
    finally:
        cmds.optionVar(iv=("inViewMessageEnable", original)) 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:10,代码来源:capture.py


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