void EditorManager_CustomSceneSerialization(object sender, CustomSceneSerializationArgs e)
        {
            if (e.CustomSceneObjects.IsSaving)
              {
            if (TerrainEditor.CurrentTerrain != null) // only save data when a terrain is used
            {
              // get data from panel
              TerrainPanelSettings brushes = new TerrainPanelSettings();
              brushes.HeightmapCursor_Elevate = this._heightmapCursor_Elevate;
              brushes.HeightmapCursor_Flatten = this._heightmapCursor_Flatten;
              brushes.HeightmapCursor_Smooth = this._heightmapCursor_Smooth;
              brushes.HeightmapCursor_Holes = this._heightmapCursor_Holes;
              brushes.DetailTextureCursor = this._detailTextureCursor;
              brushes.VegetationCursor = this._decorationCursor;

              e.CustomSceneObjects.AddObject("TerrainEditorPlugin.EditorPlugin", brushes);
            }
              }
              else
              {
            TerrainPanelSettings brushes =
              (TerrainPanelSettings)e.CustomSceneObjects.FindObject("TerrainEditorPlugin.EditorPlugin", typeof(TerrainPanelSettings));
            if (brushes != null)
            {
              if (brushes.HeightmapCursor_Elevate != null) this._heightmapCursor_Elevate = brushes.HeightmapCursor_Elevate;
              if (brushes.HeightmapCursor_Flatten != null) this._heightmapCursor_Flatten = brushes.HeightmapCursor_Flatten;
              if (brushes.HeightmapCursor_Smooth != null) this._heightmapCursor_Smooth = brushes.HeightmapCursor_Smooth;
              if (brushes.HeightmapCursor_Holes != null) this._heightmapCursor_Holes = brushes.HeightmapCursor_Holes;
              if (brushes.DetailTextureCursor != null) this._detailTextureCursor = brushes.DetailTextureCursor;
              if (brushes.VegetationCursor != null) this._decorationCursor = brushes.VegetationCursor;
            }
              }
        }
 protected TerrainPanelSettings(SerializationInfo info, StreamingContext context)
 {
     HeightmapCursor_Elevate = (HeightmapCursorProperties)info.GetValue("HeightmapCursor_Elevate", typeof(HeightmapCursorProperties));
     HeightmapCursor_Flatten = (HeightmapCursorProperties)info.GetValue("HeightmapCursor_Flatten", typeof(HeightmapCursorProperties));
     HeightmapCursor_Smooth = (HeightmapCursorProperties)info.GetValue("HeightmapCursor_Smooth", typeof(HeightmapCursorProperties));
     HeightmapCursor_Holes = (HeightmapCursorProperties)info.GetValue("HeightmapCursor_Holes", typeof(HeightmapCursorProperties));
     DetailTextureCursor = (Cursor3DProperties)info.GetValue("DetailTextureCursor", typeof(Cursor3DProperties));
     VegetationCursor = (Cursor3DProperties)info.GetValue("VegetationCursor", typeof(Cursor3DProperties));
     if (SerializationHelper.HasElement(info, "BrushName"))
     {
       string file = info.GetString("BrushName");
       TerrainEditor.SetBrushByName(file);
     }
 }