Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

connectionInfo( string , [destinationFromSource=boolean], [getExactDestination=boolean], [getExactSource=boolean], [getLockedAncestor=boolean], [isDestination=boolean], [isExactDestination=boolean], [isExactSource=boolean], [isLocked=boolean], [isSource=boolean], [sourceFromDestination=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

connectionInfo is undoable, NOT queryable, and NOT editable.

The connectionInfo command is used to get information about connection sources and destinations. Unlike the isConnected command, this command needs only one end of the connection.

Return value

booleanWhen asking for a property, depending on the flags used.
stringWhen asking for a plug name.
string[]When asking for a list of plugs.

Related

connectAttr, isConnected, listConnections

Flags

destinationFromSource, getExactDestination, getExactSource, getLockedAncestor, isDestination, isExactDestination, isExactSource, isLocked, isSource, sourceFromDestination
Long name (short name) Argument types Properties
destinationFromSource(dfs) boolean create
If the specified plug (or its ancestor) is a source, this flag returns the list of destinations connected from the source. (array of strings, empty array if none)
getExactDestination(ged) boolean create
If the plug or its ancestor is connection destination, this returns the name of the plug that is the exact destination. (empty string if there is no such connection).
getExactSource(ges) boolean create
If the plug or its ancestor is a connection source, this returns the name of the plug that is the exact source. (empty string if there is no such connection).
getLockedAncestor(gla) boolean create
If the specified plug is locked, its name is returned. If an ancestor of the plug is locked, its name is returned. If more than one ancestor is locked, only the name of the closest one is returned. If neither this plug nor any ancestors are locked, an empty string is returned.
isDestination(id) boolean create
Returns true if the plug (or its ancestor) is the destination of a connection, false otherwise.
isExactDestination(ied) boolean create
Returns true if the plug is the exact destination of a connection, false otherwise.
isExactSource(ies) boolean create
Returns true if the plug is the exact source of a connection, false otherwise.
isLocked(il) boolean create
Returns true if this plug (or its ancestor) is locked
isSource(isSource) boolean create
Returns true if the plug (or its ancestor) is the source of a connection, false otherwise.
sourceFromDestination(sfd) boolean create
If the specified plug (or its ancestor) is a destination, this flag returns the source of the connection. (string, empty if none)

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

#    Create a sphere and a cone and make the Z translation of the cone
#    be dependent on the X translation of the sphere.
#
cone = cmds.cone()
sphere = cmds.sphere()
sphereTx = '%s.tx' % sphere[0]
coneTz = '%s.tz' % cone[0]
cmds.connectAttr(sphereTx, coneTz)

#    Verify the connection and print out the source plug.
#
if cmds.connectionInfo( coneTz, isDestination=True):
  print( 'Source: %s' % cmds.connectionInfo(coneTz,sourceFromDestination=True) )

#    Verify the connection and print out the destination plug.
#
if cmds.connectionInfo( sphereTx, isSource=True):
  destinations = cmds.connectionInfo(sphereTx, destinationFromSource=True)
  for destination in destinations:
    print destination