移動先: 概要 戻り値 フラグ. Python 例.

概要

windowPref( string , [exists=boolean], [height=int], [leftEdge=int], [loadAll=boolean], [parentMain=boolean], [remove=boolean], [removeAll=boolean], [saveAll=boolean], [topEdge=int], [topLeftCorner=[int, int]], [width=int], [widthHeight=[int, int]])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

windowPref は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。

ウィンドウのアトリビュートを生成、修正します。ウィンドウのサイズや位置は、アプリケーションのセッションが変わっても維持されます。デフォルトのウィンドウ プリファレンスは、ウィンドウを閉じたときに作成されます。ウィンドウのプリファレンスを指定する必要があります。したがって、その名前に一致するウィンドウにしか影響を及ぼしません。

ウィンドウのプリファレンスは、Maya メイン ウィンドウにも、コマンド ウィンドウにも適用されないことに注意してください。

戻り値

なし

戻り値の型は照会モードでは照会フラグが基になります。

フラグ

exists, height, leftEdge, loadAll, parentMain, remove, removeAll, saveAll, topEdge, topLeftCorner, width, widthHeight
ロング ネーム(ショート ネーム) 引数型 プロパティ
exists(ex) boolean create
指定したオブジェクトが存在するかどうかによって、 true または false を返します。他のフラグは無視されます。
topEdge(te) int createqueryedit
ウィンドウの上端の位置を指定します。
leftEdge(le) int createqueryedit
ウィンドウの左端の位置を指定します。
topLeftCorner(tlc) [int, int] createqueryedit
ウィンドウの上端と左端の位置を指定します。
width(w) int createqueryedit
ウィンドウの幅を指定します。
height(h) int createqueryedit
ウィンドウの高さを指定します。
widthHeight(wh) [int, int] createqueryedit
ウィンドウの幅と高さを指定します。
parentMain(pm) boolean createquery
ウィンドウがメイン アプリケーション ウィンドウの親になるかどうかを指定します。Windows のみ。-enableAll boolean すべてのウィンドウのプリファレンスを有効または無効にします。デフォルトでは、プリファレンスは有効です。このフラグを無効にすると、ウィンドウではすべてのプリファレンスが無視されます。
remove(r) boolean create
1 つのウィンドウ プリファレンスを消去します。
removeAll(ra) boolean create
すべてのウィンドウ プリファレンスを消去します。
saveAll(sa) boolean create
ウィンドウのアトリビュートをファイルに書き出します。
loadAll(la) boolean create
ディスクからウィンドウ アトリビュートのファイルを読み込みます。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

import maya.cmds as cmds

#    Check if the window exists.
#
if cmds.window('ExampleWindow', exists=True):
	cmds.deleteUI('ExampleWindow', window=True)

#    Create a window.
#
cmds.window( 'ExampleWindow' )
cmds.columnLayout()
cmds.text( label='Size and position the window before closing it.' )
cmds.button( label='Close', command='cmds.deleteUI("ExampleWindow", window=True)' )
cmds.showWindow( 'ExampleWindow' )

#    When the window is closed a window preference object is
#    created for the window. It has the same name as the window
#    object.
#
cmds.windowPref( 'ExampleWindow', exists=True )

#    Query the window preference size and position.
#
cmds.windowPref( 'ExampleWindow', query=True, topLeftCorner=True )
cmds.windowPref( 'ExampleWindow', query=True, widthHeight=True )

#    Create a window with the same name. When it is shown
#    it will be sized and positioned according to the
#    window preference.
#
if cmds.window('ExampleWindow', exists=True):
	cmds.deleteUI('ExampleWindow', window=True)

cmds.window( 'ExampleWindow' )
cmds.columnLayout()
cmds.text( label='Size and position the window before closing it.' )
cmds.button( label='Close', command='cmds.deleteUI("ExampleWindow", window=True)' )
cmds.showWindow( 'ExampleWindow' )

#    Delete the window preference and the window will have a
#    default size and position.
#
cmds.windowPref( 'ExampleWindow', remove=True )

#    Create the window one last time.
#
if cmds.window('ExampleWindow', exists=True):
	cmds.deleteUI('ExampleWindow', window=True)

cmds.window( 'ExampleWindow' )
cmds.columnLayout()
cmds.text( label='Size and position the window before closing it.' )
cmds.button( label='Close', command='cmds.deleteUI("ExampleWindow", window=True)' )
cmds.showWindow( 'ExampleWindow' )