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

概要

workspaceControlState( string , [defaultTopLeftCorner=[int, int]], [defaultWidthHeight=[int, int]], [exists=boolean], [height=int], [leftEdge=int], [maximized=boolean], [remove=boolean], [topEdge=int], [topLeftCorner=[int, int]], [width=int], [widthHeight=[int, int]])

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

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

ワークスペース コントロールの希望するウィンドウ アトリビュートを作成または修正します。ワークスペース コントロールのサイズや位置は、アプリケーション セッション中は保持されます(ただし、位置はフローティング ワークスペース ドッキング パネルに単独で存在するワークスペース コントロールのみに適用されます)。ワークスペース コントロールを閉じると、既定のワークスペース コントロールの状態が作成されます。ワークスペース コントロールの状態に名前を付ける必要があり、その後は一致する名前を持つワークスペース コントロールのみに影響します。

戻り値

なし

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

フラグ

defaultTopLeftCorner, defaultWidthHeight, exists, height, leftEdge, maximized, remove, topEdge, topLeftCorner, width, widthHeight
ロング ネーム(ショート ネーム) 引数タイプ プロパティ
defaultTopLeftCorner(dc) [int, int] createqueryedit
サイズと位置の記憶(Remember size and position)がオフの場合に、このパネルを最初に開いたときのウィンドウの上端と左端の位置です。値は、編集時には DPI スケーリングされますが、照会中はスケーリングされないで返されます。この値は、既定の幅と高さも有効である場合のみ使用されます。
defaultWidthHeight(dwh) [int, int] createqueryedit
サイズと位置の記憶(Remember size and position)がオフの場合に、このパネルを最初に開いたときのウィンドウの幅と高さです。値は、編集時には DPI スケーリングされますが、照会中はスケーリングされないで返されます。この場合に使用される位置は defaultTopLeftCorner です。
exists(ex) boolean create
指定したオブジェクトが存在するかどうかによって、true または false を返します。他のフラグは無視されます。
height(h) int createqueryedit
ウィンドウの高さを指定します。
leftEdge(le) int createqueryedit
ウィンドウの左端の位置を指定します。
maximized(max) boolean createqueryedit
ウィンドウを最大化します。
remove(r) boolean create
1 つのウィンドウ プリファレンスを除去します。
topEdge(te) int createqueryedit
ウィンドウの上端の位置を指定します。
topLeftCorner(tlc) [int, int] createqueryedit
ウィンドウの上端と左端の位置を指定します。
width(w) int createqueryedit
ウィンドウの幅を指定します。
widthHeight(wh) [int, int] createqueryedit
ウィンドウの幅と高さを指定します。

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

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.workspaceControlState( 'ExampleWindow', exists=True )

#    Query the window preference size and position.
#
cmds.workspaceControlState( 'ExampleWindow', query=True, topLeftCorner=True )
cmds.workspaceControlState( '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.workspaceControlState( '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' )