Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Switch off UV Toolkit with Python

Message 1 of 6
1315 Views, 5 Replies

Switch off UV Toolkit with Python

I'm trying to write a script that will simple toggle the *!@$%^& UV Toolkit  window off!


Trouble is the windows aren't called by the same thing they are named and I'm not sure how to determine if the current window exists. Also a little confused as to what constitutes a panel and a window


import maya.cmds as cmds

for panel in cmds.getPanel(sty = "UV Toolkit"):
  cmds.window( panel, e = True, visible = False )

Yeah, it's not called the UV Toolkit, is it? Which is where I when down a digital rabbit hole as to how to find out the name of the desired window. Any ideas how to switch the UV Toolkit off - apart from from Hide UV Tookit from the UV Editor window?

Message 2 of 6
in reply to: Anonymous

Short answer:

cmds.workspaceControl("UVToolkitDockControl", e=True, close=True)

Long answer:

To figure out how to close the UV Toolkit, the first thing I did was to open the Script Editor.  Then I turned on "Echo All Commands".  Then I opened the UV Editor.  (On my machine, the UV Toolkit always opens when I open the UV Editor.)  This printed a bunch of output to the Script Editor.  Reading through the lines of output, I saw something that looked promising, "createUVToolkitDockControl();".

Next I ran the "whatIs" command and got the following result:

whatIs createUVToolkitDockControl;
// Mel procedure found in: C:/Program Files/Autodesk/Maya2019/scripts/others/UVToolkitPanel.mel // 

Note that the "whatIs" command must be run from MEL.  There is no Python version of it.

Next I found the file "UVToolkitPanel.mel" and opened it in a text editor.  Then I looked for the "createUVToolkitDockControl()" function.  Inside that function, I found this line:

    workspaceControl -e -initialWidth 285
-initialHeight `optionVar -q workspacesNarrowPanelInitialHeight`
-minimumWidth 285 -widthProperty "preferred" UVToolkitDockControl;

This line tells us that we are dealing with a "workspaceControl" and that it is named "UVToolkitDockControl".

Finally, I went to the documentation for "workspaceControl" and found out that it has a "close" flag.


That's pretty much how I track down most things in Maya.  Hopefully it will help if you have to do something similar in the future.

Message 3 of 6
in reply to: rflannery

Thank you! As i noticed the mel command of UV  is:


and Python just added those lines:

import maya.cmds as cmds


 So to "convert" any of standart editors (no only) to Python i have to add those lines? 

Message 4 of 6

Hey there! I was wondering if you could help me here. I am creating my custom User Interface in Maya and so far so good but I can't figure out how to use MEL in order to toggle the UV Toolkit on or off. I would appreciate it so much if you could lend me a hand with getting the UV Toolkit to toggle because my head is about to explode. Thank you in advance for your time!
Message 5 of 6

Sometimes the most obvious is the answer.

I'm trying to figure out how to make the tab disappear completely rather than collapse but have not figured that out yet
Message 6 of 6
in reply to: rflannery

I was looking for a way of hiding the Tab completely and figured it out using the whatis statement as you had suggested so thank you.

workspaceControl -e -visible true UVToolkitDockControl
workspaceControl -e -visible false UVToolkitDockControl

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report