pymel.core.windows.modelPanel

modelPanel(*args, **kwargs)

This command creates a panel consisting of a model editor. See the modelEditorcommand documentation for more information.

Flags:

Long Name / Short Name Argument Types Properties
addTab / at unicode ../../../_images/edit.gif
  Add a new panel of the named UI type into a modelPanel.
barLayout / bl bool ../../../_images/query.gif
  This flag returns the name of the layout which is the parent of the panels icon bar.
camera / cam unicode ../../../_images/query.gif ../../../_images/edit.gif
  Query or edit the camera in a modelPanel.
control / ctl bool ../../../_images/query.gif
  Returns the top level control for this panel. Usually used for getting a parent to attach popup menus. CAUTION: panels may not have controls at times. This flag can return if no control is present.
copy / cp unicode ../../../_images/edit.gif
  Makes this panel a copy of the specified panel. Both panels must be of the same type.
createString / cs bool ../../../_images/edit.gif
  Command string used to create a panel
defineTemplate / dt unicode ../../../_images/create.gif
  Puts the command in a mode where any other flags and arguments are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template.
docTag / dtg unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Attaches a tag to the Maya panel.
editString / es bool ../../../_images/edit.gif
  Command string used to edit a panel
exists / ex bool ../../../_images/create.gif
  Returns whether the specified object exists or not. Other flags are ignored.
init / init bool ../../../_images/create.gif ../../../_images/edit.gif
  Initializes the panel’s default state. This is usually done automatically on file -new and file -open.
isUnique / iu bool ../../../_images/query.gif
  Returns true if only one instance of this panel type is allowed.
label / l unicode ../../../_images/query.gif ../../../_images/edit.gif
  Specifies the user readable label for the panel.
menuBarRepeatLast / mrl bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Controls whether clicking on the menu header with the middle mouse button would repeat the last selected menu item.
menuBarVisible / mbv bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Controls whether the menu bar for the panel is displayed.
modelEditor / me bool ../../../_images/query.gif
  This flag returns the name of the model editor contained by the panel.
needsInit / ni bool ../../../_images/query.gif ../../../_images/edit.gif
  (Internal) On Edit will mark the panel as requiring initialization. Query will return whether the panel is marked for initialization. Used during file -new and file -open.
parent / p unicode ../../../_images/create.gif
  Specifies the parent layout for this panel.
popupMenuProcedure / pmp script ../../../_images/query.gif ../../../_images/edit.gif
  Specifies the procedure called for building the panel’s popup menu(s). The default value is buildPanelPopupMenu. The procedure should take one string argument which is the panel’s name.
removeTab / rt unicode ../../../_images/edit.gif
  Remove a new panel of the named UI type from a modelPanel.
replacePanel / rp unicode ../../../_images/edit.gif
  Will replace the specified panel with this panel. If the target panel is within the same layout it will perform a swap.
selectTab / st unicode ../../../_images/query.gif ../../../_images/edit.gif
  Query or edit the current active tabbed panel in a modelPanel.
tabCommand / tc unicode ../../../_images/edit.gif
  Pass a command string to the tabbed panel callback function.
tearOff / to bool ../../../_images/query.gif ../../../_images/edit.gif
  Will tear off this panel into a separate window with a paneLayout as the parent of the panel. When queried this flag will return if the panel has been torn off into its own window.
tearOffCopy / toc unicode ../../../_images/create.gif
  Will create this panel as a torn of copy of the specified source panel.
tearOffRestore / tor bool ../../../_images/create.gif ../../../_images/edit.gif
  Restores panel if it is torn off and focus is given to it. If docked, becomes the active panel in the docked window. This should be the default flag that is added to all panels instead of -to/-tearOffflag which should only be used to tear off the panel.
unParent / up bool ../../../_images/edit.gif
  Specifies that the panel should be removed from its layout. This (obviously) cannot be used with query.
useTemplate / ut unicode ../../../_images/create.gif
  Forces the command to use a command template other than the current one. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.modelPanel

Example:

import pymel.core as pm

#    Example 1.
#
#    Create a model panel in a separate window.
#
window = pm.window()
pm.paneLayout()
# Result: ui.PaneLayout('window1|paneLayout8') #
pm.modelPanel()
# Result: ui.ModelPanel('modelPanel5') #
pm.showWindow( window )

#    Example 2.
#
#    Set the panel configuration to show all 4 model views.
#    Then swap the Perspective View and Front View panels.
#

# Since setNamePanelLayout is a MEL procedures, we need to call through MEL
import maya.mel
maya.mel.eval('setNamedPanelLayout("Four View")')
perspPanel = pm.getPanel( withLabel='Persp View')
frontPanel = pm.getPanel( withLabel='Front View')
pm.modelPanel( perspPanel, edit=True, replacePanel=frontPanel )