5
« on: 2022-04-13, 03:42:34 »
hey there folks, I'm looking for a way to create a script that changes Corona Physical Mtl to Standart Mtl, as it's better for some FBX exportations, well, the thing is I managed to adapt and old script to work with Corona Legacy, and it was very easy considering it has a Diffuse color, but Physical has a Color Base, and I don't know how to transcribe that to max scripting language, I want the Diffuse map from Physical Mtl to go to Diffuse map in Standart Mtl.
The script is like that at the moment:
fn convertCoronaPhysicalMtlToStandard mat =
(
-- Make new Standard mat, with original's diffuse map
newMat = Standardmaterial mapMO:mat.texmapBase
newMat.name = mat.name
-- diffuse
newMat.diffuse=mat.colorBase
newMat.diffuseMap=mat.texmapBase
newMat.diffuseMapEnable=mat.texmapOnbase
newMat.diffuseMapAmount=mat.levelBase
-- opacity
newMat.opacityMap=mat.texmapOpacity
newMat.opacityMapEnable=mat.texmapOnOpacity
newMat.opacityMapAmount=mat.levelOpacity
--bump map
newMat.bumpMap=mat.texmapbump
newMat.bumpMapEnable=mat.texmapOnBump
showTextureMap newMat on
return newMat
)
-- Loop through all objects, checking material on each
for obj in geometry do
(
mat = obj.material
if (mat != undefined) then
(
if (classof mat == Multimaterial) then
(
-- This is a multi-sub material, so loop through all submaterials
for i in mat.materialIdList do
(
submat = mat
if (classof submat == CoronamPhysicalMtl) then
(
replaceinstances submat (convertCoronaPhysicalMtlToStandard submat)
)
)
)
else if (classof mat == CoronaPhysicalmtl) then
(
-- Regular, non-multi material
replaceinstances mat (convertCoronaPhysicalMtlToStandard mat)
)
)
)
Right at the start where newmat=standartmaterial I CANNOT fing a way to change the mapMO: mat.textmapBase and --diffuse stuff to the correct name, anyone knows what to put in there to make this work?
Thanks a bunch.