Filtering Connections

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 04 April 2009   #1
Filtering Connections

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
Old 04 April 2009   #2
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'.
Old 04 April 2009   #3
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.

Old 04 April 2009   #4
try running the listConnections on the shape node instead of the transform node.
Old 12 December 2009   #5
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;
Old 12 December 2009   #6
Post Hi

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
Old 12 December 2009   #7
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:48 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.