Help: little changes to this script: Add Color Correct map v1.0 on VRayMtl

Hi all,
I’ve this little script.
It adds a Color Correct map to every shader or selected object, if these shaders are a VRay Mat
Can you help me to change this script for Corona?
Thanks :smiley:

macroScript CC_All category:"VRay" tooltip:"Add CC Map to all VRay Materials" buttontext: "CC All"
(
	--CC Map in diffuse slot of ALL VRay Materials where a bitmap is present
	if queryBox "Add CC Map to ALL VRay Materials?" do
	(
		vrmArr = getClassInstances vrayMtl
		for vrm in vrmArr do
		(
			if isKindOf vrm.texmap_diffuse Bitmaptexture then
			(
				cc = ColorCorrection map:(vrm.texmap_diffuse) lightnessMode:1
				vrm.texmap_diffuse = cc
			)
		)
	)
)

macroScript CC_Selected category:"VRay" tooltip:"Add CC Map to Selected" buttontext: "CC Selected"
(
	--CC Map in diffuse slot of SELECTED objects
	objs = getCurrentSelection()

	for obj in objs do
	(
		vrmArr = getClassInstances vrayMtl target:obj

		for vrm in vrmArr do
		(
			if isKindOf vrm.texmap_diffuse Bitmaptexture then
			(
				cc = ColorCorrection map:(vrm.texmap_diffuse) lightnessMode:1
				vrm.texmap_diffuse = cc
			)
		)
	)
)

I didn’t test it but this should work:

Formatting got a litte screwed, but i wanted to show the changes bold; Header for macroscripts etc still need to be changed :wink:

macroScript CC_All category:“VRay” tooltip:“Add CC Map to all VRay Materials” buttontext: “CC All”
(
–CC Map in diffuse slot of ALL VRay Materials where a bitmap is present
if queryBox “Add CC Map to ALL VRay Materials?” do
(
vrmArr = getClassInstances CoronaMtl
for vrm in vrmArr do
(
if isKindOf vrm.texmapDiffuse Bitmaptexture then
(
cc = ColorCorrection map:(vrm.texmapDiffuse) lightnessMode:1
vrm.texmapDiffuse = cc
)
)
)
)

macroScript CC_Selected category:“VRay” tooltip:“Add CC Map to Selected” buttontext: “CC Selected”
(
–CC Map in diffuse slot of SELECTED objects
objs = getCurrentSelection()

for obj in objs do
(
vrmArr = getClassInstances CoronaMtl target:obj

  for vrm in vrmArr do
  (
  	if isKindOf vrm.**texmapDiffuse** Bitmaptexture then
  	(
  		cc = ColorCorrection map:(vrm.**texmapDiffuse**) lightnessMode:1
  		vrm.**texmapDiffuse** = cc
  	)
  )

)
)

Thank you =) =) The script is not mine. I’m not able to write two rows of code :frowning:

With “Header for macroscripts” i mean this:

macroScript CC_All category:“VRay” tooltip:“Add CC Map to all VRay Materials” buttontext: “CC All”

You may want to change it so something that does not override the original Scripts :wink: like:

macroScript CC_All category:“Corona” tooltip:“Add CC Map to all Corona Materials” buttontext: “CC All”
…
macroScript CC_Selected category:“Corona” tooltip:“Add CC Map to Selected” buttontext: “CC Selected”