Interface: ActiveShadeFragmentManager
The ActiveShadeFragmentManager Interface provides MAXScript access to the viewport ActiveShade mode, where a viewport can display using the ActiveShade renderer but maintain interactive capabilities. Available in 3ds Max 2019.3 Update and higher.
Properties:
None
Methods:
<boolean>ToggleInActiveViewport()
Toggles the ActiveShade viewport mode. Returns true if the mode was toggled on or off, and false if something went wrong and the mode was not toggled.
<boolean>SetRenderRegionInActiveViewport <float>left <float>top <float>right <float>bottom
Sets the region to render in the active viewport. The left, top, right, and bottom parameters are floats in the range of 0.0 to 1.0, and specify 2D coordinates to set as the ActiveShade render region where (0.0, 0.0) is the top left corner, and (1.0, 1,0) is the bottom right. The rest of the viewport will be rendered with the default viewport renderer (typically Nitrous). For example, passing 0.0 0.0 0.5 0.5
will cause the top left quarter of the viewport to render with ActiveShade.
<void>RemoveActiveShadeFragmentFromAllViewports()
Turns ActiveShade mode off for all viewports.
Currently, only one viewport at a time can run in ActiveShade render mode, but this might change in the future.
<int by value array>GetRunningActiveShadeViewportsIndices()
GetRunningActiveShadeViewportsIndices - no automatic redraw after invoked
Returns an array of two integers indicating which viewport is running in ActiveShade render mode. The first integer is the index of the view panel, and the second is the index of the viewport in the panel running in ActiveShade render mode. Note that these indices are 0-based.
<boolean>IsRunningInActiveViewport()
IsRunningInActiveViewport - no automatic redraw after invoked
Returns true if the currently active viewport is running in ActiveShade mode.
<boolean>IsRunningInViewport <integer>ZeroBasedViewPanelIndex <integer>ZeroBasedViewportIndex
IsRunningInViewport - no automatic redraw after invoked
Returns true if the viewport specified by view panel index and viewport index is running in ActiveShade render mode. Note that these indices are 0-based.
<boolean>IsRunningInAtLeastOneViewport()
IsRunningInAtLeastOneViewport - no automatic redraw after invoked
Returns true if at least one viewport is running in ActiveShade mode.
<boolean>CurrentActiveShadeRendererSupportsConcurrentRendering()
CurrentActiveShadeRendererSupportsConcurrentRendering - no automatic redraw after invoked
Returns true if the currently selected ActiveShade renderer supports concurrent rendering (rendering multiple scenes at once).
For Example
global asfm = ActiveShadeFragmentManager
vp_indices = asfm.GetRunningActiveShadeViewportsIndices()
format "This should be 0: %" vp_indices.count
-- check that there is no ActiveShade
isASFMRunning()
-- now toggle
asfm.ToggleInActiveViewport()
-- should be running in the active viewport
isASFMRunning()
-- set the active render region to the top left quarter of the viewport
asfm.SetRenderRegionInActiveViewport 0.0 0.0 0.5 0.5
-- now turn off again
asfm.RemoveActiveShadeFragmentFromAllViewports()
function isASFMRunning = (
format "Is running in active viewport? %\n" (asfm.IsRunningInActiveViewport())
format "Is running in any viewport? %\n" (asfm.IsRunningInAtLeastOneViewport())
format "Lets check each viewport"
panel_index = ViewPanelManager.GetActiveViewPanelIndex()
-- note that the panel index and viewport index are 0-based, so we must subtract 1 for MXS interop
for i = 0 to viewport.numViews-1 do (
format "Running in viewport index %? %\n" i (asfm.IsRunningInViewport (panel_index-1) i)
)
)
Actions:
None