Saturday, 16 March 2013

Toggle Viewport Style

I typically use two viewport settings: 1 default light with no shadows/AO, and scene lights with shadows/AO. And I always disable gamma/LUT correction. This script helps me set that up really quickly, and switch between the two.



  
  
-- MixeScript snippet: Toggle ViewStyle
-- toggles between default lights, no shadows and scene lights. also disables gamma/LUT and hides/shows cameras and lights.

--USAGE
-- run script to toggle between the two viewport styles

--SETTINGS
DisableGammaLUTCorrection = true --if you want to use Gamma/LUT correction, set this to false

if NitrousGraphicsManager.IsEnabled() == false then (
 messagebox("Please change your renderer to Nitrous and restart Max if you wish to use the Viewport Setups")
) else (

 actionMan.executeAction -844228238 "1"  -- Viewport Lighting and Shadows: Viewport Visual Style Realistic
 if DisableGammaLUTCorrection then (IDisplayGamma.colorCorrectionMode = #none)
 disp = NitrousGraphicsManager.GetActiveViewportSetting() 
 
 if disp.LightOption != #SceneLight then (
  disp.LightOption = #SceneLight
  disp.ShadowsEnabled = true
  disp.AmbientOcclusionEnabled = true
  hideByCategory.lights = false
  hideByCategory.cameras = false
 ) else (
  disp.LightOption = #DefaultLight
  disp.DefaultLightMode = #OneLight
  disp.ShadowsEnabled = false
  disp.AmbientOcclusionEnabled = false
  hideByCategory.lights = true
  hideByCategory.cameras = true
 )
)
  

No comments:

Post a Comment