Maya Python游戏与影视编程指南阅读笔记——第四章
作者:互联网
1、外部脚本保存位置:我的文档\maya<version>\scripts\
#创建一个尖刺球体
import maya.cmds
def addSpikes(obj):
try:
polycount = maya.cmds.polyEvaluate(obj, face=True)
except:
raise
for i in range(0, polycount):
face = '%s.f[%s]' % (obj, i)
maya.cmds.polyExtrudeFacet(face, ltz=1, ch=0)
maya.cmds.polyExtrudeFacet(
face, ltz=1, ch=0,
ls = [0.1,0.1,0.1]
)
maya.cmds.polySoftEdge(obj, a=180, ch=0)
maya.cmds.select(obj)
print ('module name:%s' % __name__)
print ('globals:')
for k in globals().keys(): print ('\t%s' % k)
addSpikes(maya.cmds.polyPrimitive(ch=0)[0]) #创建足球体
2 、 pyhton路径
#打印python将搜索的所有目录列表
import sys
for p in sys.path:
print (p)
D:\maya\Maya2018\plug-ins\MASH\scripts\flux\ui
C:\Program Files\Autodesk\Bifrost\Maya2018\scripts
D:\maya\Maya2018\plug-ins\xgen\scripts\cafm
D:\maya\Maya2018\Python\DLLs
C:\Program Files\Autodesk\Bifrost\Maya2018\scripts\boss
D:\maya\Maya2018\plug-ins\xgen\scripts
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui
D:\maya\Maya2018\plug-ins\MASH\scripts\flux\resources
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\tabs
D:\maya\Maya2018\plug-ins\MASH\scripts\apiclient
D:\houdini\engine\maya\maya2018\scripts
D:\maya\Maya2018\plug-ins\MASH\scripts\MASH
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\util
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\ae
D:\maya\Maya2018\Python\lib
D:\maya\Maya2018\plug-ins\MASH\scripts\flux\ae
D:\maya\Maya2018\plug-ins\MASH\scripts\flux
D:\maya\Maya2018\plug-ins\MASH\scripts
D:\maya\Maya2018\plug-ins\MASH\scripts\httplib2
D:\maya\Maya2018\plug-ins\camd\scripts
C:\solidangle\mtoadeploy\2018\scripts
D:\maya\Maya2018\plug-ins\ATF\scripts
D:\maya\Maya2018\plug-ins\MASH\scripts\uritemplate
D:\maya\Maya2018\Python\lib\plat-win
D:\maya\Maya2018\plug-ins\MASH\scripts\MayaToAE
D:\maya\Maya2018\plug-ins\fbx\scripts
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\xmaya
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\brushes
D:\maya\Maya2018\Python\lib\lib-tk
C:\Program Files\Autodesk\Bifrost\Maya2018\scripts\presets
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\widgets
D:\maya\Maya2018\bin
D:\maya\Maya2018\bin\python27.zip
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\fxmodules
D:\maya\Maya2018\Python\lib\site-packages
D:\maya\Maya2018\plug-ins\MASH\scripts\googleapiclient
D:\maya\Maya2018\plug-ins\MASH\scripts\flux\resources\icons
D:\maya\Maya2018\plug-ins\MASH\scripts\MASHAET
D:\maya\Maya2018\plug-ins\substance\scripts
D:\maya\Maya2018\plug-ins\MASH\scripts\oauth2client
D:\maya\Maya2018\Python
D:\maya\Maya2018\plug-ins\xgen\scripts\xgenm\ui\dialogs
D:\maya\Maya2018\bin\python27.zip\lib-tk
C:/Users/huangPeiXin/Documents/maya/2018/prefs/scripts
C:/Users/huangPeiXin/Documents/maya/2018/scripts
C:/Users/huangPeiXin/Documents/maya/scripts
C:\solidangle\mtoadeploy\2018\extensions
2、userSetup.py(userSetuop.mel) 启动maya,自动运行该文件,py与mel不同时存在,mel优先级更高
3、maya.env文件——用于设置maya的相关环境变量
沛鑫 发布了37 篇原创文章 · 获赞 31 · 访问量 2304 私信 关注标签:plug,maya,Maya2018,Python,编程,ins,scripts,Maya,MASH 来源: https://blog.csdn.net/peixin_huang/article/details/104131404