Chaos Corona for 3ds Max > [Max] I need help!

Maxscript: Test if one viewport is the interactive window

(1/1)

RecentSpacesSam:
Hey all, I'm curious to know if there is a method in MaxScript to check if one of the viewports is set to the Corona docked interactive viewer.

This page https://docs.chaos.com/display/CRMAX/MAXScript suggests you can check this while currently rendering using getRenderType, but I can't see anything for when max is idle.

Obviously visually it's quite clear if the viewer is present, but I need to do this via script for a tool I'm working on.

Aram Avetisyan:
Hi,

Assuming Corona is set as active renderer, and regular viewports are used (no TrackView, materials, booleans etc.), we can check for layout and get the number of viewports/sections.
Then we can get the number of 3d viewports - 3ds Max seem to not count Corona Interactive as 3d viewport. If the layout number is bigger than 3d viewports, it is safe to tell (in regular/most cases) that the non-3d viewport is CoronaInteractive.

Here is the script:


--- Code: ---fn checkCoronaInteractiveViewport = (

numLayout = (viewport.getLayout() as string)[8] as integer
--format "Current layout viewports: %\n" (numLayout as string)
--format "Renderable viewport count: %\n" (viewport.numViews as string)

if viewport.numViews < numLayout then (
format "Corona Interactive viewport is present.\n"
True
)
else (
format "No Corona Interactive viewport.\n"
False
)
)

checkCoronaInteractiveViewport()

--- End code ---

Haven't checked for floating viewport case, but it should be easy to do through viewport IDs.

Hope this helps.

RecentSpacesSam:
Thanks Aram, that's exactly the problem I was running into.

I'll give this a whirl

Navigation

[0] Message Index

Go to full version