import maya.cmds as cmd import maya.OpenMaya as api import maya.OpenMayaUI as apiUI def grabViewport(directory, imageName, ext="jpg"): viewport = apiUI.M3dView.active3dView() viewport.refresh() img = api.MImage() img.create(540,960 ) viewport.readColorBuffer(img, True) filePath = os.path.join(directory, imageName + "." + ext) img.writeToFile(filePath, ext) cmd.viewSet(front=True) cmd.viewFit() filename = "image" dir = "C:/RLM_Windows" ext = "jpg" imageName = filename + "_front" grabViewport(dir, imageName, ext)
标签:Maya,img,imageName,maya,ext,截屏,import,viewport From: https://www.cnblogs.com/CGRun/p/17191241.html