Message 1 of 2
Python API - M3dView - Screenshot alpha
Not applicable
11-28-2012
03:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the following code to screen grab a viewport.
Is there any way to exclude the background in the alpha?
Seems silly that the background should act as a solid object to begin with no?
Even the view cube acts like an alpha object…
We need to screen grab (as opposed to render).
Thanks,
/Christian
#Import api modules
import maya.OpenMaya as api
import maya.OpenMayaUI as apiUI
#Grab the last active 3d viewport
view = apiUI.M3dView.active3dView()
# Enable Alpha
view.setColorMask(1, 1, 1, 1)
#read the color buffer from the view, and save the MImage to disk
image = api.MImage()
view.readColorBuffer(image, True)
image.writeToFile('C:/test.png', 'png')
Is there any way to exclude the background in the alpha?
Seems silly that the background should act as a solid object to begin with no?
Even the view cube acts like an alpha object…
We need to screen grab (as opposed to render).
Thanks,
/Christian