本文整理汇总了Python中maya.cmds.internalVar函数的典型用法代码示例。如果您正苦于以下问题:Python internalVar函数的具体用法?Python internalVar怎么用?Python internalVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了internalVar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Tapp
def Tapp():
path=cmds.internalVar(upd=True)+'Tapp.yml'
if os.path.exists(path):
f=open(path,'r')
settings=f.read()
#brute force from yaml to ast
settings=settings.replace('{','{\'').replace(':','\':').replace(', ',', \'')
settings=settings.replace('\n','')
settings=settings.replace('true','True')
settings=settings.replace('false','False')
#compensate for drive letter
settings=settings.replace('\':/',':/')
settings=ast.literal_eval(settings)
path=settings['repositoryPath']
if os.path.exists(path):
if not path in sys.path:
sys.path.append(path)
#run setup
cmds.evalDeferred('import Tapp')
else:
TappInstall_UI()
else:
TappInstall_UI()
开发者ID:baitstudio,项目名称:CodeRepo,代码行数:31,代码来源:tapp_maya.py
示例17: gui
def gui():
'''
Gui element for getting the desired path.
'''
global mainCol
if( cmds.window(win,q=True, ex=True) ):
cmds.deleteUI(win)
cmds.window( win, w=winWidth, h=winHeight)
# mainCol = cmds.columnLayout()
mainCol = cmds.rowColumnLayout( nc=1, w=winWidth, h=winHeight, cw=[1,winWidth+10])
# Get proper directory.
# Focus on a directory in the maya folder
scriptDir = cmds.internalVar(userAppDir=True)
scriptDir = os.path.join(scriptDir, "testDir") # Result: C:/Documents and Settings/mclavan/My Documents/maya/scripts #
# Does the directory exists?
# If it does then execute the script.
if(os.path.exists(scriptDir)):
print("Run Script")
#print(scriptDir)
#print(os.walk(scriptDir).next()[0])
tabDirs = os.walk(scriptDir).next()[1]
tdTab(scriptDir, tabDirs, mainCol )
else:
print("Directory doesn't exists.")
cmds.showWindow(win)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:31,代码来源:tdClubFiles2.py
示例18: readAttr
def readAttr():
"""
Read attributes from a chosen file.
"""
# Get information from file
# Starting at the maya folder and limiting to extension .sba
mayaFolder = cmds.internalVar(userAppDir=True)
# File Dialog
# sba will be the file extension.
filePath = cmds.fileDialog(mode=0, directoryMask=mayaFolder + "*.sba")
print("Choosen file: " + filePath)
# Open File
attrFile = open(filePath, "r") # Will overwrite the file if it allready exists!
attrs = attrFile.readlines()
# Close File
attrFile.close()
# loop through file content adding to the textScrollList
for attr in attrs:
# Check to see if the attribute allready exists in the textScrollList
attr = attr.rstrip()
# all the current tsl items
allItemsTSL = cmds.textScrollList("sbaKeyTSL", q=True, allItems=True)
if allItemsTSL and (attr in allItemsTSL):
print(attr + " all ready exists in the list.")
else:
cmds.textScrollList("sbaKeyTSL", edit=True, append=attr)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:32,代码来源:mclavan_fp_extra.py
示例19: editCharacter
def editCharacter(*args):
if cmds.window("artEditCharacterUI", exists = True):
cmds.deleteUI("artEditCharacterUI")
window = cmds.window("artEditCharacterUI", w = 300, h = 400, title = "Edit Character", mxb = False, mnb = False, sizeable = False)
mainLayout = cmds.columnLayout(w = 300, h = 400, rs = 5, co = ["both", 5])
#banner image
toolsPath = cmds.internalVar(usd = True) + "mayaTools.txt"
if os.path.exists(toolsPath):
f = open(toolsPath, 'r')
mayaToolsDir = f.readline()
f.close()
cmds.image(w = 300, h = 50, image = mayaToolsDir + "/General/Icons/ART/artBanner300px.bmp", parent = mainLayout)
cmds.text(label = "", h = 1, parent = mainLayout)
optionMenu = cmds.optionMenu("artProjOptionMenu", label = "Project:", w =290, h = 40, cc = getProjCharacters, parent = mainLayout)
textScrollList = cmds.textScrollList("artProjCharacterList", w = 290, h = 300, parent = mainLayout)
button = cmds.button(w = 290, h = 40, label = "Edit Export File", c = editSelectedCharacter, ann = "Edit the character's skeleton settings, joint positions, or skin weights.", parent = mainLayout)
button2 = cmds.button(w = 290, h = 40, label = "Edit Rig File", c = editSelectedCharacterRig, ann = "Edit the character's control rig that will be referenced in by animation.", parent = mainLayout)
cmds.text(label = "", h = 1)
cmds.showWindow(window)
getProjects()
getProjCharacters()
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:30,代码来源:customMayaMenu.py
示例20: writeSelAttrFile
def writeSelAttrFile():
"""
Writes the selected attributes from the textScrollList to a file.
"""
# Let the user choose where the files is being saved to.
# Starting point will be the maya folder.
mayaFolder = cmds.internalVar(userAppDir=True)
# File Dialog
# sba will be the file extension.
filePath = cmds.fileDialog(mode=1, directoryMask=mayaFolder + "*.sba")
print("Choosen file: " + filePath)
# Gather the attributes from the textScrollList
selectedTSL = cmds.textScrollList("sbaKeyTSL", q=True, si=True)
# Open File
attrFile = open(filePath, "w") # Will overwrite the file if it allready exists!
# Loop through one element at a time writing it to a file.
for item in selectedTSL:
attrFile.write(item + "\n")
# Close File
attrFile.close()
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:25,代码来源:mclavan_fp_extra.py
注:本文中的maya.cmds.internalVar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论