Maya HeadUpDisplay
程序员文章站
2022-07-12 13:35:18
...
import maya.cmds as mc
file_Name = mc.file(q=True,sceneName=True,shortName=True)
if mc.headsUpDisplay(listHeadsUpDisplays=True):
for i in mc.headsUpDisplay (listHeadsUpDisplays=True):
mc.headsUpDisplay(i,remove=True)
def frame_counter():
end = mc.playbackOptions (q=1, aet=1)
start = mc.playbackOptions (q=1, ast=1)
counter = "%s-%s"%(int(start),int(end))
return counter
def resolution_get():
Width = mc.getAttr("defaultResolution.width")
Height = mc.getAttr("defaultResolution.height")
rslt = "%s*%s"%(Width ,Height)
return rslt
def getTime():
currentTime_get = mc.currentTime(q=1)
return currentTime_get
def getDate():
currentDate = mc.date()
return currentDate
def heads_up_display():
mc.displayColor( "headsUpDisplayLabels", 6,dormant=1)
mc.displayColor( "headsUpDisplayValues", 16,dormant=1)
mc.headsUpDisplay( 'HUDObjectFarmeCounter', section=0, block=0,blockSize='large', label='FrmRng', labelFontSize='large',dataFontSize='large',command=frame_counter,attachToRefresh=True)
mc.headsUpDisplay( 'HUDObjectResolution', section=4, block=0,blockSize='large', label='Rslt', labelFontSize='large',dataFontSize='large',command=resolution_get,attachToRefresh=True)
mc.headsUpDisplay( 'HUDObjectCurrentFrame', section=9, block=0,blockSize='large', label='CrtTm', labelFontSize='large',dataFontSize='large',command=getTime,attachToRefresh=True)
mc.headsUpDisplay( 'HUDObjectFileName', section=7, block=0,blockSize='large', label=file_Name.split(".")[0], labelFontSize='large', dataFontSize='large')
mc.headsUpDisplay( 'HUDObjectDate', section=5, block=0,blockSize='large', label='DATE', labelFontSize='large', dataFontSize='large',command=getDate,attachToRefresh=True)
if __name__ == '__main__' :
heads_up_display()
上一篇: spring源码分析-IOC