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


Python cmds.internalVar函数代码示例

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


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

示例1: mayaTools

def mayaTools():
    
    #import custom maya setup script
    print cmds.internalVar(usd = True)
    print cmds.internalVar(upd = True)
    path = cmds.internalVar(usd = True)
    path = path + "mayaTools.txt"
    print path
    
    if os.path.exists(path):
        f = open(path, 'r')
        
        mayaToolsDir = f.readline()
        if not os.path.exists(mayaToolsDir):
            mayaToolsInstall_UI()
        
        path = mayaToolsDir + "/General/Scripts"
        pluginPath = mayaToolsDir + "/General/Plugins"
        
        #look in sys.path to see if path is in sys.path. if not, add it
        if not path in sys.path:
            sys.path.append(path)
            
            
        #run setup
        import customMayaMenu as cmm
        cmm.customMayaMenu()
        cmds.file(new = True, force = True)
    
    
    else:
        mayaToolsInstall_UI()
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:32,代码来源:userSetup.py

示例2: setupScriptPaths

def setupScriptPaths():
    """
    Add Maya-specific directories to sys.path
    """
    # Extra libraries
    #
    try:
        # Tkinter libraries are included in the zip, add that subfolder
        p = [p for p in sys.path if p.endswith('.zip')][0]
        sys.path.append( os.path.join(p,'lib-tk') )
    except:
        pass

    # Per-version prefs scripts dir (eg .../maya8.5/prefs/scripts)
    #
    prefsDir = cmds.internalVar( userPrefDir=True )
    sys.path.append( os.path.join( prefsDir, 'scripts' ) )

    # Per-version scripts dir (eg .../maya8.5/scripts)
    #
    scriptDir = cmds.internalVar( userScriptDir=True )
    sys.path.append( os.path.dirname(scriptDir) )

    # User application dir (eg .../maya/scripts)
    #
    appDir = cmds.internalVar( userAppDir=True )
    sys.path.append( os.path.join( appDir, 'scripts' ) )
开发者ID:NicoMaya,项目名称:pymel,代码行数:27,代码来源:basic.py

示例3: loadConfig

def loadConfig():
    """ Load config file

    Return:
        config(list): List of path module paths

    """
    configFilePath = os.path.normpath(os.path.join(
        cmds.internalVar(userScriptDir=True), 'rush.json'))

    defaultModulePath = os.path.normpath(os.path.join(
        cmds.internalVar(userScriptDir=True), 'rush', 'module'))

    config = [defaultModulePath]

    # Use only default module path if config file does not exist
    if not os.path.exists(configFilePath):
        print("Additional config file not found: %s" % configFilePath)
        return config

    # Open and load config file in use home dir and append it to the
    # config list
    try:
        f = open(configFilePath, 'r')
        extra_config = json.load(f)
        additionalPaths = extra_config["path"]
        f.close()
    except IOError:
        print("Failed to load config file")

    config.extend(additionalPaths)

    return config
开发者ID:minoue,项目名称:miExecutor,代码行数:33,代码来源:__init__.py

示例4: __init__

 def __init__(self):
     # scripts
     scriptDir = cmds.internalVar(usd=1)
     scriptDir = scriptDir.partition('maya')
     scriptDir = os.path.join(scriptDir[0], scriptDir[1])
     self.rootPath = os.path.join(scriptDir, 'scripts')
     # prefs
     prefDir = cmds.internalVar(upd=1)
     # build paths
     self.iconPath = os.path.join(prefDir, 'icons')
     self.iconOn = os.path.join(self.iconPath, 'srv_mirSel_on_icon.xpm')
     self.iconOff = os.path.join(self.iconPath, 'srv_mirSel_off_icon.xpm')
     self.pairPath = os.path.join(self.rootPath, 'pairSelectList.txt')
开发者ID:boochos,项目名称:work,代码行数:13,代码来源:pairSelect.py

示例5: setCurrentProject

