PDA

View Full Version : maps Substitution


tronkyfran
06-07-2010, 09:07 AM
Hi!

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...

MatanH
06-07-2010, 10:40 AM
Hi,
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

tronkyfran
06-07-2010, 11: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
)

DaveWortley
06-08-2010, 12:48 PM
Hmmm, thanks for that, was searching for something like this a while back and didn't find anything... This will be very useful thankyou.

shalabology
02-19-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-19-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.