Vincent Touache - Character TD
/tutos/21_maya_trick_toolbar/content.php
data=================:ArrayMaya trick - hide viewport toolbar

Table of Contents

  1. Maya trick - hide a viewport toolbar
  2. Investigation
  3. Result



Maya trick - hide a viewport toolbar

I faced a problem at work, where I had to hide the toolbar of a specific modelPanel, but couldn't find the right flag to do it. The modelPanel command offers some useful flags, such as menuBarVisible to hide the menu itself, but nothing for the pesky icons right below.

Investigation

Knowing the shortcut to do it is Ctrl+Shift+m, I checked in the hotkey manager what that sequence was triggering. The command name is ToggleModelEditorBars. If you want to hide the toolBar on every modelEditor currently visible, you can just convert that mel command into a python command with cmds.ToggleModelEditorBars().

With that in mind, and since I needed to do it only on a specific modelPanel, I searched for that on my computer using Everything (if you are doomed to work on Windows, I couldn't recommand enough Everything, it lets you search for everything on your hard drive). I found C:\...\Autodesk\Maya2022-x64\scripts\others\toggleModelEditorBarsInAllPanels.mel from which I copied the mel snippet to do it in one modelPanel only, converted it to python and put it in the picker gui

Result


  your_panel = 'hodor'
  frame_layout = cmds.modelPanel(your_panel, query=True, barLayout=True)
  if frame_layout and \
      cmds.frameLayout(frame_layout, query=True, exists=True):
      cmds.frameLayout(frame_layout, edit=True, collapse=True)