PDA

View Full Version : Finding file nodes in shader tree


Keithtron
06-13-2008, 02:53 PM
Hey everyone,

I'm trying to find all the file nodes in a given shading group's network. Right now I'm working on a recursive function to check through all the upstream nodes starting from the shading group, and running into some problems with it. I feel like there's got to be an easier way of doing this though, I feel like I'm missing something.

Do any of you have suggestions as to what I should do differently, I should I just plow ahead with that recursive proc? Thanks in advance for any help!


~ Keith

NaughtyNathan
06-13-2008, 03:13 PM
hey. file nodes are part of a shaders history, so if you do:

listHistory lambert2;

it will list everything belonging to the network "lambert2", which will include all the file nodes.
you can then filter this list for just file nodes:

string $network[] = `listHistory lambert2`;
string $fileNodes[] = `ls -type "file" $network`;

(or my preferred method):

string $fileNodes[] = ls("-type","file",listHistory("lambert2"));

:nathaN

Keithtron
06-13-2008, 04:03 PM
Excellent, works like a charm. Thanks!

CGTalk Moderation
06-13-2008, 04:03 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.