• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.optionVar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deleteCustomOptions

def deleteCustomOptions():
    variablePrefix = "ngSkinTools"
    for varName in cmds.optionVar(list=True):
        if varName.startswith(variablePrefix):
            cmds.optionVar(remove=varName)  
        
    cmds.windowPref('MirrorWeightsWindow',ra=True)  
开发者ID:leandropim,项目名称:Tapp,代码行数:7,代码来源:options.py


示例2: getFileName

def getFileName():
    base = studioBase.StudioSQL()

    loadType = {'Load saved reference load state':'', 
                'Load all references':'all', 
                'Load top-level references only':'topOnly', 
                'Load no references':'none'}

    fileData = mop.OpenDialog.openFile()
    if fileData[0] and fileData[1] and fileData[2]:
        fileName = fileData[1] + '/' + fileData[2]
    else:
        return False

    ref = loadType[fileData[3]]
    selective = fileData[4]
    print('filename', fileName, ref, 'selective', selective, fileData)

    base.setAction('open', fileName)
    if selective:
        cmds.file(fileName, open=True, buildLoadSettings=True )
        num = cmds.selLoadSettings( q=True, numSettings=True)
        cmds.optionVar(sv=('preloadRefEdTopLevelFile', fileName))
        mel.eval('PreloadReferenceEditor')

    else:
        if ref:
            cmds.file(fileName, o=True, f=True, lrd=ref)
        else:
            cmds.file(fileName, o=True, f=True)

    setRecentFile(fileName)

    return True
开发者ID:kuzubov,项目名称:maya_python_scripts,代码行数:34,代码来源:mayaMainBtns.py


示例3: loadPrefs

 def loadPrefs(self):
     """Load all preferences and create default ones if they do not exists"""
     for label in self.preferences:
         if cmds.optionVar(exists='pns_' + label):
             self.preferences[label] = cmds.optionVar(query='pns_' + label)
         else:
             cmds.optionVar(intValue=('pns_' + label, self.preferences[label]))
开发者ID:Regnareb,项目名称:Maya,代码行数:7,代码来源:gator.py


示例4: load

def load(file_path, obj_name, parent_name):
    """Import a file exported from ZBrush.

    This is the command sent over the Maya command port from ZBrush.

    Parameters
    ----------
    file_path : str
        Path to the file that we are importing
    obj_name : str
        Name of the object being imported
    parent_name : str
        Name of the parent for the object being imported
    """
    file_name = utils.split_file_name(file_path)
    _cleanup(file_name)
    cmds.file(file_path, i=True,
              usingNamespaces=False,
              removeDuplicateNetworks=True)

    # Set smoothing options if necessary
    if cmds.optionVar(ex='gozbruh_smooth') and not cmds.optionVar(q='gozbruh_smooth'):
        cmds.displaySmoothness(obj_name, du=0, dv=0, pw=4, ps=1, po=1)

    if not cmds.attributeQuery("gozbruhParent", n=obj_name, ex=True):
        cmds.addAttr(obj_name, longName='gozbruhParent', dataType='string')
    cmds.setAttr(obj_name + '.gozbruhParent', parent_name, type='string')
开发者ID:LumaPictures,项目名称:gozbruh,代码行数:27,代码来源:maya_tools.py


示例5: select_file

    def select_file(self):
        """ Maya Open Dialog to select file texture """
        self.open_dialog_visible = True

        if MTTSettings.value('browserFirstStart'):
            image_dir = cmds.optionVar(query='MTT_browserStartFolder')
        else:
            image_dir = cmds.workspace(query=True,
                                       rootDirectory=True) + cmds.workspace(
                fileRuleEntry='sourceImages')
            MTTSettings.set_value('browserFirstStart', True)

        file_path = cmds.fileDialog2(fileMode=1, startingDirectory=image_dir,
                                     caption='Select a texture',
                                     okCaption='Select')

        if file_path:
            new_path = file_path[0]
            cmds.optionVar(
                sv=['MTT_browserStartFolder', os.path.dirname(new_path)])
            if MTTSettings.value('forceRelativePath'):
                new_path = convert_to_relative_path(new_path)
                # relative_path = workspace(projectPath=new_path)
                # if relative_path != new_path:
                #     new_path = '/%s' % relative_path
            self.line_edit.setText(new_path)
        self.open_dialog_visible = False
        self.close()
        self.editingFinished.emit()
        cmds.showWindow(WINDOW_NAME)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:30,代码来源:mttDelegate.py


示例6: hw

