Interface: NitrousGraphicsManager

Interfaces > Core Interfaces > NitrousGraphicsManager

 

   

Core Interfaces - Quick Navigation

This Core Interface exposes the Nitrous Graphics Manager to MAXScript.

Available in 3ds Max 2012 and higher.

   

Interface: NitrousGraphicsManager

   

Properties:

NitrousGraphicsManager.MakePreviewQuality : integer : Read|Write

Get/set the number of progressive refinement passes to be performed when generating a preview animation using the Make Preview feature of 3ds Max.

Default is 16.

See also the createPreview Method topic for details on controlling the Make Preview feature via MAXScript.

Available in 3ds Max 2013 and higher.

   

NitrousGraphicsManager.MultiThreadedShaderCompileMode : bool : Read|Write

Get/set whether the compiling of shaders will use multiple threads (True) or a single thread (False).

Default is True.

Available in 3ds Max 2013 and higher.

   

NitrousGraphicsManager.ChangeCursorOnMouseMove : bool : Read|Write

Get/set whether to change the cursor on mouse move.

When set to True (default), the mouse cursor will change its icon to represent the current mode when over an object and return to an arrow when no object is found underneath.

When set to False, the mouse cursor will remain an arrow and will not change when over an object. Tooltips will still be displayed and hit-testing will be performed on left mouse click.

Available in 3ds Max 2013 and higher.

   

NitrousGraphicsManager.BackfaceCullWireframeEnabled : bool : Read|Write

Default is True.

Available in 3ds Max 2014 and higher.

   

NitrousGraphicsManager.ShadowmapSizeLimit : integer : Read|Write

Get/set the Shadow Map Size Limit. Default is 512.

Available in 3ds Max 2014 and higher.

   

NitrousGraphicsManager.NormalBumpMode : integer : Read|Write

Get/set the Normal Bump Mode controlled via radio buttons in the Customize menu > Preferences dialog > General tab.

Possible values are:

0 - 3ds Max (default)

1 - Maya

2 - DirectX

Available in 3ds Max 2014 and higher.

   

NitrousGraphicsManager.BackgroundProgressiveRenderingEnabled : bool : Read|Write

Get/set whether the Nitrous will perform progressive refinements when 3ds Max is not in focus.

When set to False (default), Nitrous will not perform progressive refinements when 3ds Max is running in the background.

When set to True, progressive refinement will be performed even when 3ds Max is running in the background.

Note that this can cause performance issues. Use At Your Own Risk!

Available in 3ds Max 2014 and higher.

   

NitrousGraphicsManager.HardwareHitTestEnabled : bool : Read|Write

NEW in 3ds Max 2015: Get/set the state of the Hardware Hit Testing in the viewport.

Default is True.

   