def setCurrentProject(projectName, *args):
    #get access to maya tools path
    toolsPath = cmds.internalVar(usd = True) + "mayaTools.txt"
    if os.path.exists(toolsPath):
	
	f = open(toolsPath, 'r')
	mayaToolsDir = f.readline()
	f.close()
	
	
    #re-write settings
    if os.path.exists(mayaToolsDir + "/General/Scripts/projectSettings.txt"):
	f = open(mayaToolsDir + "/General/Scripts/projectSettings.txt", 'r')
	oldSettings = cPickle.load(f)
	useSourceControl = oldSettings.get("UseSourceControl")
	f.close()
	
	#write out new settings
	settings = {}
	settings["UseSourceControl"] = useSourceControl
	settings["CurrentProject"] = projectName
	
	f = open(mayaToolsDir + "/General/Scripts/projectSettings.txt", 'w')
	cPickle.dump(settings, f)
	f.close()	    
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:25,代码来源:perforceUtils.py

示例6: saveCopy

    def saveCopy(self, data):
        "Button callback to end the dialog"

        resName = self.currentResource
        if resName is None:
            return

        ext = os.path.splitext(resName)[1]
        if ext == '':
            ext = '.png'

        # Bring a file browser to select where to save the copy
        captionStr = stringTable['y_resourceBrowser.kPickIconCaption']
        iconDir = cmds.internalVar(userBitmapsDir=True)
        fileList = cmds.fileDialog2(caption=captionStr,
                                    fileMode=0,
                                    okCaption=captionStr,
                                    fileFilter='*' + ext,
                                    startingDirectory=iconDir)
        path = None
        if fileList is not None:
            if len(fileList) > 0 and fileList[0] != "":
                path = fileList[0]

        if path is not None:
            cmds.resourceManager(saveAs=(resName, path))
开发者ID:ewerybody,项目名称:melDrop,代码行数:26,代码来源:resourceBrowser.py

示例7: 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

示例8: setupTools

def setupTools():
    
    path = cmds.internalVar(usd = True) + "mayaTools.txt"
    

    f = open(path, 'r')
    
    mayaToolsDir = f.readline()
    
    path = mayaToolsDir + "/General/Scripts"
    pluginPath = mayaToolsDir + "/General/Plugins"
    
    #look in sys.path to see if path is in sys.path. if not, add it
    if not path in sys.path:
        sys.path.append(path)
        
    #make sure MAYA_PLUG_IN_PATH has our plugin path
    pluginPaths = os.environ["MAYA_PLUG_IN_PATH"]
    pluginPaths = pluginPaths + ";" + pluginPath
    os.environ["MAYA_PLUG_IN_PATH"] = pluginPaths
        

    
    
    #setup menu item in main window
    import customMayaMenu as cmm
    cmm.customMayaMenu()
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:27,代码来源:mayaSetup.py

示例9: defaultPath

def defaultPath():
    # user = os.path.expanduser('~')
    # mainDir = user + '/maya/characterSets/'
    # proper directory query
    varPath = cmds.internalVar(userAppDir=True)
    mainDir = os.path.join(varPath, 'characterSets')
    return mainDir
开发者ID:boochos,项目名称:work,代码行数:7,代码来源:characterSet_lib.py

示例10: UI

def UI():
	# check to see if the window exists
	if cmds.window('exampleUI', exists = True):
		cmds.deleteUI('exampleUI')
	#create the window
	window = cmds.window('exampleUI', title = 'exampleUI', w = 300, h = 300, mnb  = False, mxb = False, sizeable = False)
	#show window
	cmds.showWindow(window)
	# create a main layout
	mainLayout = cmds.columnLayout(h = 300, w = 300)
	# banner image
	imagePath = cmds.internalVar(userPrefDir = True) + 'icons' + '/test.jpg' # find the path to the image
	cmds.image(w = 300, h = 100, image = imagePath)
	cmds.separator(h = 15)# just a seperator
	# projects option menu
	projectsOptionMenu = cmds.optionMenu ( 'projectsOptionMenu', width = 300, changeCommand = populateCharacters, label = 'choose a project:     ') # change command needed to update character option menu based on what project is selected
	# create a character option menu
	characerOptionMenu = cmds.optionMenu ( 'characerOptionMenu', width = 300, label = 'choose a character: ')
	cmds.separator(h = 15) # just a seperator
	# create the build button
	cmds.button(label = 'build', w = 300, h = 50 ,c = build)
	# activate populate projects option menu
	populateProjects()
	# activate populate characaters option menu
	populateCharacters()
