Author Topic: Help: little changes to this script: Add Color Correct map v1.0 on VRayMtl  (Read 3894 times)

2013-03-28, 16:16:59

cecofuli

  • Active Users
  • **
  • Posts: 1577
    • View Profile
    • www.francescolegrenzi.com
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 :)

Code: [Select]
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
)
)
)
)

2013-03-28, 16:31:12
Reply #1

racoonart

  • Active Users
  • **
  • Posts: 1446
    • View Profile
    • racoon-artworks
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 ;)

Quote
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
         )
      )
   )
)
Any sufficiently advanced bug is indistinguishable from a feature.

2013-03-28, 18:22:40
Reply #2

cecofuli

  • Active Users
  • **
  • Posts: 1577
    • View Profile
    • www.francescolegrenzi.com

2013-03-28, 18:56:05
Reply #3

racoonart

  • Active Users
  • **
  • Posts: 1446
    • View Profile
    • racoon-artworks
With "Header for macroscripts" i mean this:
Quote
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 ;) like:

Quote
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"
Any sufficiently advanced bug is indistinguishable from a feature.