Author Topic: Maxscript reference for corona functions  (Read 717 times)

2023-12-27, 17:08:12

PsychoBoyJack

  • Active Users
  • **
  • Posts: 30
    • View Profile
hello, im trying to write a few tools to speed up/facilitate a few things in our workflow but i can't find any documentation referencing /descripting methods available to maxscript concerning corona (access to render elements, and so on)
Any information would be welcome
ps :i saw a link to a wiki that seems to not exist anymore.

thanks

2023-12-28, 10:54:31
Reply #1

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12768
  • Marcin
    • View Profile
Hi, sorry, we are deprecating our old wiki and will move the data from there to our documentation portal ASAP.
Can you list the exact things you are interested in?

I can also suggest using:
- The 3ds Max maxscript listener
- The Corona listener script - https://forum.corona-renderer.com/index.php?topic=16571.0
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2024-01-25, 13:00:18
Reply #2

Darawork

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi,

Some more handy Maxscript I found over the years to speed up Corona Workflow;

Denoise set to on with all Render Elements:
Code: [Select]
(
(
local RE= maxOps.GetCurRenderElementMgr()
local REcount=re.NumRenderElements()
--for i=0 to (re.NumRenderElements())-1 where (findstring ((re.GetRenderElement i)as string) "LightSelect") != undefined do
if REcount != 0 then
( for i=0 to REcount-1 where (hasproperty (local El=(re.GetRenderElement i)) #usedenoise) do
( if El.usedenoise then
( format (El.elementname+": skipped because UseDenoise is already enabled\n")
) else
( El.usedenoise= true
format (El.elementname+".UseDenoise: "+(if El.usedenoise then "Enabled" else "Disabled")+"\n")
)
)
) else
( messagebox "Your RenderElements is empty :)" title:"Denoise all RenderElements"
)
)
)

Clear Render Element File Paths:
Code: [Select]
re = maxOps.GetCurRenderElementMgr()
for i = 0 to re.NumRenderElements()  do re.SetRenderElementFilename i ""

Create Render Elements:
Code: [Select]
(
-- set a list of render elements.
elementlist = #(CESSENTIAL_Reflect, CESSENTIAL_Refract, CESSENTIAL_Translucency, CMasking_ID, CShading_Albedo, CShading_Alpha, CShading_Lightmix, CShading_Lightselect, CShading_Shadows, CMasking_WireColor, CTexmap)

re = maxOps.GetCurRenderElementMgr() -- get the current render element manager
re.removeallrenderelements() -- remove all renderelements
re.numrenderelements() -- get number of render elements

theManager = maxOps.GetRenderElementMgr #Production
theManager.numrenderelements()
rendoutputfilename = "c:\\test.tif"
-- adds all renderelements to be rendered.
for n in elementlist do
(
re.addrenderelement (n elementname:("OMP_" + (n as string)))
format "\nAdded % renderelement" n
)
rendsavefile = true
setsilentmode true -- used to avoid error message when checking the filename of element
renderSceneDialog.open() -- open Render Dialog -- get all render elements set and return name of render element and output filename
for n = 0 to (theManager.numrenderelements () - 1) do
(
el = re.getrenderelement n
format "\nGetting % render element" el.elementname
format "\nRender element outputfilename: %" (re.GetRenderElementFileName n)
)
)

Show Corona Material Library:
Code: [Select]
(
CoronaMaterialLibrary.MaterialLibraryFp.showBrowserIfPossible true
)

With all Render Setup Settings Maxscript functions, Render Setup Dialogue needs to be closed first, not open.
All credit to original authors.

Regards,
Windows 10/11, 3DS Max 2022, Revit 2023, AutoCad 2023, Dell Precision 5810/20, nVidia Quadro P5000/RTX 5000, Corona 10/11.

2024-02-26, 11:43:56
Reply #3

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12768
  • Marcin
    • View Profile
Our Maxscript documentation is now available at https://docs.chaos.com/display/CRMAX/MAXScript
As usual, please share any feedback you may have.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us