ScriptSpot

Forum topic · Scripts Wanted

Replace all materials.

By Heimdal · 2011-12-19

Description

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 (1)

override_mat =

Kstudio · 2011-12-23

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)