PDA

View Full Version : get associated renderlayer from geometry


Sorath
06-08-2012, 11:04 AM
is there any chance to qry the renderlayer from the given geometry?

maybe I'm missing something here..

Sorath
06-08-2012, 11:27 AM
apparently I thought I figured it out.
But not really.. cause the renderlayer is somewhere upstream and not downstream.
So whatever I do with listRelatives/ listConnections or so. I always go downstream :(

procanic
06-09-2012, 11:38 PM
try this:

string $rl[];
for ($o in `ls -sl`) $rl = `listConnections -type "renderLayer" $o`;
print $rl;

maybe that already does what you're looking for. if you also want to find all render layers of all it's parents you'll need a recursive loop. but the querying will remain the same. hope this helps you to get the hang of it. cheers! :)

procanic
06-12-2012, 10:31 AM
in case you haven't solved it yet, here's the recursive loop through parents:

string $testObj;
string $rl[];
for ($obj in `ls -sl`)
{
$testObj = $obj;
$rl = `listConnections -type "renderLayer" $testObj`;
while (!size($rl))
{
$parent = `listRelatives -p $testObj`;
$rl = `listConnections -type "renderLayer" $parent[0]`;
$testObj = $parent[0];
}
print ("\nThe next upstream transfom node of \"" + $obj + "\" connected to a render layer is: \"" + $testObj + "\"\n");
print ("Connected render layers are: \n");
print $rl;
}

Sorath
06-12-2012, 10:36 AM
thanks procanic.

Really helpful and actually exactly what I need.
Just got busy with other parts of my code meanwhile.

cheers

CGTalk Moderation
06-12-2012, 10:36 AM
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.