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

Synopsis

panelHistory( [name] , [back=boolean], [clear=boolean], [defineTemplate=string], [exists=boolean], [forward=boolean], [historyDepth=int], [isEmpty=boolean], [suspend=boolean], [targetPane=string], [useTemplate=string], [wrap=boolean])

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

panelHistory is undoable, queryable, and editable.

This command creates a panel history object. The object is targeted on a particular paneLayout and thereafter notes changes in panel configurations within that paneLayout, building up a history list. The list can be stepped through backwards or forwards.

Return value

stringThe name of the panelHistory object created.

In query mode, return type is based on queried flag.

Flags

back, clear, defineTemplate, exists, forward, historyDepth, isEmpty, suspend, targetPane, useTemplate, wrap
Long name (short name) Argument types Properties
back(b) boolean edit
Go back one level on the history list.
clear(cl) boolean edit
Clear the history stack
defineTemplate(dt) string create
Puts the 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.
exists(ex) boolean create
Returns whether the specified object exists or not. Other flags are ignored.
forward(f) boolean edit
Go forward one level on the history list.
historyDepth(hd) int queryedit
Specifies how many levels of history are maintained.
isEmpty(ie) boolean query
Returns true if there is currently no panel history.
suspend(s) boolean edit
Specifies whether to suspend or resume updates to the panel history. Useful for chunking a number of changes into one history event.
targetPane(tp) string createquery
Specifies which paneLayout the history will be maintained for.
useTemplate(ut) string create
Force the command to use a command template other than the current one.
wrap(w) boolean queryedit
Specifies whether the history will wrap at the end and beginning. This value is true by default.

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.

Python examples

import maya.cmds as cmds

#    Create a window containing a pane layout.  The window also contains
#    an option menu for changing the layout configuration and two buttons
#    for stepping through the configuration history.
#
window = cmds.window( title='panelHistory Example' )
form = cmds.formLayout()

#    Create the option menu for panel configuration.
#
configuration = cmds.optionMenuGrp( label='Configuration', columnWidth2=( 100, 150 ) )

single = cmds.menuItem( label='Single' )
stacked = cmds.menuItem( label='2 Stacked' )
sideBySide = cmds.menuItem( label='2 Side by Side' )
four = cmds.menuItem( label='Four' )

#    Create the buttons for stepping through configuration history.
#
history = cmds.rowLayout( numberOfColumns=3 , columnWidth3=( 100, 75, 75 ),
						  columnAttach=[( 2, 'both', 0 ),( 3, 'both', 0 )] )
cmds.text( label='History' )
backBtn = cmds.button( label='Back' )
forwardBtn = cmds.button( label='Forward' )
cmds.setParent( '..' )

#    Create the pane layout.
#
frame = cmds.frameLayout( labelVisible=False )
panes = cmds.paneLayout()
cmds.text( label='Pane 1' )
cmds.text( label='Pane 2' )
cmds.text( label='Pane 3' )
cmds.text( label='Pane 4' )

#    Set up the attachments.
#
cmds.formLayout( form, edit=True,
				 attachForm=[(configuration, 'top', 5),
							 (configuration, 'left', 5),
							 (history, 'left', 5),
							 (history, 'right', 5),
							 (frame, 'left', 5),
							 (frame, 'right', 5),
							 (frame, 'bottom', 5)],
				 attachControl=[(history, 'top', 5, configuration),
								(frame, 'top', 5, history)] )

#    Create the panel history object.
#
panelHistory = cmds.panelHistory(targetPane=panes)

#    Attach a command to the option menu to change the panel layout
#    configuration accordingly.
#
cmds.optionMenuGrp( configuration,
					edit=True,
					changeCommand=('ExampleUpdatePaneLayout( \"'+ configuration + '\", \"' + panes + '\" )') )

#    Attach commands to the buttons for stepping through the configuration
#    history.  The commands should also update the value of the option menu.
#
cmds.button( backBtn, edit=True,
			 command='cmds.panelHistory( panelHistory, edit=True, back=True ); ExampleUpdateConfiguration( \"' + configuration + '\", \"' + panes + '\" )' )
cmds.button( forwardBtn, edit=True,
			 command='cmds.panelHistory( panelHistory, edit=True, forward=True ); ExampleUpdateConfiguration( \"' + configuration + '\", \"' + panes + '\" )' )

cmds.showWindow( window )

#    Call this procedure whenever the option menu's configuration value
#    changes.  This procedure will update the configuration of the
#    pane layout to reflect the change.
#
def ExampleUpdatePaneLayout( optionMenuGrp, paneLayout ):
	if optionMenuGrp == "" or paneLayout == "":
		return

	value = cmds.optionMenuGrp( optionMenuGrp, query=True, value=True )
	if value == "Single":
		cmds.paneLayout( paneLayout, edit=True, configuration='single' )
	elif value == "2 Stacked":
		cmds.paneLayout( paneLayout, edit=True, configuration='horizontal2' )
	elif value == "2 Side by Side":
		cmds.paneLayout( paneLayout, edit=True, configuration='vertical2' )
	elif value == "Four":
		cmds.paneLayout( paneLayout, edit=True, configuration='quad' )

#    Call this procedure whenever the panel configuration changes due to
#    stepping through the panel history (ie. pressing either the "Forward"
#    or "Back" buttons.  This procedure will update the value of the
#    option menu to reflect the new pane layout configuration.
#
def ExampleUpdateConfiguration( optionMenuGrp, paneLayout ):
	if optionMenuGrp == "" or paneLayout == "":
		return

	configuration = cmds.paneLayout( paneLayout, query=True, configuration=True );

	if configuration == 'single':
		cmds.optionMenuGrp( optionMenuGrp, edit=True, value='Single' )
	elif configuration == 'horizontal2':
		cmds.optionMenuGrp( optionMenuGrp, edit=True, value='2 Stacked' )
	elif configuration == 'vertical2':
		cmds.optionMenuGrp( optionMenuGrp, edit=True, value='2 Side by Side' )
	elif configuration == 'quad':
		cmds.optionMenuGrp( optionMenuGrp, edit=True, value='Four' )