def hw(*args, **kwargs):
    t0 = float(time.time())
    try:
        verbose = kwargs["verbose"]
    except KeyError:
        verbose = False
        if cmds.optionVar(exists="checkmateVerbosity"):
            verbose = cmds.optionVar(query="checkmateVerbosity")
    else:
        pass

    scenefilename = cmds.file(query=True, sn=True, shn=True)
    root, ext = os.path.splitext(scenefilename)
    fullscenepath = cmds.file(query=True, sn=True, shn=False)
    fullscenedirname = os.path.dirname(fullscenepath)
    reportname = "".join([root, ext.replace(".", "_")])
    img_dir = os.path.join(fullscenedirname, reportname)

    print "save HW rendered images to : %s" % img_dir

    # before we render, save render globals presets
    cmds.nodePreset(save=("defaultRenderQuality", "ttRestorePreviousDefaultRenderViewPreset"))
    cmds.nodePreset(save=("defaultRenderGlobals", "ttRestorePreviousDefaultRenderViewPreset"))
    cmds.nodePreset(save=("defaultResolution", "ttRestorePreviousDefaultRenderViewPreset"))

    # override the user settings
    cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
    ext = ".png"
    # set resolution ot 320x240
    cmds.setAttr("defaultResolution.width", 640)
    cmds.setAttr("defaultResolution.height", 480)
    cmds.setAttr("defaultResolution.deviceAspectRatio", (float(320) / float(240)))

    # set file format to png
    cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
    ext = ".png"
    cmds.setAttr("defaultRenderGlobals.outFormatControl", 0)  # default name.ext
    cmds.setAttr("defaultRenderGlobals.animation", False)

    # cmds.setAttr('defaultRenderGlobals.imageFilePrefix', "../<Camera>", type="string")
    cmds.setAttr("defaultRenderGlobals.imageFilePrefix", "<Camera>", type="string")

    cmds.workspace(fileRule=["images", img_dir])
    print "save rendered images to : %s" % img_dir
    cmds.hwRender(currentFrame=True, cam="top", edgeAntiAliasing=[2, 4], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="persp", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="front", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="side", edgeAntiAliasing=[2, 16], fullRenderSupport=True)

    # move rendererd images from the default project images dir to the report dir
    sourcedir = os.path.join(cmds.workspace(q=True, rd=True), cmds.workspace(fileRuleEntry="images"))
    targetdir = img_dir
    print "from : ", sourcedir
    print "to   : ", targetdir

    # for img in ['side.png', 'front.png', 'persp.png', 'top.png'] :
    #    os.rename(os.path.join(sourcedir, img),  os.path.join(targetdir, img))

    print "%-24s : %.6f seconds" % ("render.hw()", (float(time.time()) - t0))
    return img_dir
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:60,代码来源:render.py


示例7: toggleModeState

