Go to: Synopsis. Flags. Return value. Python examples.

Synopsis

modelPanel( panelName , [camera=string], [control=boolean], [copy=string], [defineTemplate=string], [docTag=string], [edit=boolean], [exists=boolean], [init=boolean], [isUnique=boolean], [label=string], [menuBarVisible=boolean], [modelEditor=boolean], [needsInit=boolean], [parent=string], [popupMenuProcedure=string], [query=boolean], [replacePanel=string], [tearOff=boolean], [tearOffCopy=string], [unParent=boolean], [useTemplate=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

modelPanel is undoable, queryable, and editable.

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

Flags

camera, control, copy, defineTemplate, docTag, edit, exists, init, isUnique, label, menuBarVisible, modelEditor, needsInit, parent, popupMenuProcedure, query, replacePanel, tearOff, tearOffCopy, unParent, useTemplate
Long name (short name) [argument types] Properties
query(q) boolean query
Puts the command in query mode so that it will return the value of the specified flag.

In query mode, this flag needs a value.

edit(e) boolean edit
Puts the command in edit mode so that it will change the values of the specified flags
exists(ex) boolean create
Returns true|false depending upon whether the specified object exists. Other flags are ignored.
defineTemplate(dt) string create
Puts a command in a mode where any other flags and args 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.
useTemplate(ut) string create
Will force the command to use a command template other than the current one.
init(init) boolean createedit
Initializes the panel's default state. This is usually done automatically on file -new and file -open.
label(l) string queryedit
Specifies the user readable label for the panel.

In query mode, this flag needs a value.

copy(cp) string edit
Makes this panel a copy of the specified panel. Both panels must be of the same type.
control(ctl) boolean query
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.

In query mode, this flag needs a value.

isUnique(iu) boolean query
Returns true if only one instance of this panel type is allowed.

In query mode, this flag needs a value.

parent(p) string create
Specifies the parent layout for this panel.
popupMenuProcedure(pmp) string queryedit
Specifies the procedure called for building the panel's popup menu(s). The default value is "buildPanelPopupMenu".

In query mode, this flag needs a value.

unParent(up) boolean edit
Specifies that the panel should be removed from its layout. This (obviously) cannot be used with query.
replacePanel(rp) string edit
Will replace the specifed panel with this panel. If the target panel is within the same layout it will perform a swap.
tearOff(to) boolean queryedit
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.

In query mode, this flag needs a value.

tearOffCopy(toc) string create
Will create this panel as a torn of copy of the specified source panel.
menuBarVisible(mbv) boolean createqueryedit
Controls whether the menu bar for the panel is displayed.

In query mode, this flag needs a value.

needsInit(ni) boolean queryedit
(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.

In query mode, this flag needs a value.

docTag(dt) string createqueryedit
Attaches a tag to the maya panel.

In query mode, this flag needs a value.

modelEditor(me) boolean query
This flag returns the name of the model editor contained by the panel.

In query mode, this flag needs a value.

camera(cam) string queryedit
Query or edit the camera in a modelPanel.

In query mode, this flag needs a value.


Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Return value


The name of the panel on creation, or the queried result.

Python examples

import maya.cmds as cmds

#    Example 1.
#
#    Create a model panel in a separate window.
#
window = cmds.window()
cmds.paneLayout()
cmds.modelPanel()
cmds.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 = cmds.getPanel( withLabel='Persp View')
frontPanel = cmds.getPanel( withLabel='Front View')
cmds.modelPanel( perspPanel, edit=True, replacePanel=frontPanel )