View Full Version : maps Substitution

06 June 2010, 08:07 AM

I'm working on a script that does this:

-Locate any colorcorrect map and substitute it for its source bitmap.

I would like to know if its possible to use a different method than iterate through the material list. It's problematic because there are LOT of different material structures...

Maybe I could know what the parent of any map is, and get them from a "getclassinstaces(colorcorrect)" array??

Really noob to coding, so I accept suggestions... :D

Thanks in advance...

06 June 2010, 09:40 AM
you should look into 'getClassInstances' and 'replaceInstances' or 'instanceReplace' (one of them will do the trick, the other won't, I can't remember which one is which) in the mxs help

the basic idea is to loop through all the instances of the map class you want to alter (in your case 'colorcorrect') and replace it with the other map you want which should be easy to get from the first.

good luck

06 June 2010, 10:07 AM
It worked perfectly, thanks a lot!!!

the code, maybe someone find it useful:

s = getclassinstances(colorcorrect)
for i in s do
replaceinstances i i.src_tex

06 June 2010, 11:48 AM
Hmmm, thanks for that, was searching for something like this a while back and didn't find anything... This will be very useful thankyou.

02 February 2011, 02:46 PM
how about replacing with no map (i.e clearing the channel map ) which may be not inside fallof or any other compound forms of material?

CGTalk Moderation
02 February 2011, 02:46 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.