pymel.core.general.connectionInfo

static general.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 ../../../_images/create.gif
 
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 ../../../_images/create.gif
 

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 ../../../_images/create.gif
 
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 ../../../_images/create.gif
 

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 have multiple arguments, passed either as a tuple or a list.

isDestination (id) bool ../../../_images/create.gif
 
Returns true if the plug (or its ancestor) is the destination of a connection, false otherwise.
isExactDestination (ied) bool ../../../_images/create.gif
 
Returns true if the plug is the exact destination of a connection, false otherwise.
isExactSource (ies) bool ../../../_images/create.gif
 
Returns true if the plug is the exact source of a connection, false otherwise.
isLocked (il) bool ../../../_images/create.gif
 
Returns true if this plug (or its ancestor) is locked
isSource (isSource) bool ../../../_images/create.gif
 
Returns true if the plug (or its ancestor) is the source of a connection, false otherwise.
sourceFromDestination (sfd) bool ../../../_images/create.gif
 
If the specified plug (or its ancestor) is a destination, this flag returns the source of the connection. (string, empty if none)

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

Previous topic

pymel.core.general.connectAttr

Next topic

pymel.core.general.container

Core

Core Modules

Other Modules

This Page