Created
August 29, 2015 11:31
-
-
Save SEVEZ/a1d70ebf545896aec9aa to your computer and use it in GitHub Desktop.
get openGL screen size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getScreenRes(panel): | |
m3v = OpenMayaUI.M3dView.active3dView() | |
OpenMayaUI.M3dView.getM3dViewFromModelPanel(panel, m3v) | |
xPtr = OpenMaya.MScriptUtil().asUintPtr() | |
yPtr = OpenMaya.MScriptUtil().asUintPtr() | |
widthPtr = OpenMaya.MScriptUtil().asUintPtr() | |
heightPtr = OpenMaya.MScriptUtil().asUintPtr() | |
m3v.viewport(xPtr, yPtr, widthPtr, heightPtr) | |
viewWidth = OpenMaya.MScriptUtil().getUint( widthPtr ) | |
viewHeight = OpenMaya.MScriptUtil().getUint( heightPtr ) | |
return (float(viewWidth), float(viewHeight)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment