Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Alexandre SCELLIER on 2016-05-10, 19:23:22

Title: Overide Material shortcut
Post by: Alexandre SCELLIER on 2016-05-10, 19:23:22
Hi,
Is it possible to use a macroscript, via a shortcut or within the toolbar, to exclude objects from the overide material ? In this case, could you share it ?
I use it a lot in my worflow and it's pretty borring having to open the render setting window every time so :)

Thx.
Title: Re: Overide Material shortcut
Post by: SandrineC on 2020-03-12, 12:55:18
Same request :)
Maybe just the maxscript command will be nice to make it

Thx.
Title: Re: Overide Material shortcut
Post by: Jpjapers on 2020-03-12, 13:44:55
You can list all available endpoints with

Code: [Select]
show renderers.current
The ones concerning mtlOverrides are

Code: [Select]
.mtlOverride_enabled (main_mtlOverrideEnabled) : boolean
  .mtlOverride_includeMode (main_mtlOverrideIncludeMode) : boolean
 .mtlOverride_preserveDisplacement (main_mtlOverridePreservesDisplacement) : boolean
.mtlOverride (main_mtlOverride) : material
  .mtlOverride_preserveLightMtl (main_mtlOverridePreservesLightMtl) : boolean
  .mtlOverride_preservePortalMtl (main_mtlOverridePreservesPortalMtl) : boolean
  .mtlOverride_preserveUnsupportedMtl (main_mtlOverridePreservesUnsupportedMtl) : boolean
  .mtlOverride_preserveGlassMtl (main_mtlOverridePreservesGlassMtl) : boolean
.overrideMtl_exclude (main_mtlOverrideExclude) : node array
Title: Re: Overide Material shortcut
Post by: Mr.Max on 2020-03-16, 21:46:54
it's tricky to do but David from DPict  wrote a script for that years back for V-Ray .
So I did use the same workaround and wrote this one that works with Corona .
run the script then add shortcut/button to it ,you can find it under dPict Tools category.

Code: [Select]
macroScript AddToOverrideExclCorona
category:"dPict Tools"
tooltip:"Add to Override Exclude List Corona "
(
vr=renderers.current
newExclList=vr.overrideMtl_exclude

--cleanup existing exclusion list for undefined
for i = newExclList.count to 1 by -1 do
(
if newExclList[i] ==undefined then
(
deleteItem newExclList i
)
)
if selection.count>0 then
(
For o in selection where superClassOf o == geometryClass do
(
if (findItem newExclList o)==0 then
(
append newExclList o
)

)
vr.overrideMtl_exclude= newExclList
)
else
messageBox "Nothing Selected"
)