[Closed] [REQUEST] Script to put CC Map in any Diffuse Map
Hi all,
I want to ask if there is come guy who want to write a script for us. It’s very simple, I think
Put in front of every existing map in the diffuse channel (for now only diffuse channel) a CC map with Advanced Mode turn on. For all OBJ in the scene or for a selected OBJ
For example, if in a scene I’ve a material something like that:
[b]CONCRETE
- Concrete diffuse -> Bitmap (only bitmap, for now)[/b]
I could to be nice to be:
[b]CONCRETE
- Concrete diffuse -> Color Correct Map -> Bitmap[/b]
If we have 100 objects and 300 shaders it’s a very time consuming task to do by hand!
This should work for selected objects:
--CC Map in diffuse slot of vray materials on SELECTED objects (should get those inside multiMats, blends etc.)
(
objs = getCurrentSelection()
for obj in objs do
(
bmtArr = getClassInstances Bitmaptexture target:obj
for bmt in bmtArr do
(
rfs = refs.dependents bmt
for rf in rfs do
(
if isKindOf rf vrayMtl then
(
if (isKindOf rf.texmap_diffuse Bitmaptexture) and (rf.texmap_diffuse == bmt) then
(
cc = ColorCorrection map:bmt lightnessMode:1
rf.texmap_diffuse = cc
)
)
)
)
)
)
And this is for all scene vray materials:
--CC Map in diffuse slot of ALL VRay Materials where a bitmap is present (should get those inside multiMats, blends etc.)
(
bmtArr = getClassInstances Bitmaptexture
for bmt in bmtArr do
(
rfs = refs.dependents bmt
for rf in rfs do
(
if isKindOf rf vrayMtl then
(
if (isKindOf rf.texmap_diffuse Bitmaptexture) and (rf.texmap_diffuse == bmt) then
(
cc = ColorCorrection map:bmt lightnessMode:1
rf.texmap_diffuse = cc
)
)
)
)
)
Hi Raytracer05,
wow… thanks! Works very well! This is so useful for every scene or objects we import. In our work-flow we use a CC map before every diffuse map to avoid PS task (when we can) . Now it’s just one-click! I don’t know how say you thanks )))
Not a problem, I’m sure many of your posts over on the Chaos forum have been useful to me over the years.
I don’t know what I’d been smoking yesterday but it didn’t help my already limited maxscript ability
Anyway, I’ve simplified them so they should be much faster in large scenes.
Add CC map to selected objects:
--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
)
)
)
)
Add CC map to all VRay materials:
--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
)
)
)
)
And if you want to add the tools as buttons on a toolbar etc. save this as a .mcr file and drag and drop it over a max viewport. You’ll find them under the VRay catagory in customize ui.
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
)
)
)
)