Author Topic: Maxscript: Test if one viewport is the interactive window  (Read 356 times)

2025-03-14, 14:11:07

RecentSpacesSam

  • Active Users
  • **
  • Posts: 103
    • View Profile
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.

2025-03-14, 17:46:08
Reply #1

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 855
    • View Profile
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: [Select]
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()

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

Hope this helps.
« Last Edit: 2025-03-14, 17:56:14 by Aram Avetisyan »
Aram Avetisyan | chaos-corona.com
Chaos Corona QA Specialist | contact us

2025-03-17, 14:52:27
Reply #2

RecentSpacesSam

  • Active Users
  • **
  • Posts: 103
    • View Profile
Thanks Aram, that's exactly the problem I was running into.

I'll give this a whirl