Created
January 25, 2018 05:11
-
-
Save yamahigashi/e2516ed8bbb6eef6c07925f3473d2f39 to your computer and use it in GitHub Desktop.
Enable viewport2.0 with antialias on opening secen for Autodesk Maya.
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
| from textwrap import dedent | |
| from maya import OpenMaya as om | |
| from maya import cmds | |
| from maya import mel | |
| def auto_enable_vp2(arg): | |
| force_vp2_cmd = dedent(""" | |
| string $panels[] = `getPanel -type modelPanel`; | |
| for( $panel in $panels ) { | |
| string $currentPanel = `getPanel -withFocus`; | |
| string $panelType = `getPanel -to $panel`; | |
| setRendererInModelPanel "vp2Renderer" $panel; | |
| } | |
| setAttr "hardwareRenderingGlobals.lineAAEnable" 1; | |
| setAttr "hardwareRenderingGlobals.multiSampleEnable" 1; | |
| """) | |
| mel.eval(force_vp2_cmd) | |
| om.MSceneMessage.addCallback( | |
| om.MSceneMessage.kAfterOpen, | |
| auto_enable_vp2 | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment