def saveScreenshot(self, name, directory=DIRECTORY):
path = os.path.join(directory, '%s.jpg' % name)
# We'll fit the view to the objects in our scene or our selection
cmds.viewFit()
# We'll change our render format to jpg
cmds.setAttr("defaultRenderGlobals.imageFormat", 8) # This is the value for jpeg
# Finally we'll save out our image using the playblast module
# There are a lot of arguments here so it's good to use the documentation to know what's going on
cmds.playblast(completeFilename=path, forceOverwrite=True, format='image', width=200, height=200,
showOrnaments=False, startTime=1, endTime=1, viewer=False)
# Return the path of the file we saved
return path
# This will be our first Qt UI!
# We'll be creating a dialog, so lets start by inheriting from Qt's QDialog
评论列表
文章目录