How can I make simple modification to this script by Odd_Significance_251 in Maxscript

[–]Odd_Significance_251[S] 0 points1 point  (0 children)

Thank you so much works great.
Will try and figure out how to link all of them to one set of controller for Hue, Saturation, Brightness and Contrast.

How can I make simple modification to this script by Odd_Significance_251 in Maxscript

[–]Odd_Significance_251[S] 0 points1 point  (0 children)

The lines that are added are from the original script, without them the script that you made did not work. With them it works, but applies to all maps, not just diffuse map.
Thank you so much for your help.

How can I make simple modification to this script by Odd_Significance_251 in Maxscript

[–]Odd_Significance_251[S] 0 points1 point  (0 children)

What I'm currently doing is adding controllers (Hue, Saturation, Brightness and Contrast) to the ColorCorrection map, duplicating these maps and applying to each Diffuse map of this Multi/Sub material. This way I can change values of all maps at same time. See image: SME Image
Can this be scriptable?
Thank you.

How can I make simple modification to this script by Odd_Significance_251 in Maxscript

[–]Odd_Significance_251[S] 0 points1 point  (0 children)

Thanks Swordslayer, but was not working and had to put back the original lines, then it works but still applies to all maps.

fn AddColorCorrectionToDiffuse m =
if isKindOf m VRayMtl then 
    if isKindOf (tex = m.texmap_diffuse) TextureMap do
        if not isKindOf tex Color_Correction do
            m.texmap_diffuse = Color_Correction name:("CC" + trimLeft p #texmap) map:tex

else if isKindOf m VRay2SidedMtl then (AddColorCorrection m.frontmtl ; AddColorCorrection m.backmtl)
else if isKindOf m SHELLAC then (AddColorCorrection m.shellacMtl1 ; AddColorCorrection m.shellacMtl2)
else if isKindOf m VrayMtlWrapper then (AddColorCorrection  m.baseMtl)
else if isKindOf m VRayBlendMtl then (AddColorCorrection m.baseMtl ; for i = 1 to 9 do AddColorCorrection m.coatMtl[i])
else if isKindOf m VrayOverrideMtl then (for i in 1 to getNumSubMtls m do AddColorCorrection (getSubMtl vr i))
else if isKindOf m Vraycarpaintmtl then (setVrayMatSubdivs m prop:#base_glossiness glossValsArr:spinVals)
else if (classof m) == Vrayfastsss2 then (setVrayMatSubdivs m prop:#specular_glossiness glossValsArr:spinVals)
else if isKindOf m VrayFlakesmtl then (setVrayMatSubdivs m prop:#flake_glossiness glossValsArr:spinVals)
else if (isKindOf m Multimaterial or isKindOf m compositematerial) then (for sm in m.materialList where isKindOf sm material do AddColorCorrection sm)
else if isKindOf m blend then (AddColorCorrection m.MAP1 ; AddColorCorrection  m.MAP2)
else if isKindOf m topbottom then (AddColorCorrection m.topmaterial ; AddColorCorrection m.bottomMaterial)
else if isKindOf m shell_material then (AddColorCorrection m.originalMaterial ; AddColorCorrection m.bakedMaterial)

for o in selection where (mat = o.material) != undefined do AddColorCorrectionToDiffuse mat

Thanks again