This command creates a named selectionConnection object. This object is simply a shared selection list. It may be used by editors to share their highlight data. For example, an outliner may attach its selected list to one of these objects, and a graph editor may use the same object as a list source. Then, the graph editor would only display objects that are selected in the outliner. Selection connections are UI objects which contain a list of model objects. Selection connections are useful for specifying which objects are to be displayed within a particular editor. Editor’s have three plug socketswhere a selection connection may be attached. They are: mainListConnectionan inputsocket which contains a list of objects that are to be displayed within the editorselectionConnectionan outputsocket which contains a list of objects that are selectedwithin the editorhighlightConnectionan inputsocket which contains a list of objects that are to be highlightedwithin the editorThere are several different types of selection connections that may be created. They include: activeLista selection connection which contains a list of everything in the model which is active (which includes geometry objects and keys)modelLista selection connection which contains a list of all the geometry (i.e. excluding keys) objects that are currently activekeyframeLista selection connection which contains a list of all the keys that are currently activeworldLista selection connection which contains a list of all the objects in the worldobjectLista selection connection which contains one model object (which may be a set)listLista selection connection which contains a list of selection connectionseditorLista selection connection which contains a list of objects that are attached to the mainListConnection of the specified editorsetLista selection connection which contains a list of all the sets in the worldcharacterLista selection connection which contains a list of all the characters in the worldhighlightLista selection connection which contains a list of objects to be highlighted in some fashionBelow is an example selectionConnection network between two editors. Editor 1 is setup to display objects on the activeList. Editor 2 is setup to display objects which are selected within Editor 1, and objects that are selected in Editor 2 are highlighted within Editor 1: – Editor 1– – Editor 2– inputList–| main | | |-| main | | | | sele |–| | | sele |–| |-| high | | | high | | | | ————- ————- | |————- fromEditor2 ————-| The following commands will establish this network: 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; Note: to delete a selection connectionuse the deleteUI commandNote: commands which expect objects may be given a selection connection instead, and the command will operate upon the objects wrapped by the selection connectionNote: the graph editor and the dope sheet are the only editors which can use the editor connection to the highlightConnection of another editorWARNING: some flag combinations may not behave as you expect. The command is really intended for internal use for managing the outliner used by the various editors.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
activeCacheList (atc) | bool | ||
|
|||
activeCharacterList (acl) | bool | ||
|
|||
activeList (act) | bool | ||
|
|||
addScript (addScript) | script | ||
|
|||
addTo (add) | unicode | ||
|
|||
characterList (cl) | bool | ||
|
|||
clear (clr) | bool | ||
|
|||
connectionList (lst) | bool | ||
|
|||
defineTemplate (dt) | unicode | ||
Puts a 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. |
|||
deselect (d) | PyNode | ||
|
|||
editor (ed) | unicode | ||
|
|||
exists (ex) | bool | ||
|
|||
filter (f) | unicode | ||
Optionally specifies an itemFilter for this connection. An empty string (“”) clears the current filter. If a filter is specified, all the information going into the selectionConnection must first pass through the filter before being accepted. NOTE: filters can only be attached to regular selectionConnections. They cannot be attached to any connection created using the -act, -mdl, -key, -wl, -sl, -cl, -lst, -obj, or -ren flags. We strongly recommend that you do not attach filters to a selectionConnection — it is better to attach your filter to the editor that is using the selectionConnection instead. |
|||
findObject (fo) | PyNode | ||
|
|||
g (g) | bool | ||
|
|||
highlightList (hl) | bool | ||
|
|||
identify (id) | bool | ||
Find out what type of selection connection this is. May be: activeList | modelList | keyframeList | worldList | objectList listList | editorList | connection | unknown |
|||
keyframeList (key) | bool | ||
|
|||
lock (lck) | bool | ||
|
|||
modelList (mdl) | bool | ||
|
|||
object (obj) | PyNode | ||
Specifies that this connection should wrap around the specified object (which may be a set). Query will return all the members of the selection connection (if the connection wraps a set, the set members will be returned) |
|||
parent (p) | unicode | ||
The name of a UI object this should be attached to. When the parent is destroyed, the selectionConnection will auto-delete. If no parent is specified, the connection is created in the current controlLayout. |
|||
remove (rm) | unicode | ||
|
|||
removeScript (rs) | script | ||
|
|||
select (s) | PyNode | ||
|
|||
setList (sl) | bool | ||
|
|||
switch (sw) | bool | ||
Acts as a modifier to -connectionList which sets the list of objects to be the first non-empty selection connection. selection connections are tested in the order in which they are added. |
|||
useTemplate (ut) | unicode | ||
|
|||
worldList (wl) | bool | ||
|
Derived from mel command maya.cmds.selectionConnection
Example:
import pymel.core as pm
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 = pm.window('window', wh=(400, 300))
pm.paneLayout( configuration='vertical2' )
# Result: ui.PaneLayout('window|paneLayout14') #
editor1 = pm.outlinerEditor()
editor2 = pm.outlinerEditor()
# Create the selection connection network.
#
inputList = pm.selectionConnection( activeList=True )
fromEditor1 = pm.selectionConnection()
fromEditor2 = pm.selectionConnection()
pm.editor( editor1, edit=True, mainListConnection=inputList )
# Result: u'window|paneLayout14|outlinerEditor2' #
pm.editor( editor1, edit=True, selectionConnection=fromEditor1 )
# Result: u'window|paneLayout14|outlinerEditor2' #
pm.editor( editor2, edit=True, mainListConnection=fromEditor1 )
# Result: u'window|paneLayout14|outlinerEditor3' #
pm.editor( editor2, edit=True, selectionConnection=fromEditor2 )
# Result: u'window|paneLayout14|outlinerEditor3' #
pm.showWindow( window )
# Create some objects and select them.
#
pm.sphere()
# Result: [nt.Transform(u'nurbsSphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.cone()
# Result: [nt.Transform(u'nurbsCone1'), nt.MakeNurbCone(u'makeNurbCone1')] #
pm.cylinder()
# Result: [nt.Transform(u'nurbsCylinder1'), nt.MakeNurbCylinder(u'makeNurbCylinder1')] #
pm.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
pm.selectionConnection( fromEditor1, e=True, addScript=addScriptCallback )
# Result: u'selectionConnection2' #
# Example 2.
#
# Create a selection connection for a paritcular object. Delete
# the selection connection and the object.
#
pm.sphere( name='sphere' )
# Result: [nt.Transform(u'sphere'), nt.MakeNurbSphere(u'makeNurbSphere2')] #
# Create a selection connection to wrap the sphere.
#
pm.selectionConnection( 'holder', object='sphere' )
# Result: u'holder' #
# Select the sphere using the selection connection.
#
pm.select( 'holder' )
# Delete the members (sphere) of the selection connection
#
pm.delete( 'holder' )
# Delete the selection connection (does not delete the members of
# the selection connection.
#
pm.deleteUI( 'holder' )
# Result: u'' #