Display

Viewportcolors

setBackgroundColorLinear(linearFloatColor)

Set the background color as with color in linearFloat format

Parameters:

linearFloatColor (list(float)) – The color in linear float (0.01, 1.0, 0.543)

backgroundColorLinear()

Gets the color of the background and returns in Linear float

Return color:

Color as a linear float.

Rtype color:

list(float)

setBackgroundColorSrgb(srgbFloatColor)

Set the background color as with color in SrgbFloat format

Parameters:

srgbFloatColor (list(float)) – The color in srgb float (0.01, 1.0, 0.543)

backgroundColorSrgb()

Gets the color of the background and returns in srgb float

Return color:

Color as a srgb float.

Rtype color:

list(float)

viewportList()

Returns the viewport displayRGBColor list of strings, a large Maya list with various color preferences

Return displayRGBColorList:

a large Maya list with various color preferences

Rtype displayRGBColorList:

list(str)

stringToFloatList(txt, keyWord)

Converts text into a float color, annoying cause mel doesn’t return dictionaries.

result = stringToFloatList("background 0.613 0.613 0.613", "background")
# [0.613, 0.613, 0.613]
Parameters:
  • txt – one entry of unicode string from the viewportList

  • keyWord – The keyword to remove ie “background”, “backgroundTop” or “backgroundBottom”

Returns:

[0.613, 0.613, 0.613]

Return type:

list[float]

backgroundColors()

Returns the background colors as a list in [bgColorLinear, topGradColorLinear, botGradColorLinear]

Return backgroundColorList:

background colors as a list in [bgColorLinear, topGradColorLinear, botGradColorLinear]

Rtype backgroundColorList:

list[list[float]]

setNextColor(linearFloatColorList, currentInt)

Sets the next color given the current list Int and a linearFloatColorList

Parameters:
  • linearFloatColorList (list(list(float))) – The color list in linear float (0.01, 1.0, 0.543)

  • currentInt (int) – The current color as an int

cycleBackgroundColors(linearFloatColorList)

Cycles the background colors like maya alt b only with a custom list of linear float colors

Parameters:

linearFloatColorList (list(list(float))) – The color list in linear float (0.01, 1.0, 0.543)

cycleBackgroundColorsZoo()

Cycles the background colors like maya alt b only with two more dark background colors.

See mayacolors.ZOO_BG_COLORS_LINEAR for the color list in linear float

Viewportmodes

” from zoo.libs.maya.cmds.display import viewportmodes panel = viewportmodes.panelUnderPointerOrFocus(viewport3d=True) viewportmodes.lookThroughSelected()

panelUnderCursor(viewport3d=True)

Returns the panel under the pointer, with a check to filter for a viewport panel. Returns “” if not found

Parameters:

viewport3d (bool) – if True will test to see if the panel under the cursor is a 3d viewport with a camera

Return mayaPanel:

The name of the Maya panel, will be “” if no panel found

Rtype mayaPanel:

str

panelWithFocus(viewport3d=True)

Returns the panel with focus, with a check to filter for a viewport panel. Returns “” if not found

Parameters:

viewport3d (bool) – if True will test to see if the panel under the cursor is a 3d viewport with a camera

Return mayaPanel:

The name of the Maya panel, will be “” if no panel found

Rtype mayaPanel:

str

firstViewportPanel()

Returns the first visible viewport panel it finds in the current Maya session

Return viewportPanel:

The name of the Maya panel that is a viewport, will be “” if not found (might be impossible)

Rtype viewportPanel:

str

panelUnderPointerOrFocus(viewport3d=False, prioritizeUnderCursor=True, message=True)

returns the mayaPanel that is either:

  1. Under the cursor

  2. The active panel (with focus)

  3. First visible viewport panel (only if viewport3d=True)

If prioritizeUnderCursor=True then the active panel (with focus) will prioritize before under the cursor.

In general use prioritizeUnderCursor=True for hotkeys and prioritizeUnderCursor=False for UIs.

The “viewport3d” flag set to True will return only panels with 3d cameras, ie 3d viewports, otherwise None

Parameters:
  • viewport3d (bool) – if True will test to see if the panel under the cursor is a 3d viewport with a camera

  • prioritizeUnderCursor (bool) – if True return under cursor first, and if not then with focus

  • message (bool) – report a potential fail message to the user?

