46
[Max] I need help! / Re: Add CoronaRaySwitch to 500 materials
« on: 2022-09-02, 11:35:20 »
I hope I understood the problem correctly.
try running this:
please do a scene hold before you run it.
try running this:
Code: [Select]
(
global whiteMat = CoronaPhysicalMtl()
global cnt = 0
whiteMat.name ="GI_white"
for obj in geometry where obj.mat != undefined do
(
raySwMat = CoronaRaySwitchMtl()
raySwMat.giMtl = whiteMat
raySwMat.reflectMtl = obj.mat
raySwMat.refractMtl = obj.mat
raySwMat.directMtl = obj.mat
raySwMat.name = ("RaySwitchMtl" + "_" + obj.name)
obj.mat = raySwMat
cnt+=1
)
print ("materials processed: " + (cnt as string))
)
please do a scene hold before you run it.