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

Synopsis

connectionInfo [-destinationFromSource] [-getExactDestination] [-getExactSource] [-getLockedAncestor] [-isDestination] [-isExactDestination] [-isExactSource] [-isLocked] [-isSource] [-sourceFromDestination] string

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) 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) 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) 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) 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) create
Returns true if the plug (or its ancestor) is the destination of a connection, false otherwise.
-isExactDestination(-ied) create
Returns true if the plug is the exact destination of a connection, false otherwise.
-isExactSource(-ies) create
Returns true if the plug is the exact source of a connection, false otherwise.
-isLocked(-il) create
Returns true if this plug (or its ancestor) is locked
-isSource(-is) create
Returns true if the plug (or its ancestor) is the source of a connection, false otherwise.
-sourceFromDestination(-sfd) 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 be used more than once in a command.

MEL examples

//    Create a sphere and a cone and make the Z translation of the cone
//    be dependent on the X translation of the sphere.
//
string $cone[] = `cone`;
string $sphere[] = `sphere`;
connectAttr ($sphere[0] + ".tx") ($cone[0] + ".tz");

//    Verify the connection and print out the source plug.
//
if (`connectionInfo -isDestination ($cone[0] + ".tz")`) {
    print ("Source: "
        + `connectionInfo -sourceFromDestination ($cone[0] + ".tz")`
        + "\n");
}

//    Verify the connection and print out the destination plug.
//
if (`connectionInfo -isSource ($sphere[0] + ".tx")`) {
    string $destinations[];
    $destinations = `connectionInfo -destinationFromSource ($sphere[0] + ".tx")`;
    print ("Destination: ");
    for ($destination in $destinations) {
        print ($destination + " ");
    }
    print ("\n");
}