MAXScript Language Reference > 3ds Max Objects > Interfaces > Core Interfaces > Core Interfaces Documentation > U,V,W,X,Y,Z >

# Interface: ViewPanelManager

Interfaces > Core Interfaces > ViewPanelManager

| Viewport Shading - Quick Navigation | Core Interfaces - Quick Navigation

This Core Interface exposes the View Panel Manager to MAXScript.

It provides methods for the creation and manipulation of View Panels containing custom viewport configurations, as well as methods for View Panel Presets management.

Available in 3ds Max 2013 and higher.

Methods:

## View Panel Creation

    <index>ViewPanelManager.CreateViewPanel <string>tabName <enum>layout <bool>isActive

    layout enums: {
    #layout_1 | #layout_2v | #layout_2h | #layout_2ht | #layout_2hb |
    #layout_3vl | #layout_3vr | #layout_3ht | #layout_3hb |
    #layout_4 | #layout_4vl | #layout_4vr | #layout_4ht | #layout_4hb }

Creates a new View Panel with the name specified by the first argument.

The second argument specifies the layout name - see table below.

The third argument controls whether the new View Panel will set as the active one.

Returns the index of the new View Panel.

Layout | Name | Description
--- | --- | ---
| #layout_1 | One viewport
| #layout_2v | Two Viewports, Vertical Split, Equally Sized
| #layout_2h | Two Viewports, Horizontal Split, Equally Sized
| #layout_2ht | Two Viewports, Horizontal Split, Top Viewport Smaller
| #layout_2hb | Two Viewports, Horizontal Split, Bottom Viewport Smaller
| #layout_3vl | Three Viewports, Vertical Split, Horizontal Split On Left
| #layout_3vr | Three Viewports, Vertical Split, Horizontal Split On Right
| #layout_3ht | Three Viewports, Horizontal Split, Vertical Split On Top
| #layout_3hb | Three Viewports, Horizontal Split, Vertical Split On Bottom
| #layout_4vl | Four Viewports, Vertical Split, Two Horizontal Splits On Left
| #layout_4vr | Four Viewports, Vertical Split, Two Horizontal Splits On Right
| #layout_4ht | Four Viewports, Horizontal Split, Two Vertical Splits On Top
| #layout_4hb | Four Viewports, Horizontal Split, Two Vertical Splits On Bottom
| #layout_4 | Four Viewports, Equally Sized

    <integer>ViewPanelManager.GetViewPanelCount()

Returns the number of View Panels.

    <bool>ViewPanelManager.SetActiveViewPanel <index>Index

Sets the active View Panel to the indexed definition.

Returns True on success, False on failure.

    <index>ViewPanelManager.GetActiveViewPanelIndex()

Returns the index of the active View Panel.

    <bool>ViewPanelManager.CanCreateMoreViewPanels()

Returns True if new View Panels can be created, False if the limit has been reached.

    <string>ViewPanelManager.GetViewPanelName <index>Index

Returns the name of the indexed View Panel.

    <bool>ViewPanelManager.SetViewPanelName <index>Index <string>newPanelName

Sets the name of the indexed View Panel to the string provided by the second argument.

    <value>ViewPanelManager.GetActiveViewPanelDib()

Returns the Device Independent Bitmap (Viewport Snapshot) of the active View Panel.

The image will contain the content of all viewports in the View Panel.

    <bool>ViewPanelManager.IsViewPanelLocked <index>Index

Returns True if the indexed View Panel is locked, False if it is not locked.

    <bool>ViewPanelManager.SetSplitterBarPos <integer>splitterBarID <float>pos

Sets the position of the horizontal or vertical splitter bar to the specified position.

The first argument is in the range from 0 to 2 and depends on the current layout:

Layout | Visible Bar Indices | Comments
--- | --- | ---
#layout_1 | None | No splitter bars are used, but 0,1 and 2 are still valid first arguments.
#layout_2v | 1 - vertical splitter bar | 0 and 2 are valid indices, but the corresponding splitter bars are not used.
#layout_2h #layout_2ht #layout_2hb | 0 - horizontal splitter bar | 1 and 2 are valid indices, but the corresponding splitter bars are not used.
#layout_3vl #layout_3vr #layout_3ht #layout_3hb | 0 - horizontal splitter bar 1 - vertical splitter bar | 2 is a valid index, but the corresponding splitter bar is not used.
#layout_4 | 0 - horizontal splitter bar 1 - vertical splitter bar | 2 is a valid index, but the corresponding splitter bar is not used.
#layout_4vl #layout_4vr | 0 - vertical splitter bar 1 - top horizontal splitter bar 2 - bottom horizontal splitter bar |
#layout_4ht #layout_4hb | 0 - horizontal splitter bar 1 - left vertical splitter bar 2 - right vertical splitter bar |

The second argument must be a float in the range from 0.0 to 1.0, with 0.5 being centered in the middle of the panel.

Returns True on success, False if the second argument is out of range. Note that attempting to set a non-visible splitter bar index still returns True.

    <bool>ViewPanelManager.SetExtendedView <integer>viewIndex <enum>extendedViewType

    extendedViewType enums: {#ev_type_tree|#ev_type_schematic|#ev_type_sceneexplore}

Sets the indexed extended view to the extended view type specified by the second argument's enum value.

Not all extended view types are currently supported.

Possible values are:

Enum | As Integer | Result
--- | --- | ---
#ev_type_tree | 0 | Set Extended Viewport to TrackView
#ev_type_schematic | 1 | Set Extended Viewport to Schematic View
#ev_type_sceneexplore | 2 | Set Extended Viewport to Scene Explorer

    <bool>ViewPanelManager.DestroyViewPanel <index>Index

Destroys the indexed View Panel.

Returns True on success, False on failure.

EXAMPLE
    theActive = ViewPanelManager.GetActiveViewPanelIndex()
    canCreate = ViewPanelManager.CanCreateMoreViewPanels()
    if canCreate do theNew = ViewPanelManager.CreateViewPanel "Two Horizontal Large Top" #layout_2h false
    ViewPanelManager.SetSplitterBarPos 0 0.65
    theCount = ViewPanelManager.GetViewPanelCount()
    for i = 1 to 2 do
    (
    	theName = ViewPanelManager.GetViewPanelName i
    	isLocked = ViewPanelManager.IsViewPanelLocked i
    	format "% Name:'%' Locked:% " i theName isLocked
    	if i == theActive then format "(active)\n" else format "\n"
    )
    theBitmap = ViewPanelManager.GetActiveViewPanelDib()
    display theBitmap
    ViewPanelManager.DestroyViewPanel theNew
LISTENER OUTPUT AND COMMENTS
    1 --value of theActive
    true --value of canCreate
    2 --value of theNew
    true --set splitter bar
    2 --number of panels
    1 Name:'Layout: Quad 4' Locked:true (active)
    2 Name:'Two Horizontal Large Top' Locked:false
    OK
    BitMap: --get the Device Independent Bitmap
    OK --displaying the bitmap
    true --destroying the new panel
    OK

## View Panel Preset Management

    <integer>ViewPanelManager.GetPresetCount()

Returns the number of available named View Panel presets.

    <string>ViewPanelManager.GetPresetName <index>presetIndex

Returns the name of the indexed View Panel Preset.

    <index>ViewPanelManager.GetPresetID <string>presetName

Returns the ID of the named View Panel Preset.

    <bool>ViewPanelManager.DoesViewPanelPresetExist <string>presetName

Returns True if a View Panel Preset with the name specified by the argument exists.

Returns False if the View Panel Preset with the specified name does not exist.

    <integer>ViewPanelManager.GetViewPanelPresetLayout <integer>presetIndex

Returns the layout of the indexed View Panel Preset as an integer.

    <index>ViewPanelManager.CreateViewPanelFromPreset <string>presetName <bool>isActive

Creates a new View Panel from the specified named preset.

If the second argument is set to True, the View Panel will also be made active.

Returns the index of the new View Panel.

    <bool>ViewPanelManager.CreatePresetFromActiveViewPanel <string>presetName

Creates a new Preset with the specified name from the active View Panel.

If the name already exists, it will be appended a numeric suffix, e.g. "Test" will become "Test 01".

Returns True on success, False on failure.

    <bool>ViewPanelManager.CreatePresetFromViewPanel <index>panelIndex <string>presetName

Creates a new Preset from the indexed View Panel specified by the first argument.

The Preset will be named according to the second argument.

Returns True on success, False on failure.

    <bool>ViewPanelManager.RenameViewPanelPreset <string>presetName <string>newName

Renames the View Panel Preset specified by the first argument to the name given by the second argument.

Returns True if the renaming succeeded.

Returns False if a Preset with the name specified by the first argument does not exist.

    <bool>ViewPanelManager.DeletePreset <string>presetName

Deletes the named View Panel Preset.

Returns True on success.

Returns False if the named Preset does not exist.

    <bool>ViewPanelManager.DeleteAllViewPanelPresets()

Deletes all View Panel Presets.

Returns True on success, False on failure.

EXAMPLE
    theNewPresetName = "Just A Test"
    if not ViewPanelManager.DoesViewPanelPresetExist theNewPresetName do
      ViewPanelManager.CreatePresetFromActiveViewPanel theNewPresetName
    ViewPanelManager.RenameViewPanelPreset theNewPresetName "A Test Indeed"
    theCount = ViewPanelManager.GetPresetCount()
    for i = 1 to theCount do
    (
      theName = ViewPanelManager.GetPresetName i
      theLayout = ViewPanelManager.GetViewPanelPresetLayout i
      format "% Name:'%' Layout:'%' \n" i theName theLayout
    )
    ViewPanelManager.DeletePreset theNewPresetName
    ViewPanelManager.DeletePreset "A Test Indeed"
LISTENER OUTPUT AND COMMENTS
    "Just A Test" --new preset name
    true --create a preset from current view panel
    true --rename the new preset to "A Test Indeed"
    1 --number of presets currently stored, let's print:
    1 Name:'A Test Indeed' Layout:'-1'
    OK
    false --trying to delete the old name fails
    true --because the preset has a new name!
    OK