def toggleModeState(OptionSelection,OptionList,OptionVarName,ListOfContainers,forceInt = False):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Toggle for turning off and on the visbility of a list of containers

    ARGUMENTS:
    optionSelection(string) - this should point to the variable holding a (bool) value
    optionList(list) - the option selection must be in the optionList

    RETURNS:
    locatorName(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    visOn = OptionList.index(OptionSelection)
    if forceInt:
        mc.optionVar(iv=(OptionVarName,int(visOn)))
    else:
        mc.optionVar(sv=(OptionVarName,OptionSelection))

    cnt = 0
    for Container in ListOfContainers:
        if cnt == visOn:
            #Container(e=True,vis=True)
            setUIObjectVisibility(Container,True)
        else:
            #Container(e=True,vis=False)
            setUIObjectVisibility(Container,False)
        cnt+=1
开发者ID:Italic-,项目名称:maya-prefs,代码行数:29,代码来源:guiFactory.py


示例8: override_panels

def override_panels(custom_hs_cmd=None, custom_ne_cmd=None):
    # check if icons is in maya resources, if not, copy into userBitmapsDir
    user_icons_path = cmds.internalVar(userBitmapsDir=True)
    mtt_icons_path = os.path.join(os.path.dirname(__file__), 'icons')
    maya_icons = os.listdir(user_icons_path)

    for ico in MTT_ICONS_NAME:
        if ico not in maya_icons:
            source_file = os.path.join(mtt_icons_path, ico)
            destination_file = os.path.join(user_icons_path, ico)
            shutil.copy2(source_file, destination_file)

    # create MEL global proc
    cmd = mel.createMelWrapper(
        override_add_hypershade_panel, types=['string'], returnCmd=True)
    mel.eval(cmd)
    cmd = mel.createMelWrapper(
        override_add_node_editor_panel, types=['string'], returnCmd=True)
    mel.eval(cmd)

    # edit callback of scripted panel
    cmds.scriptedPanelType(
        'hyperShadePanel', edit=True,
        addCallback='override_add_hypershade_panel')

    cmds.scriptedPanelType(
        'nodeEditorPanel', edit=True,
        addCallback='override_add_node_editor_panel')

    # store custom cmd
    if custom_hs_cmd:
        cmds.optionVar(sv=[VAR_HS_CMD, custom_hs_cmd])
    if custom_ne_cmd:
        cmds.optionVar(sv=[VAR_NE_CMD, custom_hs_cmd])
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:34,代码来源:mttOverridePanels.py


示例9: ui

def ui():
    '''Launch the UI
    '''
    mc.optionVar( sv=('colorManagementColorPickerColorSpaceSelection','Display Space') )
    win = ColorControlUI()
    win.buildMainLayout()
    win.finish()
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:ml_colorControl.py


示例10: create_shelf

def create_shelf():
    """
    Create the OBB shelf

    Raises:
        None

    Returns:
        None
    """

    tab_layout = mel.eval('$pytmp=$gShelfTopLevel')
    shelf_exists = cmds.shelfLayout('OBB', exists=True)

    if shelf_exists:
        cmds.deleteUI('OBB', layout=True)

    shelf = cmds.shelfLayout('OBB', parent=tab_layout)

    for button, kwargs in buttons.items():

        img = QtGui.QImage(kwargs['image'])
        kwargs['width'] = img.width()
        kwargs['height'] = img.height()

        cmds.shelfButton(label=button, parent=shelf, **kwargs)

    # Fix object 0 error.
    shelves = cmds.shelfTabLayout(tab_layout, query=True, tabLabelIndex=True)

    for index, shelf in enumerate(shelves):
        cmds.optionVar(stringValue=("shelfName%d" % (index+1), str(shelf)))
开发者ID:matthewkapfhammer,项目名称:OBB,代码行数:32,代码来源:__init__.py


示例11: doToggleModeState

def doToggleModeState(OptionSelection,OptionList,OptionVarName,ListOfContainers,forceInt = False):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    This connects to a cgm rework of tabs in maya gui's. Mainly to be used with a form layout is needed
    with tabs. Tabs and form layouts don't work well together. This is a work around

    ARGUMENTS:
    optionSelection(string) - this should point to the variable holding a (int) value
    optionList(list) - the option selection must be in the optionList
    OptionVarName(string)
    ListOfContainers(list) -- list of containers
    forceInt -- forces the optionVar to set

    RETURNS:
    locatorName(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    visOn = OptionList.index(OptionSelection)
    if forceInt:
        mc.optionVar(iv=(OptionVarName,int(visOn)))
    else:
        mc.optionVar(sv=(OptionVarName,OptionSelection))

    for cnt,Container in enumerate(ListOfContainers):
        if cnt == visOn:
            Container(e=True,vis=True)
            #doToggleMenuShowState(Container,True)
        else:
            Container(e=True,vis=False)
            #doToggleMenuShowState(Container,False)
        cnt+=1
开发者ID:Italic-,项目名称:maya-prefs,代码行数:32,代码来源:GuiFactory.py


示例12: __init__

    def __init__( self,*args,**kws):
        #Check our tool option var for debug mode to set logger level if so
        if mc.optionVar(exists = "cgmVar_guiDebug") and mc.optionVar(q="cgmVar_guiDebug"):
            log.setLevel(logging.DEBUG)	
        self.__toolName__ = __toolName__		
        self.l_allowedDockAreas = ['right', 'left']
        self.WINDOW_NAME = cgmSimpleUI.WINDOW_NAME
        self.WINDOW_TITLE = cgmSimpleUI.WINDOW_TITLE
        self.DEFAULT_SIZE = cgmSimpleUI.DEFAULT_SIZE
        #>>> Standard cgm variables
        #====================	    
        #self.initializeTemplates() 

        #>>> Insert our init, overloaded for other tools
        #self.insert_init(*args,**kws)

        #>>> Menu
        #self.setup_Variables()	
        #self.build_menus()

        #>>> Body
        #====================        
        self.build_layoutWrapper(self)

        self.show()
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:25,代码来源:HotkeyFactory.py


示例13: on_highlightModeChange

	def on_highlightModeChange( self, *a ):
		highlightMode = cmd.optionVar( q='zooTrigHighlighting' )
		cmd.optionVar( iv=('zooTrigHighlighting', not highlightMode) )
		if highlightMode:
			pass
		else:
			triggered.Triggered().unhighlightAllTriggers()
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:7,代码来源:triggeredUI.py


示例14: override_add_hypershade_panel

def override_add_hypershade_panel(panel):
    # create HyperShade with Maya command
    if cmds.optionVar(exists=VAR_HS_CMD):
        mel.eval('%s("%s")' % (cmds.optionVar(query=VAR_HS_CMD), panel))
    else:
        mel.eval('addHyperShadePanel("%s")' % panel)

    # set HyperShade toolbar current parent (name is hardcoded in mel files)
    cmds.setParent('hyperShadeToolbarForm')

    # add custom buttons
    cmds.separator(height=ICON_SIZE, horizontal=False, style='single')

    cmds.iconTextButton(
        image='nodeGrapherAddNodes.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=partial(hypershade_add_node, panel)
    )

    cmds.iconTextButton(
        image='nodeGrapherRemoveNodes.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=partial(hypershade_remove_node, panel)
    )

    cmds.separator(height=ICON_SIZE, horizontal=False, style='single')

    cmds.iconTextButton(
        image='MTT_CreateNode.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=create_nodes
    )
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:35,代码来源:mttOverridePanels.py


示例15: setToDefault

def setToDefault(*args):
    cmds.optionVar( intValue=('ui_DefaultMode', 1) )
    cmds.optionVar( intValue=('ui_selectedTabIndex', 1) )
    cmds.optionVar( intValue=('ui_debug', 0) )
    cmds.optionVar( intValue=('ui_updateMode', 1) )

    cmds.optionVar( intValue=('ui_OptionVar', 1) )
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:7,代码来源:Gun_Tools_UI.py


示例16: UI_RBG_updateMode

def UI_RBG_updateMode(*args):
    global _updateMode

    _updateMode = args[0]
    cmds.optionVar( intValue=('ui_updateMode', _updateMode ))

    update_from_Select()
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:7,代码来源:Gun_Tools_UI.py


示例17: onBrowse

	def onBrowse(self, _):
		self.settingsXML = cmds.fileDialog2(fm=1, fileFilter="XML Files (*.xml)", okc="Set")[0]
		cmds.optionVar( sv=(SETTINGS_FILE_SETTING, self.settingsXML) )
		cmds.textField(self.settingsDirCtrl, edit=True, text=self.settingsXML)
		# Set up a new settings manager with the new XML.
		self.settingsManager = OptimizationSettingsManager(self.settingsXML)
		self.updateSettingFileList()
开发者ID:bennymuller,项目名称:MayaPythonUI,代码行数:7,代码来源:SimplygonBatchProcessor.py


示例18: run

def run(*args, **kwargs):
    """ prepare the scene for the tests
    converts scene to use centimeters
    set the grid to the default
    
    """
    valid_kwargs = ['verbose']
    for k, v in kwargs.iteritems():
        if k not in valid_kwargs:
            raise TypeError("Invalid keyword argument %s" % k)
    # verbose defaults to False if verbose option not set in menu or set 
    # as cmdline argument
     
    try:
        verbose = kwargs['verbose']
    except KeyError:
        verbose = False 
    	if cmds.optionVar(exists='checkmateVerbosity'):
    		verbose = cmds.optionVar(query='checkmateVerbosity')
    else:
        verbose = False       
    batch = cmds.about(batch=True)    
    # get the name of the script Editor's output control
    from maya import mel as mel
    # Turn off Echo All Commands in the Script Editor  
    # Disable Stack Tracevin the Script Editor  
    # Turn off Line Numbers in errors in the Script Editor  
    # Reset the grid
    # Set the background color
    # Turn off the heads-up displays
    # Switch to wrireframe mode
    # Close all windows (except main)
    # Close ChannelBox, Attribute Editor and Outliner ()
    
    if not batch:
        try:
            gCommandReporter = mel.eval("proc string f(string $g){return $g;}f($gCommandReporter);")
        except RuntimeError:
            gCommandReporter = ''
            pass
        try:
            cmds.cmdScrollFieldReporter(gCommandReporter, 
                edit=True, 
                echoAllCommands=False,
                lineNumbers=True,
                stackTrace=True,
                suppressResults=False,
                suppressInfo=False,
                suppressWarnings=False,
                suppressErrors=False,
                suppressStackTrace=False,
                )
        except RuntimeError:
            if verbose:
                print 'No Script Editor'
            pass
    
    # convert scene to cm to fix crashes in nearestnormal
    cmds.currentUnit(linear='cm')
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:59,代码来源:setup.py


示例19: SundayUIToolsDockedShaderlinerSwatchToggle

def SundayUIToolsDockedShaderlinerSwatchToggle():
    if cmds.optionVar(query = 'SundayShaderlinerSwatch'):
        cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 0))
        cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphereColor.png')
    else:
        cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 1))
        cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphere.png')
    SundayUIToolsDockedShaderlinerUpdate()
开发者ID:elliottjames,项目名称:jeeves,代码行数:8,代码来源:SundayUIToolsPy.py


示例20: _disabled_inview_messages

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,代码行数:8,代码来源:capture.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.orientConstraint函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.optionMenuGrp函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap