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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 12 December 2003   #1
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 ?

Cheers!
/ Daniel
 
Old 12 December 2003   #2
Hi,

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

Last edited by jdj : 12 December 2003 at 05:32 PM.
 
Old 01 January 2006   #5
Thread automatically closed

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.
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 09:12 AM.


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