PDA

View Full Version : Simple? Changing shading group via MEL


jdj
12-09-2003, 08:16 PM
Hi there

I want to write a MEL script that automates the task of changing the shading group of objects in a few secene files of mine to faclilitate rendering passes for compositions.

So I sat down and figured out how to switch shading group via MEL - a done deal I thought.... but no. It got snagged on what I believe are instanced objects. I did a for loop like this:


for ($i = 0; $i < size($nodes) ;$i++)
{ sets -edit -forceElement $shadingGroup $nodes[$i]; }


...but this only seems to work for non-instanced geometry :( I have a hall with pillars that are instanced, and for all of them (but the original) the change does not seem to "stick" - they stay with the original shading group.

I am a bit tired right now so I wondered if any of you had any ideas that could save me some headaches ?

Cheers!
/ Daniel
:beer:

sbp
12-09-2003, 09:57 PM
Hi,

Check to verify you are getting the instance transform nodes when you fill nodes, and not just the shape node.

jdj
12-10-2003, 03:59 PM
Ah - found the problem.

Thanks sbp for your help. Unfortunately the problem was not the sets command but rather the command I used to get the (transform)nodes: listConnections - which did not work as I expected. I haven't figured out a solution yet though, but I'll get there eventually :)

Cheers!
/ Daniel

jdj
12-10-2003, 04:25 PM
Found it! :)

For curious people:
I used listConnections to get all the connections to a display layer. The problem with this approach was apparently that the layer was connected to the shape node and not the transform node... so when I used listConnections, I only got the first parent transform and not the rest.

Took a while to figure that one out. Works like a charm now - I used listRelatives -allParents on the shape nodes to retrieve all transforms.

Cheers!
/ Daniel
:beer:

CGTalk Moderation
01-16-2006, 09:00 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.