How can I check if an objects attributes are connected?

Jul 6 2008

animationpython

Quick Answer:

from pymel import *



# Is the object.attr a source of a connection?
len(object.tx.inputs()) > 0
# Is the object.attr the destination of a connection?
len(object.tx.outputs()) > 0
# List an object.attr's source connection, meaning, list the input connection.  
# This will return a single object.attr.
object.tx.inputs()
# List an object.attr's destination connection, meaning, list the all output connections:
# This could return multiple object.attrs.
object.tx.outputs()
# In other words, you can just use inputs() and outputs() to get if there is a connection 
# (source or destination), how many connections there are, and what they are!

The following is the quotation of post from mel wiki.

Only requires a single object.attr.

// Is the object.attr a source of a connection?

connectionInfo -is object.tx;



// Is the object.attr the destination of a connection?

connectionInfo -id object.tx;



// List an object.attr's source connection, meaning, list the input connection.  
// This will return a single object.attr.

connectionInfo -sfd object.tx



// List an object.attr's destination connection, meaning, list the all output connections:

// This could return multiple object.attrs.

connectionInfo -dfs object.tx;
comments powered by Disqus