Go to: Synopsis. Return value. Related.
Flags. Python
examples.
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.
boolean |
When asking for a property, depending on the flags used. |
string |
When asking for a plug name. |
string[] |
When asking for a list of plugs. |
connectAttr, isConnected, listConnections
destinationFromSource,
getExactDestination,
getExactSource, getLockedAncestor, isDestination, isExactDestination, isExactSource, isLocked, isSource,
sourceFromDestination
Long name (short name) |
Argument types |
Properties |
isSource(isSource) |
boolean |
|
|
Returns true if the plug (or its ancestor) is the source of a
connection, false otherwise. |
|
isDestination(id) |
boolean |
|
|
Returns true if the plug (or its ancestor) is the destination
of a connection, false otherwise. |
|
isExactSource(ies) |
boolean |
|
|
Returns true if the plug is the exact source of a connection,
false otherwise. |
|
isExactDestination(ied) |
boolean |
|
|
Returns true if the plug is the exact destination of a
connection, false otherwise. |
|
getExactSource(ges) |
boolean |
|
|
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). |
|
getExactDestination(ged) |
boolean |
|
|
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). |
|
destinationFromSource(dfs) |
boolean |
|
|
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) |
|
sourceFromDestination(sfd) |
boolean |
|
|
If the specified plug (or its ancestor) is a destination, this
flag returns the source of the connection. (string, empty if
none) |
|
isLocked(il) |
boolean |
|
|
Returns true if this plug (or its ancestor) is locked |
|
getLockedAncestor(gla) |
boolean |
|
|
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. |
|
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. |
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