Return mayaPanel:

The name of the Maya panel, will be “” if no panel found

Rtype mayaPanel:

str

lookThroughSelected()

Works the same as Panels (viewport menu) > Look Through Selected.

Compatible with both lights and cameras as uses the mel code. Can map to a hotkey.

editorFromPanelType(scriptedPanelType='graphEditor')

Returns the editors from the scriptedPanelType.

eg. “graphEditor” returns the graph editor editors as a list:

[“graphEditor1OutlineEd”, “graphEditor1OutlineEdSecondary”]

Parameters:

scriptedPanelType (str) – The panel type to search for, eg. “graphEditor”

Returns:

The editors from the scriptedPanelType

Return type:

list(str)

displayToggleTextureMode()

Toggles the texture viewport mode, will invert. Eg. if “on” turns “off”, usually on a hotkey

displayToggleWireShadedMode()

Toggles the shaded viewport mode. Will invert. Eg. if “wireframe” turns “shaded”, usually on a hotkey

displayToggleLightingMode()

Toggles the light viewport mode. Will invert. Eg. if “lights on” turns “lights off”, usually on a hotkey

setDisplayTextureMode(textures=True)

Turns the textures of the viewport on or off

displayTextureMode(message=True)

Returns whether textures are on or off in the active viewport, will return None if no viewports

setDisplayLightingMode(display=True)

Turns on/off the light viewport mode.

displayLightingMode(message=True)
setDisplayShadowMode(display=True)

Turns on/off the light viewport mode.

displayShadowMode(message=True)
displayToggleWireOnShadedMode()

Toggles the ‘wireframe on shaded’ viewport mode. Will invert. Eg. if “shaded” turns “wireframeOnShaded”

displayToggleXrayMode()

Toggles the xray viewport mode. Will invert. Eg. if “xray on” turns “xray off”, usually on a hotkey

setViewportSettingsAll(value=True)

Sets all the viewport settings on for high quality.

Lights, occlusion, anti-alias, textures

Parameters:

value (bool) – Settings either on True or off False

setDisplayOcclusion(enable=True)

Sets the value of the viewport sceen space ambient occlusion

Parameters:

enable (bool) – True enables Ambient Occlusion in the viewport

displayOcclusion()

Gets the value of the viewport sceen space ambient occlusion

Return aoValue:

AO on or off

Rtype aoValue:

bool

setDisplayMotionBlur(enable=True)

Sets the value of the viewport motion blur

Parameters:

enable (bool) – True enables Motion Blur in the viewport

setAntiAliasVPSamples(samples=16)

Set VP2 anti-alias sample settings

Parameters:

samples (int) – Sample level of the viewport settings, 8 or 16 etc

antiAliasVPSamples()

Gets anti-aliasing sample settings amount

Return antiAlias:

Sample level of the viewport settings, 8 or 16 etc

Rtype antiAlias:

int

setDisplayAntiAlias(enable=True)

Sets anti-aliasing on or off in the viewports

Parameters:

enable (bool) – True will set anti-aliasing

displayAntiAlias()

Gets anti-aliasing on or off in the viewports

Return antiAlias:

Anti-Aliasing on or off for the viewports

Rtype antiAlias:

bool

setMaxLights(lightCount)

Sets anti-aliasing on or off in the viewports

Parameters:

enable (bool) – True will set anti-aliasing

maxLights()

Gets the maximum light setting from hardwareRenderingGlobals

Return antiAlias:

Anti-Aliasing on or off for the viewports

Rtype antiAlias:

bool

setViewportExposureGamma(exposure=0.0, gamma=1.0)

Sets the gamma and exposure of the current 3d viewport panel.

Parameters:
  • exposure (float) – The exposure of the current viewport panel

  • gamma (float) – The gamma of the current viewport panel

setViewportContrastGamma(exposure=0.0, gamma=1.0, contrast=1.0)

Pseudo-fake contrast using exposure and gamma.

Parameters:
  • exposure (float) – The exposure value

  • gamma (float) – The amount of pseudo contrast

  • contrast (float) – The gamma value

regenerateUdimTextures(message=True)

Regenerates UDIM textures as per Viewport Settings Regernerate All UV Tile Preview Textures

reloadViewport(message=False)

viewport reload If used then reset the entire OGS database for all viewports using it.