Hi there,
I tried it the last to days to get it done by myself. Just startet learning scripting last weeks. I'm clueless now.
I need a script that assigns a CC to VRayMtl or 2Sided where I can set the hueshift,tint and so on. It also should check if there is already an color correct and then change its values.
I took an existing script and change it to VRayMtl. Works
But if I neeed to change the shift and hue a second time the script creates a second CC. I missing a check variable I think
Also its missing the 2sided mtl option.
Important is the ability to change the hue values in the script and creating only 1 CC and/or modify excisting ones.
Anyone who can help me in the right direction?
--- get materials from selection
(
mymaterials = #()
for obj in selection do
(
if obj.material != undefined do appendifunique mymaterials obj.material
)
--- check for multisubmtls and collect the submtls
mysubmaterials = #()
for a=1 to mymaterials.count do
(
if classof mymaterials[a] == Multimaterial then -- if multisubmtl, then
(
for b=1 to mymaterials[a].materialList.count do --- loop through submtls
(
if mymaterials[a].materialList[b] != undefined then appendifunique mysubmaterials mymaterials[a].materialList[b] -- collect submtls
)
)
)
-- delete multisubs from matarray
for a=mymaterials.count to 1 by -1 do
(
if classof mymaterials[a] == Multimaterial then deleteitem mymaterials a
)
-- append the submtls
for a=1 to mysubmaterials.count do
(
appendifunique mymaterials mysubmaterials[a]
)
print mymaterials
-- see whats in the diffuse slot
for mymaterial in mymaterials do
(
-- make sure its a standard material
if classof mymaterial == VRayMtl then
(
--- make sure the diffuse slot is not empty
if mymaterial.texmap_diffuse != undefined then
(
-- remember the map in the diffuse slot
mymap = mymaterial.diffuseMap
-- create a new cc node and wire it
ccnode = ColorCorrection()
ccnode.Map = mymap
-- set cc settings
ccnode.hueShift = -18.0
ccnode.saturation = 0.0
ccnode.tint = (color 0 0 0)
ccnode.tintStrength = 0.0
ccnode.gammaRGB = 0.75
/*
ccnode.rewireMode (Rewire_Mode) : integer
ccnode.rewireR : integer
ccnode.rewireG : integer
ccnode.rewireB : integer
ccnode.rewireA : integer
ccnode.hueShift : float
ccnode.saturation : float
ccnode.tint (Hue_Tint) : fRGBA color
ccnode.tintStrength (Hue_Strength) : float
ccnode.lightnessMode : integer
ccnode.contrast : float
ccnode.brightness : float
ccnode.exposureMode (Lightness) : integer
ccnode.enableR : boolean
ccnode.enableG : boolean
ccnode.enableB : boolean
ccnode.gainRGB (LightnessGainRGB) : float
ccnode.gainR (LightnessGainR) : float
ccnode.gainG (LightnessGainG) : float
ccnode.gainB (LightnessGainB) : float
ccnode.gammaRGB (LightnessGammaRGB) : float
ccnode.gammaR (LightnessGammaR) : float
ccnode.gammaG (LightnessGammaG) : float
ccnode.gammaB (LightnessGammaB) : float
ccnode.pivotRGB (LightnessPivotRGB) : float
ccnode.pivotR (LightnessPivotR) : float
ccnode.pivotG (LightnessPivotG) : float
ccnode.pivotB (LightnessPivotB) : float
ccnode.liftRGB (LightnessLiftRGB) : float
ccnode.liftR (LightnessLiftR) : float
ccnode.liftG (LightnessLiftG) : float
ccnode.liftB (LightnessLiftB) : float
ccnode.printerLights (LightnessPrinter) : float
*/
-- put the cc node to the diffuse slot
mymaterial.texmap_diffuse = ccnode
)
else print "nothing in diffuse slot"
)
)
)