Convert materials in scene to VrayOverrideMtl
Hi,
I'm trying to simplify a long winded process, and think it may be achievable in MaxScript. Apologies my knowledge of MaxScript (and any programming) is extremely basic.
What I would like to do is convert every material in a scene to a VrayOverrideMtl, keeping the existing material in the base slot. Then apply a vrayMtl to the Reflect mtl slot, and change the diffuse color of this vrayMtl to black. I'd need the script to ignore certain objects, which could be defined as a selection, layer, etc. However thinking about this I could "cut and paste" the objects I don't want to be affected, but if it could be done through scripting then that would be great.
My main problem is that I can't see how to change the material type through scripting. I can see how it works using the listener, and manually assigning the new material type, but that's not really how I think it should work. Ideally I think I should be using something like this -
for mat in scenematerials do
(
(
if iskindof o.mat VrayOverrideMtl do
(
)
else
(
SCRIPT TO CHANGE MATERIAL TYPE, ETC
)
)
Any help would be really appreciated.
Thanks,
Dean
Comments
...
Try this function. If fn argument"selectedObjs" is set to "on" then fn works on selected objects only or if is set to "off" then on scene materijals. Also this fn respect instanced materials.
After you run fn for the first time use belowe code
convertToOverideMtl selectedObjs:on -- if you want to consider only selected objects
or this line
convertToOverideMtl selectedObjs:off -- this will works on scenematerials
bga