:topic: Saving and Loading State Files

.. index::
   triple: DREAM3D-NX; Visualization; State File

.. _StateFiles:

Saving and Loading State Files
################################

Saving a State File
===============================

Before saving the visualization state to a DREAM3D-NX state file, there 
are a few important caveats to make note of;

-  The state files will not save any camera linking currently set between render window splits
-  The geometries loaded in the visualization must be saved to an associated supported file type (see :ref:`Importing Data From a File section<ImportingDataFromFile>`) in order to save the visualization state. 
-  If the geometry came from a DREAM3D-NX pipeline, then the last enabled filter of the pipeline must be the `Write DREAM3D Filter <../SimplnxCore/WriteDREAM3DFilter.html>`_

Once you have a valid state for saving, there are two ways to create a state file.

1. Select the option from the Visualization Pipeline Browser context menu.

   .. figure:: Images/70_StateFiles/VisualizationPipelineContextMenuSaveState.png
      :alt: Visualization Pipeline Browser Context Menu

      Visualization Pipeline Browser Context Menu

2. Select the option from the Visualization menu bar menu.

   .. figure:: Images/70_StateFiles/VisualizationMenuBarSaveState.png
      :alt: Visualization Menu Bar

      Visualization Menu Bar

Loading a State File
===============================

Before loading a state file, it is important to note that the current split 
views/render window settings will be cleared and any geometry data currently loaded 
into the visualization might be deleted. 

1. Make sure the *Render Properties* view is active. This will be docked
   along the right side of the DREAM3D-NX window by default along with the
   *Data Structure* tab.

   .. figure:: Images/20_ImportingData/RenderPropertiesView.png
      :alt: Render Properties View

      Render Properties View

2. Select the Load State option from one of two menu locations;
   
   a. Right-click an item in the *Visualization Pipeline Browser* section
      of the *Render Properties* view and select the **Load State** option
      from the context menu that appears

      .. figure:: Images/70_StateFiles/VisualizationPipelineContextMenuLoadState.png
         :alt: Visualization Pipeline Browser Context Menu

         Visualization Pipeline Browser Context Menu


   b. Navigate to the Visualization menu bar menu and select the **Load State** option.

      .. figure:: Images/70_StateFiles/VisualizationMenuBarLoadState.png
         :alt: Visualization Menu Bar

         Visualization Menu Bar

3. In the file browser that appears, navigate to the state file you wish to
   load and select **Open**. 3D geometric data found in any of the source
   files will be loaded into the *Visualization Pipeline Browser* tree,
   any color by data arrays contained in the source files will *automatically*
   be applied to the geometry when it renders, and all representation, filter,
   and render window settings will be restored.
