Pythonic access of the view transform button in viewport2.0

Hi all, I am trying to get the state of the ‘viewTransform’ button (as depicted here) whenever viewport2.0 is used.

I was not able to find much information online as I am trying to toggle this button/ state across all model panels (the main viewport and tear off panels if any)

And ideas?

This it?

https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/colorManagementPrefs.html

This command allows querying and editing the color management global data in a scene. It also allows for setting the view transform and rendering space which automatically configures the color processing in the enabled views.

viewingTransforms = cmd.colorManagementPrefs(q=True, viewTransformNames=True)

Hi chalk, that is not what I am looking for.

This is the button that I am trying to query and set the state for:
viewTranfsormButton

I also did tried out the command as you have mentioned, using cmEnabed but it seems to be querying for the global prefs instead of the button state within the viewport/ modelPanels or in other tear off panels

Ok - you’ll need to get the model panel and then query the colour managment state - I’m looping through all model panels and returning their state:

import maya.cmds as cmds

for pane in cmds.getPanel( type='modelPanel' ):
    print cmds.modelEditor(pane, q=True, cmEnabled=True)

You may have to filter by visible pane potentially - something like this:

import maya.cmds as cmds

for pane in cmds.getPanel( visiblePanels=True):
    
    if cmds.getPanel(typeOf=pane) == "modelPanel":
        print cmds.modelEditor(pane, q=True, cmEnabled=True)
1 Like