PDA

View Full Version : list all upstream nodes


G.H.O.S.T
03-24-2011, 01:05 AM
Hi,
How to do this without hypershade window?
string $selection[] = `ls -sl`;
string $shapes[] = `listRelatives $selection`;
hyperShade -lun $shapes;

Nyro
03-24-2011, 02:33 AM
string $incomingConnections[] = `listConnections -d 0 -s 1`;

Obviously, this only works on a single node. You'd have to use a for ... in loop if you wanted to do this on an array of selected objects/nodes.

G.H.O.S.T
03-24-2011, 03:17 AM
Thanks for reply.
string $incomingConnections[] = `listConnections -d 0 -s 1 `;
This gives me the name of directly connected nodes of the selected object/node. I need to list whole network. For example: If I have this kind of network:
place2dTexture1->file1->blin1->blinn1SG<-displacementShader1<-layeredTexture1 and so on .
I need to list whole this nodes of selected object(e.g. pSphere).

NaughtyNathan
03-24-2011, 11:25 AM
if `hyperShade -lun $shapes`; gives you the result you want, why don't you want to continue use that? either way, the listHistory command will give you back much the same info...
:nathaN

G.H.O.S.T
03-24-2011, 03:33 PM
Thanks for reply. Itīs OK. I thout that the command hyperShade needs opened hypershade window. :)
I have enother question how to remove empty members from an array?
I have thic code
string $selection[] = `ls -sl`;
string $shapes[] = `listRelatives $selection`;
string $upStrNodes[] =`hyperShade -lun $shapes`;
int $instNum= size($upStrNodes);
string $fileNode1[];
for($i=0; $i<$instNum; $i++){

if(`nodeType $upStrNodes[$i]` == "file"){

$fileNode1[$i] = $upStrNodes[$i];

}

}
print $fileNode1

and would like to remove empty members from $fileNode1[].
I've tryed stringArrayRemove in else statment but without any success.
string $selection[] = `ls -sl`;
string $shapes[] = `listRelatives $selection`;
string $upStrNodes[] =`hyperShade -lun $shapes`;
int $instNum= size($upStrNodes);
string $fileNode1[];
for($i=0; $i<$instNum; $i++){

if(`nodeType $upStrNodes[$i]` == "file"){

$fileNode1[$i] = $upStrNodes[$i];

}
else{
string $emptyItems[] = {" "};
string $diff[] = stringArrayRemove($emptyItems, $fileNode1);
}

}

CGTalk Moderation
03-24-2011, 03:33 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.