The connectionInfocommand is used to get information about connection sources and destinations. Unlike the isConnected command, this command needs only one end of the connection.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
destinationFromSource (dfs) | bool | ||
|
|||
getExactDestination (ged) | bool | ||
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) | bool | ||
|
|||
getLockedAncestor (gla) | bool | ||
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 commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
isDestination (id) | bool | ||
|
|||
isExactDestination (ied) | bool | ||
|
|||
isExactSource (ies) | bool | ||
|
|||
isLocked (il) | bool | ||
|
|||
isSource (isSource) | bool | ||
|
|||
sourceFromDestination (sfd) | bool | ||
|
Derived from mel command maya.cmds.connectionInfo
Example:
import pymel.core as pm
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 = pm.cone()
sphere = pm.sphere()
sphereTx = '%s.tx' % sphere[0]
coneTz = '%s.tz' % cone[0]
pm.connectAttr(sphereTx, coneTz)
# Verify the connection and print out the source plug.
#
if pm.connectionInfo( coneTz, isDestination=True):
print( 'Source: %s' % pm.connectionInfo(coneTz,sourceFromDestination=True) )
# Verify the connection and print out the destination plug.
#
if pm.connectionInfo( sphereTx, isSource=True):
destinations = pm.connectionInfo(sphereTx, destinationFromSource=True)
for destination in destinations:
print destination