pymel.core.general.connectionInfo¶
- connectionInfo(*args, **kwargs)¶
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.
Flags:
Long Name / Short Name Argument Types Properties destinationFromSource / dfs bool 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 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 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 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. isDestination / id bool Returns true if the plug (or its ancestor) is the destination of a connection, false otherwise. isExactDestination / ied bool Returns true if the plug is the exact destination of a connection, false otherwise. isExactSource / ies bool Returns true if the plug is the exact source of a connection, false otherwise. isLocked / il bool Returns true if this plug (or its ancestor) is locked isSource / isSource bool Returns true if the plug (or its ancestor) is the source of a connection, false otherwise. sourceFromDestination / sfd bool If the specified plug (or its ancestor) is a destination, this flag returns the source of the connection. (string, empty if none) Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.connectionInfo
Example:
import pymel.core as pm # 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