Created
May 25, 2017 06:58
-
-
Save sonictk/d92631a2f5aab49aa3859e41e675a487 to your computer and use it in GitHub Desktop.
Draw text in the Maya VP1 viewport
This file contains 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
import maya.OpenMaya as om | |
import maya.OpenMayaUI as OpenMayaUI | |
def drawText(*args): | |
view = OpenMayaUI.M3dView.active3dView() | |
view.beginGL() | |
view.drawText('test text 2', om.MPoint(5, 5, 0.0, 1.0)) | |
view.endGL() | |
panel = cmds.getPanel(withFocus=True) | |
callBack = OpenMayaUI.MUiMessage.add3dViewPostRenderMsgCallback(panel, drawText) | |
view = OpenMayaUI.M3dView.active3dView() | |
view.refresh(True, True) | |
# Remove | |
OpenMayaUI.MUiMessage.removeCallback(callBack) | |
view = OpenMayaUI.M3dView.active3dView() | |
view.refresh(True, True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment