Skip to content

Instantly share code, notes, and snippets.

@yamahigashi
Last active December 10, 2019 13:42
Show Gist options
  • Save yamahigashi/ad547d2f4347edef46b5493adb58da9f to your computer and use it in GitHub Desktop.
Save yamahigashi/ad547d2f4347edef46b5493adb58da9f to your computer and use it in GitHub Desktop.
import maya.api.OpenMaya as om
import maya.api.OpenMayaUI as omui
# マスクの足し算
SLIM_MASK = omui.M3dView.kDisplayTextures | omui.M3dView.kDisplayMeshes | omui.M3dView.kDisplayGrid | omui.M3dView.kDisplayManipulators
# 引き算はこう
SLIM_MASK = omui.M3dView.kDisplayEverything > omui.M3dView.kDisplayGrid
ALL_MASK = omui.M3dView.kDisplayEverything
def hoge(mask):
av = omui.M3dView.active3dView()
for i in range(omui.M3dView.numberOf3dViews()):
av = omui.M3dView.get3dView(i)
av.setObjectDisplay(mask)
av.refresh()
def toggle():
av = omui.M3dView.active3dView()
current = av.objectDisplay()
if SLIM_MASK == current:
hoge(ALL_MASK)
else:
hoge(SLIM_MASK)
toggle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment