ジャンプ先: 概要. 戻り値. フラグ. Python 例.

概要

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

注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。

panelHistory は、取り消し可能、照会可能、および編集可能です。

パネル ヒストリ オブジェクトが作成されます。特定 paneLayout のオブジェクトが対象となり、その paneLayout 内のビュー構成の変更でヒストリ リストが作成されます。リストでは、前後に移動できます。

戻り値

string作成された panelHistory の名前。

照会モードでは、戻り値のタイプは照会されたフラグに基づきます。

フラグ

back, clear, defineTemplate, exists, forward, historyDepth, isEmpty, suspend, targetPane, useTemplate, wrap
ロング ネーム(ショート ネーム) 引数タイプ プロパティ
back(b) boolean edit
ヒストリ リストで 1 レベル戻ります。
clear(cl) boolean edit
ヒストリ スタックをクリアします。
defineTemplate(dt) string create
他の任意のフラグと引数を解析し、かつ引数で指定したコマンド テンプレートに追加するモードに、コマンドのモードを変更します。 templateName が現在のテンプレートとして設定されていれば、その後コマンドが実行されるたびに、この引数が既定の引数として使用されます。
exists(ex) boolean create
指定したオブジェクトが存在するかどうかを返します。他のフラグは無視されます。
forward(f) boolean edit
ヒストリ リストで 1 レベル進みます。
historyDepth(hd) int queryedit
維持するヒストリのレベル数を指定します。
isEmpty(ie) boolean query
パネル ヒストリが現在存在しない場合に true を返します。
suspend(s) boolean edit
パネル ヒストリの更新を停止するか再開するかを指定します。多数の変更を 1 つのヒストリ イベントにまとめる場合に便利です。
targetPane(tp) string createquery
ヒストリを維持する paneLayout を指定します。
useTemplate(ut) string create
コマンドに、現在のものとは異なるコマンド テンプレートを使用するように強制します。
wrap(w) boolean queryedit
ヒストリを末尾と先頭で折り返すかどうかを指定します。この値は既定で true になっています。

フラグはコマンドの作成モードで表示できます フラグはコマンドの編集モードで表示できます
フラグはコマンドの照会モードで表示できます フラグに複数の引数を指定し、タプルまたはリストとして渡すことができます。

Python 例

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' )