16
[Max] I need help! / Re: Maxscript: Test if one viewport is the interactive window
« on: 2025-03-14, 17:46:08 »
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:
Haven't checked for floating viewport case, but it should be easy to do through viewport IDs.
Hope this helps.
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.