View Full Version : Filtering Connections

04 April 2009, 06:49 PM
Hey Guys,

I think I've a simple question.

If I use the listConnections command I get a list of the input (and/or output connection, depending on the tags). Now if I do this on a set of objects and would only want for example Smooth Nodes that are on the objects, how can I filter those out of the list. Is every node an 'own' type? If so, how can I check 'what type' something is?

Hope somebody can help me out.

Thanks in advance,
- Roy

04 April 2009, 06:54 PM
afaik most every node in maya has a unique node type assigned to it. i know there's a way to query types via mel, but i can't remeber the syntax right now. the way i get types is through the attribute editor. to the left of the box where you can change the name is the type name. for example poly smooth nodes are type 'polySmoothFace'.

04 April 2009, 10:52 PM
I seemed to did something wrong anyway? The listconnections only shows connections to the 'attributes'. The inputs like 'polySmooth' is not an connection, but is history.
There's a 'listHistory' command, but this one doesn't have the type tag. This means I have to go into a for in loop to check each of the 'historyNode' if it is of type polySmoothFace.


04 April 2009, 03:42 PM
try running the listConnections on the shape node instead of the transform node.

12 December 2009, 11:34 AM
try this :

global proc setMySmooth(int $div){

$sel = `ls -sl`;

for ($each in $sel){

$shape = `listRelatives -s $each`;
$smooth = `listConnections -type "polySmoothFace" $shape[0]`;
print $smooth;
setAttr ($smooth[0]+".div") ;


setMySmooth 3;

12 December 2009, 06:40 PM
Hello There,
Please try this code:

proc nnSmooth( int $val )
string $selNodes[] = `ls -sl -l -typ "transform"`;
for( $selNode in $selNodes )
string $historyNodes[] = `listHistory -pdo true $selNode`;
string $smoothFaceNodes[] = `ls -typ "polySmoothFace" $historyNodes`;

for( $smoothFaceNode in $smoothFaceNodes )
setAttr( $smoothFaceNode + ".dv" ) $val;
nnSmooth( 0 );

Thank You,
Norbert Nacu

CGTalk Moderation
12 December 2009, 06:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.