NitrousGraphicsManager.AntialiasingQuality : enum : Read|Write 
    AntialiasingQuality enums: {#None|#2X|#4X|#8X}

NEW in 3ds Max 2015: Get/set the Nitrous viewport Anti-Aliasing quality.

Default is #none .

   

Methods:

General Nitrous Access

<IObject>NitrousGraphicsManager.GetActiveViewportSetting()

Returns a <IObject:ViewportViewSettingImpl> object which exposes the Interface to access the settings of the active viewport.

See further of this page for details.

   

<IObject>NitrousGraphicsManager.GetViewportSetting <integer>index

Returns a <IObject:ViewportViewSettingImpl> object which exposes the settings of the specified indexed viewport.

The parameter used to be 0-based in previous versions, it is 1-based in 3ds Max 2014 and higher.

See further of this page for details.

   

<IObject>NitrousGraphicsManager.GetWorldSetting()

Returns a <IObject:WorldSettingImpl> object which exposes the world optimization settings.

See further of this page for details.

Available in 3ds Max 2014 and higher.

   

<bool>NitrousGraphicsManager.IsEnabled() 

Returns True if the Nitrous Graphics system is enabled, False otherwise.

   

<bool>NitrousGraphicsManager.ProgressiveRendering()

Triggers progressive rendering.

Returns True on success, False of failure.

Available in 3ds Max 2013 and higher.

   

<bool>NitrousGraphicsManager.IsProgressiveRenderingFinished()

Returns True of the progressive refinement for the current frame has finished, False otherwise.

Available in 3ds Max 2013 and higher.

   

Texture Size Settings

<bool>NitrousGraphicsManager.SetTextureSizeLimit <integer>sizeLimit <bool>enabled

Sets the Nitrous Graphics System's texture size limit.

The first argument specifies the texture size limit in pixels.

The second argument controls the enabled state of the texture size limit - when passed as True, the limit will be enabled, when passed as False, it will be disabled.

Returns True on success, False on failure.

NOTE:When loading scenes with large amounts of texture data, Nitrous might start paging memory and become very slow. Setting the Texture Size Limit to a value of 256 and enabling the limit can restore the viewport performance by eliminating the memory paging.

   

<bool>NitrousGraphicsManager.SetBackgroundTextureSizeLimit <integer>sizeLimit <bool>enabled

Sets the Nitrous Graphics System's background texture size limit.

The first argument specifies the texture size limit in pixels.

The second argument controls the enabled state of the texture size limit - when passed as True, the limit will be enabled, when passed as False, it will be disabled.

Returns True on success, False on failure.

   

<void>NitrousGraphicsManager.SetProceduralTextureSizeLimit <integer>sizeLimit

NEW in 3ds Max 2015: Sets the maximum procedural texture size to the specified limit value.

Procedural textures have to be rendered as 2D bitmaps before they can be displayed in the viewport. This method lets you limit the size of these bitmaps to avoid running out of graphics card memory when working in scenes with many procedural textures.

   

<void>NitrousGraphicsManager.ForceDisableMipMapGeneration <bool>bDisable

NEW in 3ds Max 2015: When the argument is passed as True, this method will disable the MipMap generation of viewport textures. When passed as False, the MipMapping will be enabled.

MipMapping creates multiple resolutions of the same texture and looks up texels in the one whose resolution most closely matches the pixel distance in the viewport to avoid artefacts.

But the multiple resolutions of the MipMap require 33% more memory than a single high-resolution version of the same texture.

Thus, turning MipMap Generation off can save significant amounts of graphics card memory at cost of texture display quality.

   

Application Window Size and Position

<bool>NitrousGraphicsManager.SetAppWindowSize <integer>width <integer>height

Sets the 3ds Max application window size to the given width and height arguments.

Note that this will affect the 3ds Max window even if it is Maximized.

Returns True on success, False of failure.

Available in 3ds Max 2013 and higher.

   

<bool>NitrousGraphicsManager.SetAppWindowPos <integer>x <integer>y

Sets the position of the upper left corner of the 3ds Max application window to the given x and y coordinates in desktop space.

Note that this will affect the 3ds Max window even if it is Maximized.

Returns True on success, False of failure.

Available in 3ds Max 2013 and higher.

   

Testing And Profiling

The following methods are for internal testing and profiling use only.

<bool>NitrousGraphicsManager.BeginPerformanceProfiling()

Starts collecting performance profiling data. For internal use only.

   

<bool>NitrousGraphicsManager.EndPerformanceProfiling()

Ends collecting performance profiling data. For internal use only.

   

<Integer64>NitrousGraphicsManager.GetSystemMemoryUsed()

Returns the Nitrous System memory usage in bytes as Integer64 value.

Available in 3ds Max 2013 and higher.

   

<bool>NitrousGraphicsManager.DumpMemoryInfo()

Writes the current Nitrous Graphics system memory usage to a default file in the root of the 3ds Max installation. For internal use only.

   

<bool>NitrousGraphicsManager.DumpMemoryInfoToFile <string>maxFileName <string>logFileName

Writes the current Nitrous Graphics system memory usage to the log file specified by the second argument. The first argument is the name of the 3ds Max scene. For internal use only.

   

<bool>NitrousGraphicsManager.CreateDummyObjects <string>className <integer>numberOfObjects

Creates a number of dummy objects in memory using the class name provided as first argument and the count provided as second argument. For internal use only.

   

<bool>NitrousGraphicsManager.RunMessageLoop()

Runs the Nitrous system message loop. For internal use only.

Returns True on success, False of failure.

Available in 3ds Max 2013 and higher.

   

<void>NitrousGraphicsManager.BeginPartialUpdateCompareTest()

Starts the partial update compare test. For internal use only.

Available in 3ds Max 2013 and higher.

   

<void>NitrousGraphicsManager.EndPartialUpdateCompareTest()

Ends the partial update compare test. For internal use only.

Available in 3ds Max 2013 and higher.

   

<bool>NitrousGraphicsManager.GetPartialUpdateCompareTestResult()

Returns True if the partial update compare test succeeded, False if it did not pass. For internal use only.

Available in 3ds Max 2013 and higher.

   

<bool>NitrousGraphicsManager.ApplyViewportViewSettingToLegacyView <integer>index

For internal use only.

Available in 3ds Max 2013 and higher.

   

View Graph Saving And Loading

<bool>NitrousGraphicsManager.SaveViewGraph <integer>viewIndex <string>viewGraphName

NEW in 3ds Max 2015: Saves the View Graph of the indexed view to the specified name.

   

<bool>NitrousGraphicsManager.LoadViewGraph <integer>viewIndex <string>viewGraphName

NEW in 3ds Max 2015: Loads the View Graph with the name specified by the second argument in the indexed viewport specified by the first argument.

   

<bool>NitrousGraphicsManager.UnloadViewGraph <integer>viewIndex

NEW in 3ds Max 2015: Unloads the View Graph from the indexed viewport.

   

World Settings IObject Interface:

Interface: WorldSettingImpl

This interface is exposed by the IObject returned by the method NitrousGraphicsManager.GetWorldSetting()

Available in 3ds Max 2014 and higher.

Properties:

<WorldSettingImpl>.ConsolidationEnabled : bool : Read|Write

Get/set the state of the Consolidation option.

Default is True.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.InstanceEnabled : bool : Read|Write

Get/set the state of the Instancing option.

Default is True.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.StaticEnabled : bool : Read|Write

Default is True.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.MaxConsolidatableNodePrimitive : integer : Read|Write

Get/set the maximum number of consolidatable node primitives.

Default is 20000.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.MaxConsolidationCellPrimitive : integer : Read|Write

Get/set the maximum number of consolidation cell primitives.

Default is 200000.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.MinConsolidationCellPrimitive : integer : Read|Write

Get/set the minimum number of consolidation cell primitives.

Default is 50000.

Available in 3ds Max 2014 and higher.

   

<WorldSettingImpl>.MaxInstancableNodePrimitive : integer : Read|Write

Get/set the maximum number of instanceable node primitives.

Default is 10000.

Available in 3ds Max 2014 and higher.

   

Viewport Settings IObject Interfaces:

Interface: ViewportViewSettingImpl

The interface is exposed by the IObject returned by the methods NitrousGraphicsManager.GetActiveViewportSetting() and NitrousGraphicsManager.GetViewportSetting()

It exposes the viewport settings as seen in the "Visual Style & Appearance" tab of the "Viewport Configuration" dialog.

In addition, it provides scripted access to the parameters of the Non-Photorealistic Rendering styles and Viewport's Depth Of Field Bokeh effect introduced in 3ds Max 2013 which are not exposed to the User Interface.

Properties:

Visual Style group of controls

<ViewportViewSettingImpl>.VisualStyleMode : enum : Read|Write

VisualStyleMode enums: { #Realistic | #Shaded | #ConsistentColors | #HiddenLine | #Wireframe | #BoundingBox | #Clay | #Ink | #ColorInk | #Acrylic | #Tech | #Graphite | #ColorPencil | #Pastel }

Get/set the Viewport's Visual Style, including realistic, shaded and non-photorealistic modes. The property can be set as enum name or integer value. When getting, it will return the enum name.

Possible values are:

Numeric Value Enum Name  
0 #Realistic  
1 #Shaded  
2 #Facets

Retired in 3ds Max 2013

 
3 #ConsistentColors  
4 #HiddenLine  
5 #Wireframe  
6 #BoundingBox  
7 #Ink  
8 #ColorInk  
9 #Acrylic  
10 #Tech  
11 #Graphite  
12 #ColorPencil  
13 #Pastel  
14 #Clay  

   

<ViewportViewSettingImpl>.ShowEdgedFacesEnabled : bool : Read|Write

Get/set the state of the "Edged Faces" viewport option.

When set to False (default), no edged faces will be displayed.

When set to True, a wireframe representation of the geometry faces will be overlayed on top of shaded faces.

   

<ViewportViewSettingImpl>.UseTextureEnabled : bool : Read|Write

Get/set the state of the "Textures" viewport option.

When set to True (default), texture maps will be displayed in the viewports if enabled at material or map level.

When set to False, texture maps will never be shown regardless of the Show Map In Viewport settings.

   

<ViewportViewSettingImpl>.TransparencyEnabled : bool : Read|Write

Get/set the state of the "Transparency" viewport option.

When set to True (default), transparency will be displayed in the viewports.

When set to False, transparency will be ignored and all objects will be displayed using solid shading.

   

<ViewportViewSettingImpl>.UseEnvironmentBackgroundColorEnabled : bool : Read|Write

Get/set the state of the "Use Environment Background Color" viewport option.

When set to False (default), the viewport background color will be taken from the corresponding value in the Customize User Interface > Color tab dialog.

When set to True, the viewport background color will be taken from the Environment Background color found in the "Environment and Effects" dialog > "Environment" tab > "Common Parameters" rollout > "Background" group of controls.

   

Selection group of controls

<ViewportViewSettingImpl>.ShowSelectionBracketsEnabled : bool : Read|Write

Get/set the state of the "Selection Brackets" option.

When set to True (default), selected objects will show selection brackets in shaded mode to denote their selected state.

When set to False, selected objects will not show selection brackets - you could enable the .SelectedEdgeFacesEnabled mode to visualize the selected state.

   

<ViewportViewSettingImpl>.SelectedEdgedFacesEnabled : bool : Read|Write

Get/set the state of the "Display Selected With Edged Faces" option.

When set to True, selected objects will be displayed with edged faces if the scene is set to shaded mode.

When set to False (default), all objects will be displayed in the current style.

   

<ViewportViewSettingImpl>.ShadeSelectedFacesEnabled : bool : Read|Write

Get/set the state of the "Shade Selected Faces" option.

When set to True (default), selected faces in sub-object level will be shaded in a solid color.

When set to False, selected faces will be highlighted using colored edges.

   

<ViewportViewSettingImpl>.ShadeSelectedObjectsEnabled : bool : Read|Write

Get/set the state of the "Shade Selected Objects" option.

When set to True, selected objects will be displayed in shaded mode even if the scene is set to wireframe mode.

When set to False (default), all objects will be displayed in the current style.

   

General options

<ViewportViewSettingImpl>.DisableViewport : bool : Read|Write

Get/set the state of the "Disable" option.

When set to False (default), the viewport will be enabled and will redraw as needed.

When set to True, the viewport will be disabled and will only redraw when manually enforced.

   

<ViewportViewSettingImpl>.ViewportClippingEnabled : bool : Read|Write

Get/set the state of the "Viewport Clipping" option.

   

Lighting and Shadows group of controls

<ViewportViewSettingImpl>.LightOption : enum : Read|Write

LightOption enums: { #DefaultLight | #SceneLight }

Get/set the state of the "Lighting" > "Illuminate With..." radio buttons.

Possible values are:

#DefaultLight - illuminates the scene with one or two default lights according to the .DefaultLightMode property.

#SceneLight - illuminates using the scene lights, unless there are no scene lights in which case the illumination will fall back to the default lighting.

   

<ViewportViewSettingImpl>.DefaultLightMode : enum : Read|Write 

DefaultLightMode enums: { #OneLight | #TwoLights }

Get/set the state of the "Default Lights" radio buttons.

Possible values are:

#OneLight - illuminates the scene with one "headlight" placed behind the camera.

#TwoLights - illuminates the scene with two fixed lights.

   

<ViewportViewSettingImpl>.DefaultLightsFollowCamera : bool : Read|Write

Get/set the state of the "Default Lights Follow View Angle" checkbox.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.ShowHighlightEnabled : bool : Read|Write

Get/set the state of the "Highlights" option.

When set to True (default), specular highlights will be calculated in the viewports.

When set to False, no highlights will be calculated.

   

<ViewportViewSettingImpl>.AutoDisplaySelectedLightEnabled : bool : Read|Write

Get/set the state of the "Auto Display Selected Light" option.   

   

<ViewportViewSettingImpl>.ShadowMode : enum : Read|Write 

ShadowMode enums: { #HardShadow | #SoftShadow | #LightSettingShadow }

Removed from 3ds Max 2013.

Get/set the Shadows Style in 3ds Max 2012 - Hard Shadows, Soft Shadows or the Shadow type defined by the light source itself.

   

<ViewportViewSettingImpl>.LightingAndShadowQualityMode : enum : Read|Write

LightingAndShadowQualityMode enums: { #HardShadows | #SoftEdgedShadows | #0.125X | #0.25X | #0.5X | #1X | #2X | #4X | #8X | #16X }

Get/set the Lighting and Shadows Quality.

Corresponds to the Lighting and "Shadows Quality" slider.

Default is #1X .

Possible values are:

Numeric Value Enum Name UI Description
0 #HardShadows Point Lights/Hard Shadows
1 #SoftEdgedShadows Point Lights/Soft Shadows
2 #0.125X 0.125x - Very Low
3 #0.25X 0.25x - Low
4 #0.5X 0.5x - Medium
5 #1X 1.0x - Default
6 #2X 2.0x - High Quality
7 #4X 4.0x - High Quality
8 #8X 8.0x - High Quality
9 #16X 16.0x - Very High Quality

   

<ViewportViewSettingImpl>.UseSimplifiedSkyLight : bool : Read|Write

Get/set the state of the "Skylight as Ambient Color checkbox.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.ShadowsEnabled : bool : Read|Write

Get/set the state of the "Shadows" option.

When set to False (default), no shadows will be displayed in the viewports.

When set to True, lights with shadow casting enabled will also show shadows in the viewport using the quality settings described below:

   

<ViewportViewSettingImpl>.ShadowIntensity : float : Read|Write

Get/set the value of the "Shadows" > "Intensity/Fade" option.

   

   

<ViewportViewSettingImpl>.AmbientOcclusionEnabled : bool : Read|Write

Get/set the state of the "Ambient Occlusion" option.

When set to False (default), no ambient occlusion will be calculated.

When set to True, a screen-space ambient occlusion effect will be calculated using the settings described below:

   

<ViewportViewSettingImpl>.AmbientOcclusionRadius : float : Read|Write

Get/set the "Ambient Occlusion" > "Radius" value.

   

<ViewportViewSettingImpl>.AmbientOcclusionIntensity : float : Read|Write

Get/set the "Ambient Occlusion" > "Intensity/Fade" value.

   

   

<ViewportViewSettingImpl>.ReflectionEnabled : bool : Read|Write

Get/set the state of the "Reflection From Environment" checkbox.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.DynamicReflectionEnabled : bool : Read|Write

Get/set the state of the dynamic reflections option (currently not exposed to the UI).

When set to True, Materials with a Raytrace or Reflect/Refract map in their Reflection map slot will calculate dynamic reflections of the surrounding scene objects if switched to "Show Realistic Material In Viewport" mode.

When set to False (default), no dynamic reflections will be calculated.

Available in 3ds Max 2012 and higher.

   

Reflection Properties Result Notes

.ReflectionEnabled=off

 

When .ReflectionEnabled is off, the state of .DynamicReflectionEnabled is ignored.

.ReflectionEnabled=on

.DynamicReflectionEnabled=off

 

When .ReflectionEnabled is on, Environment Reflection Maps are shown if the Material has a Reflection Map and Show Realistic Material In Viewport is on.

.ReflectionEnabled=on

.DynamicReflectionEnabled=on

 

When both properties are on, both Environment Reflection Maps and Scene Objects will be reflected.

No reflections of reflections will be calculated though.

Reflections will look correct only on curved surfaces.

Other Properties Not Exposed To The UI

<ViewportViewSettingImpl>.ProgressiveFadingFactor : integer : Read|Write

Get/set the Progressive Fading Factor value.

This value controls the speed of the progressive refining of the viewport.

A value of 0 means converge immediately, values between 4 and 16 mean very fast refinement, higher values slow down the process exponentially.

Default is 32.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.UseViewportBackgroundEnabled : bool : Read|Write

No effect.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.UseSolidColor : bool : Read|Write

No effect.

Available in 3ds Max 2013 and higher.

   

Depth Of Field and Bokeh Effects

<ViewportViewSettingImpl>.DOFEnabled : bool : Read|Write

Get/set the state of the enable Depth Of Field option. Default is True.

The DOF viewport effect expects the view to be set to a Camera with a "depth of field (mental ray)" Multi-Pass effect to provide the f-stop value.

Available in 3ds Max 2013 and higher.

   

<ViewportViewSettingImpl>.BokehShape : filename : Read|Write

Get/set the bitmap filename of the Bokeh effect control image.

The Alpha channel of this bitmap controls the shape of the Bokeh effect, while the RGB control the color of the effect.

When set to an empty string "" (default), the DOF effect will produce a disk-shaped "circle of confusion".

Available in 3ds Max 2013 and higher.

   

Methods:

NPR Settings

Accessing NPR Parameters

<void><ViewportViewSettingImpl>.ShowNPRParameters()

Prints information about the NPR mode to the Listener including Parameter Name, Type, Value and Range. Returns OK.

   

<string by value><ViewportViewSettingImpl>.GetNPRParameterInfo()

Returns a string value containing information about the NPR mode including Parameter Name, Type, Value and Range. Similar to ShowNPRParameters() , but returns the info as a string value instead of printing to the Listener.

   

<integer><ViewportViewSettingImpl>.GetNPRParameterCount()

Returns the number of parameters in the current NPR mode.

   

<string by value><ViewportViewSettingImpl>.GetNPRParameterName <integer>index

Returns the name of the indexed parameter. The index is zero-based. If the index is out of range, the value of "No Parameter" is returned.

   

<enum><ViewportViewSettingImpl>.GetNPRParameterType <integer>index 

GetNPRParameterType enums: { #Unknown | #Bool | #Int | #Float | #Float4 | #String }

Returns the type of the indexed parameter. The index is zero-based. If the index is out of range, the value of #Unknown is returned.

   

Accessing Boolean Parameters

<bool><ViewportViewSettingImpl>.GetNPRBool <string>name

Returns the value of the named boolean parameter of the current NPR mode.

   

<void><ViewportViewSettingImpl>.SetNPRBool <string>name <boolean>value

Sets the value of the named boolean parameter of the current NPR mode to the boolean value passed as second argument.

   

Accessing Integer Parameters

<integer><ViewportViewSettingImpl>.GetNPRInt <string>name

Returns the value of the named integer parameter of the current NPR mode.

   

<integer><ViewportViewSettingImpl>.GetNPRMinInt <string>name

Returns the minimum value of the named integer parameter of the current NPR mode.

   

<integer><ViewportViewSettingImpl>.GetNPRMaxInt <string>name

Returns the maximum value of the named integer parameter of the current NPR mode.

   

<void><ViewportViewSettingImpl>.SetNPRInt <string>name <integer>value

Sets the value of the named integer parameter of the current NPR mode to the integer value passed as second argument.

   

Accessing Float Parameters

<float><ViewportViewSettingImpl>.GetNPRFloat <string>name

Returns the value of the named float parameter of the current NPR mode.

   

<float><ViewportViewSettingImpl>.GetNPRMinFloat <string>name

Returns the minimum value of the named float parameter of the current NPR mode.

   

<float><ViewportViewSettingImpl>.GetNPRMaxFloat <string>name

Returns the maximum value of the named float parameter of the current NPR mode.

   

<void><ViewportViewSettingImpl>.SetNPRFloat <string>name <float>value

Sets the value of the named float parameter of the current NPR mode to the float value passed as second argument.

   

Accessing Float4 Parameters

<point4><ViewportViewSettingImpl>.GetNPRFloat4 <string>name

Returns the value of the named float4 parameter of the current NPR mode.

   

<point4><ViewportViewSettingImpl>.GetNPRMinFloat4 <string>name

Returns the minimum value of the named float4 parameter of the current NPR mode.

   

<point4><ViewportViewSettingImpl>.GetNPRMaxFloat4 <string>name

Returns the maximum value of the named float4 parameter of the current NPR mode.

   

<void><ViewportViewSettingImpl>.SetNPRFloat4 <string>name <point4>value

Sets the value of the named float4 parameter of the current NPR mode to the Point4 value passed as second argument.

   

Accessing String Parameters

<string by value><ViewportViewSettingImpl>.GetNPRString <string>name

Returns the value of the named string parameter of the current NPR mode.

   

<void><ViewportViewSettingImpl>.SetNPRString <string>name <string>value

Sets the value of the named string parameter of the current NPR mode to the string value passed as second argument.

   

EXAMPLE:

disp = NitrousGraphicsManager.GetActiveViewportSetting() 
for visStyle = 0 to 13 do 
(
 	disp.VisualStyleMode = visStyle
 	format "\n--Visual Style: %--\n\n" (disp.VisualStyleMode as string)
 	format "%\n" (disp.GetNPRParameterInfo())
 	local paramCount = disp.GetNPRParameterCount()
 	for p = 0 to paramCount-1 do
 	(
  		theName = (disp.GetNPRParameterName p)
  		theType = (disp.GetNPRParameterType p)
  		theValue = case theType of
  		(
   			#bool: disp.GetNPRBool theName
   			#int: disp.GetNPRInt theName
   			#float: disp.GetNPRFloat theName
   			#float4: disp.GetNPRFloat4 theName
   			#string: disp.GetNPRString theName
  		)
  		theRange = case theType of
  		(
   			#int: ("[" +disp.GetNPRMinInt theName as string + ", " + disp.GetNPRMaxInt theName as string + "]")
   			#float: ("[" +disp.GetNPRMinFloat theName as string + ", " + disp.GetNPRMaxFloat theName as string + "]")
   			#float4: ("[" +disp.GetNPRMinFloat4 theName as string + ", " + disp.GetNPRMaxFloat4 theName as string + "]")
   			default: ""
  		)
  		format "%: Name:\"%\" Type: % Value: % %\n" p theName (theType as string) theValue theRange
 	) 
)

   

The following scripted dialog exposes all parameters of the current Viewport Style Mode (if any) in a dynamic rollout for interactive tweaking. It also supports the NPR settings of the Quicksilver renderer and allows you to set the viewport and the renderer at the same time, thus giving an instant preview of the Quicksilver settings in the active viewport:

SCRIPT:

macroScript NPRExplorer category:"MXS Help"
(
	global Nitrous_NPR_Rollout, Nitrous_NPR_SubRollout
	global Nitrous_NPR_Settings = NitrousGraphicsManager.GetActiveViewportSetting()
	try(destroyDialog Nitrous_NPR_Rollout)catch()
	local theINIfile = (getDir #plugcfg + "\\Nitrous_NPR_Settings.ini")
	rcmenu Nitrous_NPR_Menu 
	(
		subMenu "File"
		(
			menuItem mnu_savePreset "SAVE Current Mode To Preset File..."
			menuItem mnu_loadPreset "LOAD Current Mode From Preset File..."
		)
		on mnu_savePreset picked do Nitrous_NPR_Rollout.savePreset()
		on mnu_loadPreset picked do Nitrous_NPR_Rollout.loadPreset()		
	)
	rollout Nitrous_NPR_Rollout "Nitrous NPR Settings"
	(
		
		radiobuttons rad_SystemToAffect labels:#("Views","Quicksilver","Both")
		dropdownlist ddl_NPRMode items:#("Realistic", "Shaded", "ConsistentColors", "Wireframe", "BoundingBox", "Ink", "ColorInk", "Acrylic", "Tech", "Graphite", "ColorPencil", "Pastel", "Clay")  height:15
		subRollout sub_rollout width:200 height:320

		fn createSubRollout source:1 =
		(
			try(removeSubRollout sub_rollout Nitrous_NPR_SubRollout)catch()
			Nitrous_NPR_Settings = case source of
			(
				default: NitrousGraphicsManager.GetActiveViewportSetting()
				2: renderers.current
			)
			currentMode = case source of
			(
				default: Nitrous_NPR_Settings.VisualStyleMode
				2: Nitrous_NPR_Settings.VisualStyle
			)
			local theString = "rollout Nitrous_NPR_SubRollout \"Nitrous:"+currentMode as string +" Mode\" width:200 (\n"
			local paramCount = Nitrous_NPR_Settings.GetNPRParameterCount()
			if paramCount == 0 do theString += "label lbl_1 \"The Current Shading Mode\"\n label lbl_2 \"Exposes No Parameters!\"\n"
			for p = 0 to paramCount-1 do
			(
				theName = Nitrous_NPR_Settings.GetNPRParameterName p
				case (Nitrous_NPR_Settings.GetNPRParameterType p) of
				(
					#int: (
							theRange= (Nitrous_NPR_Settings.GetNPRMinInt theName) as string + ", " + (Nitrous_NPR_Settings.GetNPRMaxInt theName) as string +", "+ (Nitrous_NPR_Settings.GetNPRInt theName) as string
							theString += "spinner spn_"+p as string + " \""+ theName + "\" type:#integer range:["+theRange+"] fieldwidth:50\n"
							theString += "on spn_"+p as string + " changed val do (::Nitrous_NPR_Settings.SetNPRInt \""+theName as string+"\" val; ::Nitrous_NPR_Rollout.updateRenderer())\n"
							)
					#float: (
							theRange = (Nitrous_NPR_Settings.GetNPRMinFloat theName) as string + ", " + (Nitrous_NPR_Settings.GetNPRMaxFloat theName) as string +", "+ (Nitrous_NPR_Settings.GetNPRFloat theName) as string
							theString += "spinner spn_"+p as string + " \""+ theName + "\" type:#float range:["+theRange+"] fieldwidth:50\n"
							theString += "on spn_"+p as string + " changed val do (::Nitrous_NPR_Settings.SetNPRFloat \""+theName as string+"\" val; ::Nitrous_NPR_Rollout.updateRenderer()) \n"
						)
					#float4: (
							theString += "colorpicker clr_"+p as string + " \""+ theName + "\" alpha:true align:#right color:["+(Nitrous_NPR_Settings.GetNPRFloat4 theName) as string+"] fieldwidth:50\n"
							theString += "on clr_"+p as string + " changed val do (::Nitrous_NPR_Settings.SetNPRFloat4 \""+theName as string+"\" (val as Point4); ::Nitrous_NPR_Rollout.updateRenderer())\n"
						)						
					#bool: (
							theString += "checkbox chk_"+p as string + " \""+ theName + "\" checked:"+(Nitrous_NPR_Settings.GetNPRBool theName) as string +"\n"
							theString += "on chk_"+p as string + " changed val do (::Nitrous_NPR_Settings.SetNPRBool \""+theName as string+"\" val; ::Nitrous_NPR_Rollout.updateRenderer())\n"
						)
					#string: (
							theString += "edittext edt_"+p as string + " \""+ theName + "\" text:\""+(Nitrous_NPR_Settings.GetNPRString theName) +"\" \n"
							theString += "on edt_"+p as string + " entered val do (::Nitrous_NPR_Settings.SetNPRString \""+theName as string+"\" val; ::Nitrous_NPR_Rollout.updateRenderer())\n"
						)						
				)--end case
			)--end p loop
			theString += ")"
			execute theString
			addSubRollout sub_rollout Nitrous_NPR_SubRollout
		)--end fn 	
		
		fn updateRenderer =
		(
			if rad_SystemToAffect.state == 3 do
			(
				renderers.current.VisualStyle = Nitrous_NPR_Settings.VisualStyleMode
				local paramCount = Nitrous_NPR_Settings.GetNPRParameterCount()
				for p = 0 to paramCount-1 do
				(
					local theName = Nitrous_NPR_Settings.GetNPRParameterName p
					case (Nitrous_NPR_Settings.GetNPRParameterType p) of
					(
						#int: (renderers.current.SetNPRInt theName (Nitrous_NPR_Settings.GetNPRInt theName))
						#float: (renderers.current.SetNPRFloat theName (Nitrous_NPR_Settings.GetNPRFloat theName))
						#float4: (renderers.current.SetNPRFloat4 theName (Nitrous_NPR_Settings.GetNPRFloat4 theName))
						#bool: (renderers.current.SetNPRBool theName (Nitrous_NPR_Settings.GetNPRBool theName))
						#string: (renderers.current.SetNPRString theName (Nitrous_NPR_Settings.GetNPRString theName))
					)--end case
				)--end p loop			
			)
		)		
		fn savePreset =
		(
			local theStyle = Nitrous_NPR_Settings.VisualStyleMode
			local paramCount = Nitrous_NPR_Settings.GetNPRParameterCount()
			if paramCount > 0 then
			(
				local theFile = getSaveFileName caption:("Save "+ theStyle as string +" Settings As...") types:"Nitrous NPR Presets (*.NPR)|*.NPR"
				if theFile != undefined do
				(
					for p = 0 to paramCount-1 do
					(
						local theName = Nitrous_NPR_Settings.GetNPRParameterName p
						local theFN = case (Nitrous_NPR_Settings.GetNPRParameterType p) of
						(
							#int: Nitrous_NPR_Settings.GetNPRInt
							#float: Nitrous_NPR_Settings.GetNPRFloat
							#float4: Nitrous_NPR_Settings.GetNPRFloat4
							#bool: Nitrous_NPR_Settings.GetNPRBool
							#string: Nitrous_NPR_Settings.GetNPRString
						)
						setIniSetting theFile (theStyle as string) (theName as string) ((theFN theName) as string)
					)--end p loop
				)
			)--end if
		)
		fn loadPreset =
		(
			local theStyle = Nitrous_NPR_Settings.VisualStyleMode
			local paramCount = Nitrous_NPR_Settings.GetNPRParameterCount()
			if paramCount > 0 then
			(
				local theFile = getOpenFileName caption:("Load "+ theStyle as string +" Settings From...") types:"Nitrous NPR Presets (*.NPR)|*.NPR"
				if theFile != undefined do
				(
					for p = 0 to paramCount-1 do
					(
						local theName = Nitrous_NPR_Settings.GetNPRParameterName p
						local theType = Nitrous_NPR_Settings.GetNPRParameterType p
						local theFN = case theType of
						(
							#int: Nitrous_NPR_Settings.SetNPRInt
							#float: Nitrous_NPR_Settings.SetNPRFloat
							#float4: Nitrous_NPR_Settings.SetNPRFloat4
							#bool: Nitrous_NPR_Settings.SetNPRBool
							#string: Nitrous_NPR_Settings.SetNPRString
						)
						local theVal = getIniSetting theFile (theStyle as string) (theName as string)
						if theVal != "" do
						(
							if theType != #string do theVal = execute theVal
							theFN theName theVal
						)
					)--end p loop
					createSubRollout source:rad_SystemToAffect.state
					updateRenderer()
				)--end if
			)--end if
		)		
		fn updateList =
		(
			local theMode = case rad_SystemToAffect.state of 
			( 
				default: Nitrous_NPR_Settings.VisualStyleMode
				2: Nitrous_NPR_Settings.VisualStyle
			)
			ddl_NPRMode.selection = findItem (for i in ddl_NPRMode.items collect i as name) theMode
		)
		on rad_SystemToAffect changed state do
		(
			local result = true
			local theClass = classof renderers.current
			if state > 1 and theClass != Quicksilver_Hardware_Renderer do 
			(
				result = querybox ("The current renderer is ["+theClass as string+"].\nClicking YES will replace it with Quicksilver.\n\nAre you sure you want to continue?") title:"Assign Quicksilver"
				if result then 
					renderers.current = Quicksilver_Hardware_Renderer()
			)
			if result then
			(
				createSubRollout source:state
				if state == 3 do updateRenderer()
				updateList()
			)
			else
				rad_SystemToAffect.state = 1
		)
		on ddl_NPRMode selected itm do
		(
			case rad_SystemToAffect.state of
			(
				default: Nitrous_NPR_Settings.VisualStyleMode =  ddl_NPRMode.selected as name
				2: Nitrous_NPR_Settings.VisualStyle =  ddl_NPRMode.selected as name
			)
			if rad_SystemToAffect.state == 3 do updateRenderer()
			createSubRollout source:rad_SystemToAffect.state
		)
		on Nitrous_NPR_Rollout open do 
		(
			createSubRollout()
			updateList()
		)
		on Nitrous_NPR_Rollout moved pos do
		(
			setIniSetting theINIfile "Dialog" "Position" (pos as string)
		)
	)
	local thePos = execute (getIniSetting theINIfile "Dialog" "Position")
	if thePos == OK do thePos = [100,100]
	createDialog Nitrous_NPR_Rollout 220 380 thePos.x thePos.y menu:Nitrous_NPR_Menu
)