Replace all materials.

Hi guys!
I've found a script that replaces all the materials in the material editor to vrayMtl.

I'm trying to build a script the replaces them all with a VRayOverrideMtl with a VRayMtl in the base and GI slot.

What I've work'd out so far:

for i=1 to meditmaterials.count do ( meditmaterials[i]=vrayoverridemtl() )

and then i found out that:

meditMaterials[i].baseMtl.diffuse = color 220 220 220
meditMaterials[i].giMtl.diffuse = color 180 180 180

works if I manually puts a vrayMtl in the two slots.. Can I automate this, in any way?

Kind regards Adam

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kstudio's picture

override_mat =

override_mat = VRayOverrideMtl()
baseMtl = VRayMtl diffuse:( color 220 220 220) name:"Base"
giMtl = VRayMtl diffuse:(color 180 180 180) name:"Gi"
override_mat.baseMtl = baseMtl
override_mat.giMtl = giMtl
 
for i=1 to meditmaterials.count do (meditmaterials[i]=copy override_mat)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.