View Full Version : How to list all downstream connections?
EmilP 02-02-2007, 02:57 AM Ok.. an example. lets say you've got a lambert and it has a blendColors node connected to it's color. This blendColors has a fileTexture node on it's input. How do I get from the lambert to the fileTexture node directly.
I need something like:
listConnections -children -type file;
But we know that the "children" relates to DAG nodes on listRelatives.
Thanks for any help in advance.
Emil
|
|
analogue
02-02-2007, 09:20 AM
You could do something like this:
string $conn1[] = `listConnections -d 0 -s 1 lambert1`; // get first connection...
string $conn2[] = `listConnections -d 0 -s 1 $conn1[0]`; // get second connection...
print($conn2);
Of course you could have multiple connections on either node so you may need to use the nodeType command in a loop to verify results...
string $conn1[] = `listConnections -d 0 -s 1 lambert1`;
for($c1 in $conn1) {
if(`nodeType $c1` == "blendColors") {
string $conn2[] = `listConnections -d 0 -s 1 $conn1[0]`;
for($c2 in $conn2) {
if(`nodeType $conn2` == "file") {
print($conn2);
}
}
}
}
-Ben
EmilP
02-04-2007, 06:49 PM
Thanks analogue!
I've been looking for something that is more universal and where I don't have to worry about the depth of the connection so I can have a shading network with 20 or more nodes and few file texture nodes in that and I can quickly get a list of all these file nodes that end up in a specific material.
There is one command I found "dgInfo" that would make sense to use in this case but I could not make it work.
The solution is simplier than I thought because the listHistory does it all I just forgot about that a shading network is nothing else than a DG.
string $selectedShader[] = `ls -sl`;
string $DGlist[] = `listHistory $selectedShader`;
string $fileTextures[] = `ls -typ "file" $DGlist`;
print $fileTextures;
CGTalk Moderation
02-04-2007, 06:49 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.