本文整理汇总了Python中maya.cmds.internalVar方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.internalVar方法的具体用法?Python cmds.internalVar怎么用?Python cmds.internalVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.cmds
的用法示例。
在下文中一共展示了cmds.internalVar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
def read(cls):
""" Load history
Return:
history(list): list of commands
"""
mayaScriptDir = cmds.internalVar(userScriptDir=True)
historyPath = os.path.join(mayaScriptDir, "rushHistory.txt")
if os.path.exists(historyPath):
try:
historyFile = open(historyPath, 'r')
history = historyFile.read().splitlines()
historyFile.close()
return history
except IOError:
return []
else:
return []
示例2: userPrefDir
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
def userPrefDir():
return cmds.internalVar(userPrefDir=True)
示例3: get_data_folder
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
def get_data_folder():
from maya import cmds
return cmds.internalVar(userPrefDir=True)
示例4: loadConfig
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
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:
fileData = open(configFilePath, 'r')
extraConfig = json.load(fileData)
additionalPaths = extraConfig["path"]
fileData.close()
except IOError:
print("Failed to load config file")
config.extend(additionalPaths)
return config
示例5: save
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
def save(self):
""" Write history
"""
mayaScriptDir = cmds.internalVar(userScriptDir=True)
historyPath = os.path.join(mayaScriptDir, "rushHistory.txt")
try:
historyFile = open(historyPath, 'w')
for line in self.history:
historyFile.write(line + "\n")
historyFile.close()
except IOError:
pass
示例6: exportControl
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import internalVar [as 别名]
def exportControl(curves, name):
'''Export a control curve
'''
if not isinstance(curves, (list, tuple)):
curves = [curves]
grp = mc.group(em=True, name=name)
for each in curves:
ml_parentShape.parentShape(each, grp)
mc.delete(grp, constructionHistory=True)
tempFile = mc.internalVar(userTmpDir=True)
tempFile+='tempControlExport.ma'
mc.select(grp)
mc.file(tempFile, force=True, typ='mayaAscii', exportSelected=True)
with open(tempFile, 'r') as f:
contents = f.read()
ctrlLines = ['//ML Control Curve: '+name]
record = False
for line in contents.splitlines():
if line.startswith('select'):
break
if line.strip().startswith('rename'): #skip the uuid commands
continue
if line.startswith('createNode transform'):
record = True
ctrlLines.append('string $ml_tempCtrlName = `createNode transform -n "'+name+'_#"`;')
elif line.startswith('createNode nurbsCurve'):
ctrlLines.append('createNode nurbsCurve -p $ml_tempCtrlName;')
elif record:
ctrlLines.append(line)
with open(controlFilePath(name), 'w') as f:
f.write('\n'.join(ctrlLines))
return grp