Simple? Changing shading group via MEL

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  12 December 2003
Question Simple? Changing shading group via MEL

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 ?

/ Daniel
  12 December 2003

Check to verify you are getting the instance transform nodes when you fill nodes, and not just the shape node.
  12 December 2003
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

/ Daniel
  12 December 2003
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.

/ Daniel

Last edited by jdj : 12 December 2003 at 05:32 PM.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:39 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.