View Full Version : Resolution Gate Corners...

09 September 2010, 09:45 AM

Im trying to find the viewport resolution gate corners coordinates
using python API in Maya 2008.

Running the following procedure I am able to find
viewport corners coordinates, but not for resolution gate.

It should work for all filmFit options:
Fill, Horizontal, Vertical and Overscan.

Could anyone help me please?

Thank you in advance!



my lines:

import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaRender as OpenMayaRender
import maya.OpenMayaUI as OpenMayaUI
import maya.cmds as cmd

def viewPortCoords():

glRenderer = OpenMayaRender.MHardwareRenderer.theRenderer()
glFT = glRenderer.glFunctionTable()

activeView = OpenMayaUI.M3dView.active3dView()
MFnCam = OpenMaya.MFnCamera()

xPtrInit = OpenMaya.MScriptUtil()
yPtrInit = OpenMaya.MScriptUtil()
widthPtrInit = OpenMaya.MScriptUtil()
heightPtrInit = OpenMaya.MScriptUtil()

xPtr = xPtrInit.asUintPtr()
yPtr = yPtrInit.asUintPtr()
widthPtr = widthPtrInit.asUintPtr()
heightPtr = heightPtrInit.asUintPtr()

activeView.viewport(xPtr, yPtr, widthPtr, heightPtr)
viewX = xPtrInit.getUint( xPtr )
viewY = yPtrInit.getUint( yPtr )
viewWidth = widthPtrInit.getUint( widthPtr )
viewHeight = heightPtrInit.getUint( heightPtr )

camera = OpenMaya.MDagPath()
OpenMayaUI.M3dView.active3dView().getCamera(camera )
fnCamera = OpenMaya.MFnCamera(camera)
cameraName = (fnCamera.fullPathName()).split(|)[-1]

bottomLeft = 0,0
topLeft = 0,viewHeight
topRight = viewWidth,viewHeight
bottomRight = viewWidth,0

return bottomLeft,topLeft,topRight,bottomRight

CGTalk Moderation
09 September 2010, 09:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.