开发者ID:jricker,项目名称:JR_Maya,代码行数:25,代码来源:WIP_UI_sceneOpen.py

示例11: __init__

 def __init__(self):
         self.userDir=os.path.expanduser("~")
         self.fileFilters=["ma","jpg","png","mb",'iff','tga','tif','PNG','JPG']
         self.userName=os.path.basename(self.userDir)
         self.minimeDir=os.path.normpath(os.path.join(self.userDir,"MiniMe"))
         self.favFile=os.path.join(self.minimeDir,"favorites.txt")
         self.ftpData= os.path.normpath(os.path.join(self.minimeDir,"ftp.db"))
         try:
                 self.prjDir = (cmds.workspace(fn=True)).replace("/","\\") #returns project directory for start up
                 self.defaultImage = cmds.internalVar(usd=True)+"notFound.jpg" # get path of image from script directory
         except Exception as e:
                 print e
         ##Check the MiniME setting folder exist if not create one then check
         ## if Favorite file exist if not create it, if it exist read it.
         if os.path.isdir(self.minimeDir):
                 ### "Mini Me Setting Directory Exist or not"
                 if os.path.isfile(self.favFile):
                         ### "Favorite file exists"
                         try:
                                 read_fav_file=open(self.favFile,"r")
                                 ### Load favorite dictioary from file
                                 self.favItems=eval(read_fav_file.read())
                                 if self.favItems is None:
                                         print "No favorites found in file."
                         except Exception as err:
                                 self.favItems={}
                                 print err
                         finally:
                                 read_fav_file.close()
                 else:
                         self.createFavFile()
         else:
                 print "Creating " + self.minimeDir
                 os.mkdir(self.minimeDir)
开发者ID:sanfx,项目名称:pythonScripts,代码行数:34,代码来源:minime.py

示例12: getSettings

def getSettings(appName, unique=False, version=None):
	"""
	Helper to get a settings object for a given app-name
	It uses INI settings format for Maya, and registry format for stand-alone tools.
	Try to ensure that the appName provided is unique, as overlapping appNames
	will try to load/overwrite each others settings file/registry data.

	:param appName: string -- Application name to use when creating qtSettings ini file/registry entry.
	:return: QtCore.QSettings -- Settings object
	"""
	ukey = __name__ + '_QSettings'
	if not unique and (appName, version) in __main__.__dict__.setdefault(__name__+'_settings', {}):
		return __main__.__dict__[ukey][(appName, version)]

	if has_maya:
		settingsPath = os.path.join(cmds.internalVar(upd=True), 'mlib_settings', appName+'.ini')
		settingsPath = os.path.normpath(settingsPath)

		settings = QtCore.QSettings(settingsPath, QtCore.QSettings.IniFormat)
		settings.setParent(getMayaWindow())
	else:
		settings = QtCore.QSettings('MLib', appName)

	if not unique:
		__main__.__dict__[ukey][(appName, version)] = settings
	elif isinstance(unique, QtCore.QObject):
		settings.setParent(unique)

	if version is not None:
		if float(settings.value('__version__', version))<version:
			settings.clear()
		settings.setValue('__version__', version)
	return settings
开发者ID:Temujin2887,项目名称:mlib,代码行数:33,代码来源:qt.py

示例13: TappInstall_browse

