How to find out if there is any incoming connection or not for attribute (eg :- translateX),
if there is connection to (translate X).
result = 1.
if there is no connection to (translate X).
result = 0.
anybody plzzz help me…
How to find out if there is any incoming connection or not for attribute (eg :- translateX),
if there is connection to (translate X).
result = 1.
if there is no connection to (translate X).
result = 0.
anybody plzzz help me…
There’s a command called “listConnections” to deal with this.
import maya.cmds as cmds
result=0
if cmds.listConnections("someNode.tx",d=0):
result=1
#Or on a single line:
result= 1 if cmds.listConnections("someNode.tx",d=0,s=1) else 0
Generally, if you want to figure out what commands to use, it’s good to peruse the docs, as well as some scripts that others have released. You’ll be able to figure out yourself what kinds of commands you can use and how (unless it’s something obscure).
I don’t mean to be a dick, but did you actually take a look at the docs? Did you try anything?
What do you mean “listConnections was not helpful”?
I’m all for helping, no doubt. Though it seems like you just want others to write your tool for you.
Besides, as for this question with listConnections in MEL, you’ve pretty much answered it yourself with your code example in your other thread:
http://forums.cgsociety.org/showthread.php?f=89&t=1331381
I believe AaronStone was asking for incoming connection to specific attributes and was confused with cmds being a mel wrapper for python
if(`listConnections “myobj.tx” -d 0`):
result = 1;
would do in mel just fine.