View Full Version : Possible to get specific viewport's width and height?

11 November 2010, 03:54 PM
It's possible in python by using activeView = OpenMayaUI.M3dView.active3dView()

A: Is there a similar command in MEL?

B: Possible to specify which viewport to get this instead of the active one?


11 November 2010, 05:07 PM
A) Just get the size of the editor itself (Not the model panel)
cmds.control('someModelEditor', q=True, wh=True)

B) Use getM3dViewFromModelEditor
renderWindow = 'someModelEditor'

view = apiUI.M3dView()
apiUI.M3dView.getM3dViewFromModelEditor(renderWindow, view)

11 November 2010, 09:22 AM
Thank you very much

For A, is it possible to query the active view?

11 November 2010, 11:14 AM
Yeah, you can get the panel with focus, and query the model editor from there. Also, looking at getpanel, it can get the panel under the cursor without using the api/pyqt. Although it won't get any other controls, only panels.

cmds.getPanel( withFocus=True)

11 November 2010, 03:16 PM
Awesome, thank you very much for your help!

CGTalk Moderation
11 November 2010, 03:16 PM
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.