def TappInstall_browse(*args):
    repoPath=cmds.fileDialog2(dialogStyle=1,fileMode=3)
    
    if repoPath:
        repoPath=repoPath[0].replace('\\','/')
        
        check=False
        #checking all subdirectories
        for name in os.listdir(repoPath):
            
            #confirm that this is the Tapp directory
            if name=='Tapp':
                check=True
        
        if check:
            #create the text file that contains the Tapp directory path
            path=cmds.internalVar(upd=True)+'Tapp.yml'
            
            f=open(path,'w')
            data='{launchWindowAtStartup: False, repositoryPath: \''+repoPath+'\'}'
            f.write(data)
            f.close()
    
            #run setup
            sys.path.append(repoPath)
            
            cmds.evalDeferred('import Tapp')
            
            #delete ui
            cmds.deleteUI('TappInstall_UI')
            
        else:
            cmds.warning('Selected directory is not the \'Tapp\' directory. Please try again')
开发者ID:baitstudio,项目名称:CodeRepo,代码行数:33,代码来源:tapp_maya.py

示例14: skinWeights

def	skinWeights(x=None, export=None, f=None, fileName=None):
# Import/export skin weights from/to a file
# x/export: 0 for import, 1 for export
# f/fileName: filename under default project directory

	x = x or export

	if not (f or fileName):
		raise Exception, "Missing argument: fileName"
		
	if fileName:
		f = fileName
	
	obj = cmds.ls(sl=1)
	if not obj:
		raise Exception, "No object selected"

	obj = obj[0]

	node = None
	for n in cmds.listHistory(obj, f=0, bf=1):
		if cmds.nodeType(n) == 'skinCluster':
			node = n
			break
	if not node:
		raise Exception, "no skin cluster found"

	mode = "r"
	if x:
		mode = "w"
	f = open(cmds.internalVar(uwd=1) + f, mode)

	allTransforms = cmds.skinPercent(node, cmds.ls(cmds.polyListComponentConversion(obj, tv=1), fl=1), q=1, t=None)

	for vertex in cmds.ls(cmds.polyListComponentConversion(obj,tv=1), fl=1):
		if x:
			transforms = cmds.skinPercent(node, vertex, ib=1e-010, q=1, t=None)
			weights = cmds.skinPercent(node, vertex, ib=1e-010, q=1, v=1)
			s = ""
			for i in range(len(transforms)):
				s += str(weights[i])+"@"+transforms[i]+" "
			f.write(s+"\n")
		else:
			weights = {}
			for t in allTransforms:
				weights[t] = float(0)

			readWeights = f.readline().strip().split(" ")

			for i in readWeights:
				w = i.split("@")
				if w[1] in weights:
					weights[w[1]] = float(w[0])

			w = []
			for i in weights.iteritems():
				w.append(i)
			cmds.skinPercent(node, vertex, tv=w)

	f.close()
开发者ID:cgriders,项目名称:jcScripts,代码行数:60,代码来源:character.py

示例15: initUI

    def initUI(self):

        comboBox = QtGui.QComboBox()
        # comboBox.set
        # set directory for cookie images
        directory = mc.internalVar(uad=True) + "scripts/assets/cookie/"
        # save list of images in directory
        images = os.listdir(directory)
        # remove DS_Store
        images.pop(0)
        # populate combo box with image names
        comboBox.addItems(images)
        self.mainLayout.addWidget(comboBox)

        # make image preview area

        # make a create button
        create_btn = QtGui.QPushButton("Create")

        # connect button's click slot to create_cookie method
        create_btn.clicked.connect(self.create_cookie)

        # add the button to the main layout
        self.mainLayout.addWidget(create_btn)

        # make a create button
        replace_btn = QtGui.QPushButton("Replace")

        # connect button's click slot to create_cookie method
        replace_btn.clicked.connect(self.replace_cookie)

        # add the button to the main layout
        self.mainLayout.addWidget(replace_btn)
开发者ID:pfleer,项目名称:python,代码行数:33,代码来源:cookie.py


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