移動先: 概要 戻り値 フラグ. Python 例.
selectionConnection(
string
, [activeCacheList=boolean], [activeCharacterList=boolean], [activeList=boolean], [addScript=script], [addTo=string], [characterList=boolean], [clear=boolean], [connectionList=boolean], [defineTemplate=string], [deselect=name], [editor=string], [exists=boolean], [filter=string], [findObject=name], [g=boolean], [highlightList=boolean], [identify=boolean], [keyframeList=boolean], [lock=boolean], [modelList=boolean], [object=name], [parent=string], [remove=string], [removeScript=script], [select=name], [setList=boolean], [switch=boolean], [useTemplate=string], [worldList=boolean])
注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。
selectionConnection は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。
このコマンドは、指定した名前の selectionConnection オブジェクトを作成します。このオブジェクトは、単に共有されているセレクション リストにすぎません。このリストは、ハイライト データを共有するために複数のエディタによって使用する場合があります。たとえば、選択したリストをアウトライナ(Outliner)がこれらのいずれかのオブジェクトにアタッチし、グラフ エディタ(Graph Editor)がその同じオブジェクトをリスト ソースとして使用する場合があります。グラフ エディタには、アウトライナで選択したオブジェクトのみが表示されます。
selectionConnection は、モデル オブジェクトのリストを含む UI オブジェクトです。selectionConnection は、特定のエディタに表示させるオブジェクトを指定するために便利です。エディタには、selectionConnection をアタッチできる 3 つのプラグ ソケットがあります。
それらは次のとおりです。
- mainListConnection
- エディタ内に表示されるオブジェクトのリストを含む入力ソケット
- selectionConnection
- エディタ内で選択されたオブジェクトのリストを含む出力ソケット
- highlightConnection
- エディタ内でハイライトされるオブジェクトのリストを含む入力ソケット
作成されるセレクション コネクションには数種類あります。それらは次のとおりです。
- activeList
- モデルに含まれるすべてのアクティブ項目(ジオメトリ オブジェクトやキーを含む)のリストを含むセレクション コネクション
- modelList
- 現在アクティブなすべてのジオメトリ(つまり、キーを除く)オブジェクトのリストを含むセレクション コネクション
- keyframeList
- 現在アクティブなすべてのキーのリストを含むセレクション コネクション
- worldList
- ワールド内にあるすべてのオブジェクトのリストを含むセレクション コネクション
- objectList
- 単一のモデル オブジェクト(セットの場合もある)を含むセレクション コネクション
- listList
- セレクション コネクションのリストを含むセレクション コネクション
- editorList
- 指定したエディタの mainListConnection にアタッチされたオブジェクトのリストを含むセレクション コネクション
- setList
- ワールド内にあるすべてのセットのリストを含むセレクション コネクション
- characterList
- ワールド内にあるすべてのオブジェクトのキャラクタを含むセレクション コネクション
- highlightList
- 何らかの方法でハイライトされるオブジェクトのリストを含むセレクション コネクション
以下は 2 つのエディタでの selectionConnection ネットワークの例です。Editor 1 は、activeList のオブジェクトを表示するようにセットアップされています。Editor 2 は、Editor 1 で選択したオブジェクトを表示するようにセットアップされています。Editor 2 で選択したオブジェクトは Editor 1 でハイライトされます。
-- Editor 1-- -- Editor 2--
inputList-->| main | | |->| main | |
| | sele |--| | | sele |--|
|->| high | | | high | | |
| ------------- ------------- |
|------------- fromEditor2 -------------|
このネットワークは、次のコマンドによって確立されます。
selectionConnection -activeList inputList;
selectionConnection fromEditor1;
selectionConnection fromEditor2;
editor -edit -mainListConnection inputList Editor1;
editor -edit -selectionConnection fromEditor1 Editor1;
editor -edit -mainListConnection fromEditor1 Editor2;
editor -edit -selectionConnection fromEditor2 Editor2;
editor -edit -highlightConnection fromEditor2 Editor1;
注: selectionConnection を削除する場合は、deleteUI コマンドを使用します。
注: オブジェクトを要求するコマンドに selectionConnection を付与できます。この場合、コマンドは selectionConnection でラップされたオブジェクトに基づいて動作します。
注: 別のエディタの highlightConnection に対してエディタ コネクションを使用できるエディタはグラフ エディタ(Graph Editor)とドープシート(Dope Sheet)だけです。
警告: いくつかのフラグを組み合わせると、予想通りに動作しない場合があります。このコマンドは、実際には、各種エディタによって使用されるアウトライナ(Outliner)を管理するための内部使用を目的としたものです。
戻り値の型は照会モードでは照会フラグが基になります。
activeCacheList, activeCharacterList, activeList, addScript, addTo, characterList, clear, connectionList, defineTemplate, deselect, editor, exists, filter, findObject, g, highlightList, identify, keyframeList, lock, modelList, object, parent, remove, removeScript, select, setList, switch, useTemplate, worldList
: コマンドの作成モードで使用可能なフラグ
|
: コマンドの編集モードで使用可能なフラグ
|
: コマンドの照会モードで使用可能なフラグ
|
: タプルまたはリストとして渡された複数の引数を持てるフラグ
|
import maya.cmds as cmds
# Example 1.
#
# Create a window with two Outliner editors and a
# selection connection network. Editor 1 will display the
# current scene's active list. Editor 2 will display the items
# selected in Editor 1.
#
window = cmds.window('window', wh=(400, 300))
cmds.paneLayout( configuration='vertical2' )
editor1 = cmds.outlinerEditor()
editor2 = cmds.outlinerEditor()
# Create the selection connection network.
#
inputList = cmds.selectionConnection( activeList=True )
fromEditor1 = cmds.selectionConnection()
fromEditor2 = cmds.selectionConnection()
cmds.editor( editor1, edit=True, mainListConnection=inputList )
cmds.editor( editor1, edit=True, selectionConnection=fromEditor1 )
cmds.editor( editor2, edit=True, mainListConnection=fromEditor1 )
cmds.editor( editor2, edit=True, selectionConnection=fromEditor2 )
cmds.showWindow( window )
# Create some objects and select them.
#
cmds.sphere()
cmds.cone()
cmds.cylinder()
cmds.select( all=True )
# Now as you select objects on the left side, they will be
# displayed on the right side. You can also add a callback
# script to do further processing on the list when objects
# are added. (Use -removeScript for when objects are removed.)
def addScriptCallback( array ):
print "Contents of callback array: %s\n" % array
cmds.selectionConnection( fromEditor1, e=True, addScript=addScriptCallback )
# Example 2.
#
# Create a selection connection for a paritcular object. Delete
# the selection connection and the object.
#
cmds.sphere( name='sphere' )
# Create a selection connection to wrap the sphere.
#
cmds.selectionConnection( 'holder', object='sphere' )
# Select the sphere using the selection connection.
#
cmds.select( 'holder' )
# Delete the members (sphere) of the selection connection
#
cmds.delete( 'holder' )
# Delete the selection connection (does not delete the members of
# the selection connection.
#
cmds.deleteUI( 'holder' )