Example #1
0
        private void ExportNormal()
        {
            if (Terrain.activeTerrain == null)
            {
                EditorUtility.DisplayDialog("OOPS!", "You must have a valid terrain in your scene!!", "OK");
                return;
            }

            GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);

            if (mgr.TileCount > 0)
            {
                string path = "Assets/GaiaMasks/";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, Gaia.Utils.FixFileName(m_maskName));
                mgr.ExportNormalmapAsPng(path);
                AssetDatabase.Refresh();

                EditorUtility.DisplayDialog("Export complete", " Your normal map has been saved to : " + path, "OK");
            }
        }
Example #2
0
        public static void PlayBWSession(string stampName, BWGGaiaExtConst.BWGStampFeatureType featureType, string packShortname)
        {
            // Enable stamp if it isn't already enabled
            MoveBWStamp(stampName, featureType, "Assets/BackwoodsGaming/GaiaPacks/Stamp/" + packShortname + "/Stamps/" + featureType + "/", 1);

            // Check to see if a terrain already exists in the scene.  If so, give user option to flatten.
            Terrain t = Gaia.TerrainHelper.GetActiveTerrain();

            if (t != null)
            {
                if (EditorUtility.DisplayDialog("WARNING", "You have an existing terrain in your scene!  Would you like to flatten it or Quit?", "Quit", "Flatten"))
                {
                    Debug.Log("Quit selected? ");
                    return;
                }

                // User chose to flatten terrain.
                GaiaWorldManager wm = new GaiaWorldManager(Terrain.activeTerrains);
                wm.FlattenWorld();
            }

            // Create Gaia root game object if it doesn't already exist in scene hierarchy.
            GameObject gaiaObj = GameObject.Find("Gaia");

            if (gaiaObj == null)
            {
                gaiaObj = new GameObject("Gaia");
            }

            // Check for Session Manager and create if it doesn't exist.
            GaiaSessionManager sessionMgr = null;
            GameObject         mgrObj     = GameObject.Find("Session Manager");

            if (mgrObj == null)
            {
                mgrObj     = new GameObject("Session Manager");
                sessionMgr = mgrObj.AddComponent <GaiaSessionManager>();
                mgrObj.transform.parent = gaiaObj.transform;
            }
            else
            {
                sessionMgr = mgrObj.GetComponent <GaiaSessionManager>();
            }

            // Find and load the saved session for this stamp
            sessionMgr.m_session = AssetDatabase.LoadAssetAtPath <GaiaSession>("Assets/BackwoodsGaming/GaiaPacks/Stamp/" + packShortname + "/Data/GS-" + stampName + ".asset");

            // Debug.Log("Session: " + sessionMgr.m_session.m_name);

            // Play the session after user confirms
            if (EditorUtility.DisplayDialog("Playback Session ?", "Are you sure you want to playback this session - this can not be undone ?", "Yes", "No"))
            {
                sessionMgr.PlaySession();
            }
        }
        void OnGUI()
        {
            //Set up the box style
            if (m_boxStyle == null)
            {
                m_boxStyle = new GUIStyle(GUI.skin.box);
                m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
                m_boxStyle.fontStyle        = FontStyle.Bold;
                m_boxStyle.alignment        = TextAnchor.UpperLeft;
            }

            //Setup the wrap style
            if (m_wrapStyle == null)
            {
                m_wrapStyle           = new GUIStyle(GUI.skin.label);
                m_wrapStyle.fontStyle = FontStyle.Normal;
                m_wrapStyle.wordWrap  = true;
            }

            //Text intro
            GUILayout.BeginVertical("Gaia Terrain Height Adjuster", m_boxStyle);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("The terrain height adjuster allows you to set the height of the terrains in your scene to the given height.", m_wrapStyle);
            GUILayout.EndVertical();

            Terrain terrain = Gaia.TerrainHelper.GetActiveTerrain();

            if (terrain != null)
            {
                m_maxTerrainHeight = terrain.terrainData.size.y;
            }

            m_terrainHeight = EditorGUILayout.Slider(GetLabel("New Terrain Height (m)"), m_terrainHeight, 0f, m_maxTerrainHeight);

            GUILayout.Space(5);

            EditorGUI.indentLevel++;
            if (DisplayButton(GetLabel("Adjust Terrain Heights")))
            {
                if (terrain == null)
                {
                    EditorUtility.DisplayDialog("OOPS!", "You must have at least one active terrain in your scene to use this feature!", "OK");
                    return;
                }

                GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);
                mgr.LoadFromWorld();
                mgr.SetHeightWU(m_terrainHeight);
                mgr.SaveToWorld();
            }
            EditorGUI.indentLevel--;
        }
Example #4
0
        private void ExportMask()
        {
            GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);

            if (mgr.TileCount > 0)
            {
                GaiaSessionManager gsm  = GaiaSessionManager.GetSessionManager();
                string             path = GaiaDirectories.GetExportDirectory(gsm.m_session);
                path = Path.Combine(path, PWCommon4.Utils.FixFileName(m_maskName));
                mgr.ExportSplatmapAsPng(path, m_selectedMask);
                Debug.Log("Created " + path);
                AssetDatabase.Refresh();
                EditorUtility.FocusProjectWindow();
                EditorUtility.DisplayDialog("Export complete", " Your texture mask has been saved to : " + path, "OK");
            }
            else
            {
                EditorUtility.DisplayDialog("OOPS!", "You must have a valid terrain!!", "OK");
            }
        }
Example #5
0
        private void ExportNormal()
        {
            if (Terrain.activeTerrain == null)
            {
                EditorUtility.DisplayDialog("OOPS!", "You must have a valid terrain in your scene!!", "OK");
                return;
            }

            GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);

            if (mgr.TileCount > 0)
            {
                GaiaSessionManager gsm  = GaiaSessionManager.GetSessionManager();
                string             path = GaiaDirectories.GetExportDirectory(gsm.m_session);
                mgr.LoadFromWorld();
                path = Path.Combine(path, PWCommon4.Utils.FixFileName(m_maskName));
                mgr.ExportNormalmapAsPng(path);
                AssetDatabase.Refresh();

                EditorUtility.DisplayDialog("Export complete", " Your normal map has been saved to : " + path, "OK");
            }
        }
        private void ExportMask()
        {
            GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);

            if (mgr.TileCount > 0)
            {
                string path = "Assets/GaiaMasks/";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, GaiaCommon1.Utils.FixFileName(m_maskName));
                mgr.ExportGrassmapAsPng(path);
                Debug.Log("Created " + path);
                AssetDatabase.Refresh();
                EditorUtility.DisplayDialog("Export complete", " Your gass mask has been saved to : " + path, "OK");
            }
            else
            {
                EditorUtility.DisplayDialog("OOPS!", "You must have a valid terrain!!", "OK");
            }
        }
Example #7
0
        void OnGUI()
        {
            //Set up the box style
            if (m_boxStyle == null)
            {
                m_boxStyle = new GUIStyle(GUI.skin.box);
                m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
                m_boxStyle.fontStyle        = FontStyle.Bold;
                m_boxStyle.alignment        = TextAnchor.UpperLeft;
            }

            //Setup the wrap style
            if (m_wrapStyle == null)
            {
                m_wrapStyle           = new GUIStyle(GUI.skin.label);
                m_wrapStyle.fontStyle = FontStyle.Normal;
                m_wrapStyle.wordWrap  = true;
            }

            //Text intro
            GUILayout.BeginVertical("Gaia WaterFlow Mask Exporter", m_boxStyle);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("The Gaia waterflow exporter allows you to calculate and export a water flow mask from your terrain.", m_wrapStyle);
            GUILayout.EndVertical();

            if (string.IsNullOrEmpty(m_maskName))
            {
                m_maskName = string.Format("TerrainWaterFlow-{0:yyyyMMdd-HHmmss}", DateTime.Now);
            }
            m_maskName = EditorGUILayout.TextField(GetLabel("Mask Name"), m_maskName);

            m_waterFlowMap.m_dropletVolume             = EditorGUILayout.Slider(GetLabel("Droplet Volume"), m_waterFlowMap.m_dropletVolume, 0.1f, 2f);
            m_waterFlowMap.m_dropletAbsorbtionRate     = EditorGUILayout.Slider(GetLabel("Droplet Absorbtion Rate"), m_waterFlowMap.m_dropletAbsorbtionRate, 0.01f, 1f);
            m_waterFlowMap.m_waterflowSmoothIterations = EditorGUILayout.IntSlider(GetLabel("Smooth Iterations"), m_waterFlowMap.m_waterflowSmoothIterations, 0, 10);

            GUILayout.Space(5);

            EditorGUI.indentLevel++;
            if (DisplayButton(GetLabel("Create Mask")))
            {
                Terrain terrain = Gaia.TerrainHelper.GetActiveTerrain();
                if (terrain == null)
                {
                    EditorUtility.DisplayDialog("OOPS!", "You must have a valid terrain!!", "OK");
                    return;
                }
                GaiaSessionManager gsm  = GaiaSessionManager.GetSessionManager();
                string             path = GaiaDirectories.GetExportDirectory(gsm.m_session);

                path = Path.Combine(path, PWCommon4.Utils.FixFileName(m_maskName));

                m_waterFlowMap.CreateWaterFlowMap(terrain);
                m_waterFlowMap.ExportWaterMapToPath(path);


                GaiaWorldManager mgr = new GaiaWorldManager(Terrain.activeTerrains);
                mgr.LoadFromWorld();

                path += "WaterFlow";
                mgr.ExportWaterflowMapAsPng(m_waterFlowMap.m_waterflowSmoothIterations, path);

                AssetDatabase.Refresh();
                EditorUtility.DisplayDialog("Done!", "Your mask is available at " + path, "OK");
            }
            EditorGUI.indentLevel--;
        }
Example #8
0
        public override void OnInspectorGUI()
        {
            //Get our resource
            m_manager = (GaiaSessionManager)target;

            //Set up the box style
            if (m_boxStyle == null)
            {
                m_boxStyle = new GUIStyle(GUI.skin.box);
                m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
                m_boxStyle.fontStyle        = FontStyle.Bold;
                m_boxStyle.alignment        = TextAnchor.UpperLeft;
            }

            //Setup the wrap style
            if (m_wrapStyle == null)
            {
                m_wrapStyle          = new GUIStyle(GUI.skin.label);
                m_wrapStyle.wordWrap = true;
            }

            //Set up the description wrap style
            if (m_descWrapStyle == null)
            {
                m_descWrapStyle          = new GUIStyle(GUI.skin.textArea);
                m_descWrapStyle.wordWrap = true;
            }

            //Scroll
            m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition, false, false);

            //Create a nice text intro
            GUILayout.BeginVertical("Gaia Session Manager", m_boxStyle);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("Track and control session creation and playback.", m_wrapStyle);
            GUILayout.Space(4);
            EditorGUILayout.BeginHorizontal();
            m_manager.m_session = (GaiaSession)EditorGUILayout.ObjectField(GetLabel("Session"), m_manager.m_session, typeof(GaiaSession), false);

            if (GUILayout.Button(GetLabel("New"), GUILayout.Width(45)))
            {
                m_manager.CreateSession();
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.EndVertical();

            if (m_manager.m_session == null)
            {
                GUILayout.EndScrollView();
                return;
            }

            //Track changes
            EditorGUI.BeginChangeCheck();

            //Make some space
            GUILayout.Space(4);

            //Wrap it up in a box
            GUILayout.BeginVertical(m_boxStyle);
            GUILayout.BeginVertical("Summary:", m_boxStyle);
            GUILayout.Space(20);


            //Display the basic details
            EditorGUILayout.LabelField("Name");
            if (m_manager.IsLocked())
            {
                GUI.enabled = false;
            }
            string name = EditorGUILayout.TextArea(m_manager.m_session.m_name, m_descWrapStyle, GUILayout.MinHeight(15));

            GUI.enabled = true;

            EditorGUILayout.LabelField("Description");
            if (m_manager.IsLocked())
            {
                GUI.enabled = false;
            }
            string description = EditorGUILayout.TextArea(m_manager.m_session.m_description, m_descWrapStyle, GUILayout.MinHeight(45));

            Texture2D previewImage = m_manager.GetPreviewImage();

            if (!m_manager.IsLocked())
            {
                previewImage = (Texture2D)EditorGUILayout.ObjectField(GetLabel("Preview Image"), m_manager.m_session.m_previewImage, typeof(Texture2D), false, GUILayout.MaxHeight(15f));
            }

            //Detect change in session and handle changes to preview image
            float width, height;

            if (m_manager.m_session.GetInstanceID() != m_lastSessionID)
            {
                m_lastPreviewImgName = "";
                m_lastSessionID      = m_manager.m_session.GetInstanceID();
                if (m_manager.HasPreviewImage())
                {
                    previewImage         = m_manager.GetPreviewImage();
                    m_lastPreviewImgName = previewImage.name;
                }
            }
            else //Process changes to preview image
            {
                if (previewImage == null)
                {
                    if (m_manager.IsLocked()) //Undo change if locked
                    {
                        if (m_manager.HasPreviewImage())
                        {
                            previewImage         = m_manager.GetPreviewImage();
                            m_lastPreviewImgName = previewImage.name;
                            Debug.LogWarning("You can not change the image on a locked session");
                        }
                    }
                    else
                    {
                        if (m_manager.HasPreviewImage())
                        {
                            m_manager.RemovePreviewImage();
                            m_lastPreviewImgName = "";
                        }
                    }
                }
                else
                {
                    //Handle changes to preview image
                    if (previewImage.name != m_lastPreviewImgName)
                    {
                        if (m_manager.IsLocked()) //Revert
                        {
                            if (m_manager.HasPreviewImage())
                            {
                                previewImage         = m_manager.GetPreviewImage();
                                m_lastPreviewImgName = previewImage.name;
                                Debug.LogWarning("You can not change the image on a locked session");
                            }
                            else
                            {
                                previewImage         = null;
                                m_lastPreviewImgName = "";
                            }
                        }
                        else
                        {
                            //Make it readable
                            Gaia.Utils.MakeTextureReadable(previewImage);

                            //Make a new texture from it
                            Texture2D newTexture = new Texture2D(previewImage.width, previewImage.height, TextureFormat.ARGB32, false);
                            newTexture.name = m_manager.m_session.m_name;
                            newTexture.SetPixels(previewImage.GetPixels(0));
                            newTexture.Apply();

                            //Resize and scale it
                            width  = 320;
                            height = previewImage.height * (width / previewImage.width);
                            Gaia.ScaleTexture.Bilinear(newTexture, (int)width, (int)height);

                            //Compress it
                            //newTexture.Compress(true);

                            //And store its content
                            m_manager.AddPreviewImage(newTexture);

                            //Assign back to the texture for the scene
                            previewImage         = newTexture;
                            m_lastPreviewImgName = previewImage.name;
                        }
                    }
                }
            }

            GUI.enabled = true; //In response to locked above

            if (previewImage != null)
            {
                //Get aspect ratio and available space and display the image
                width  = Screen.width - 43f;
                height = previewImage.height * (width / previewImage.width);
                GUILayout.Label(previewImage, GUILayout.MaxWidth(width), GUILayout.MaxHeight(height));
            }

            EditorGUILayout.LabelField("Created", m_manager.m_session.m_dateCreated);
            EditorGUILayout.LabelField("Dimensions", string.Format("w{0} d{1} h{2}", m_manager.m_session.m_terrainWidth, m_manager.m_session.m_terrainDepth, m_manager.m_session.m_terrainHeight));

            if (m_manager.IsLocked())
            {
                GUI.enabled = false;
            }
            m_manager.m_session.m_seaLevel = EditorGUILayout.Slider(GetLabel("Sea Level"), m_manager.m_session.m_seaLevel, 0f, m_manager.m_session.m_terrainDepth);
            GUI.enabled = true; //In response to locked above

            bool locked = EditorGUILayout.Toggle(GetLabel("Locked"), m_manager.m_session.m_isLocked);

            GUILayout.EndVertical();

            //Iterate through the operations
            GUILayout.BeginVertical("Operations:", m_boxStyle);
            GUILayout.Space(20);

            if (m_manager.m_session.m_operations.Count == 0)
            {
                GUILayout.Space(5);
                GUILayout.Label("No operations yet...");
                GUILayout.Space(5);
            }
            else
            {
                GaiaOperation op;
                EditorGUI.indentLevel++;
                for (int opIdx = 0; opIdx < m_manager.m_session.m_operations.Count; opIdx++)
                {
                    op = m_manager.m_session.m_operations[opIdx];

                    if (op.m_isActive)
                    {
                        op.m_isFoldedOut = EditorGUILayout.Foldout(op.m_isFoldedOut, op.m_description, true);
                    }
                    else
                    {
                        op.m_isFoldedOut = EditorGUILayout.Foldout(op.m_isFoldedOut, op.m_description + " [inactive]", true);
                    }

                    if (op.m_isFoldedOut)
                    {
                        EditorGUI.indentLevel++;

                        EditorGUILayout.LabelField("Description", op.m_description, m_wrapStyle);
                        EditorGUILayout.LabelField("Created", op.m_operationDateTime);
                        if (m_manager.m_session.m_isLocked)
                        {
                            GUI.enabled = false;
                        }
                        op.m_isActive = EditorGUILayout.Toggle(GetLabel("Active"), op.m_isActive);
                        GUI.enabled   = true;

                        int dataLength = 0;
                        for (int idx = 0; idx < op.m_operationDataJson.GetLength(0); idx++)
                        {
                            dataLength += op.m_operationDataJson[idx].Length;
                        }
                        EditorGUILayout.LabelField("Data", dataLength.ToString() + " bytes");

                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();
                        if (m_manager.m_session.m_isLocked)
                        {
                            GUI.enabled = false;
                        }
                        if (GUILayout.Button(GetLabel("Delete")))
                        {
                            if (EditorUtility.DisplayDialog("Delete Operation ?", "Are you sure you want to delete this operation ?", "Yes", "No"))
                            {
                                m_manager.RemoveOperation(opIdx);
                            }
                        }
                        GUI.enabled = true;
                        if (GUILayout.Button(GetLabel("Apply")))
                        {
                            m_manager.Apply(opIdx);
                        }
                        if (GUILayout.Button(GetLabel("Play")))
                        {
                            m_manager.PlayOperation(opIdx);
                        }
                        GUILayout.EndHorizontal();

                        EditorGUI.indentLevel--;
                    }
                    //EditorGUILayout.Space();
                }
                EditorGUI.indentLevel--;
            }
            GUILayout.EndVertical();

            //Create a nice text intro
            if (!m_manager.m_session.m_isLocked)
            {
                GUILayout.BeginVertical(m_boxStyle);
                m_manager.m_genShowRandomGenerator = EditorGUILayout.BeginToggleGroup(GetLabel(" Random Terrain Generator"), m_manager.m_genShowRandomGenerator);
                if (m_manager.m_genShowRandomGenerator)
                {
                    m_manager.m_genNumStampsToGenerate = EditorGUILayout.IntSlider(GetLabel("Stamps"), m_manager.m_genNumStampsToGenerate, 1, 20);
                    m_manager.m_genScaleWidth          = EditorGUILayout.Slider(GetLabel("Width Scale"), m_manager.m_genScaleWidth, 0.5f, 100f);
                    m_manager.m_genScaleHeight         = EditorGUILayout.Slider(GetLabel("Height Scale"), m_manager.m_genScaleHeight, 0.5f, 100f);
                    m_manager.m_genBorderStyle         = (Gaia.GaiaConstants.GeneratorBorderStyle)EditorGUILayout.EnumPopup(GetLabel("Border Style"), m_manager.m_genBorderStyle);
                    m_manager.m_genChanceOfHills       = EditorGUILayout.Slider(GetLabel("Hill Chance"), m_manager.m_genChanceOfHills, 0f, 1f);
                    m_manager.m_genChanceOfIslands     = EditorGUILayout.Slider(GetLabel("Island Chance"), m_manager.m_genChanceOfIslands, 0f, 1f);
                    m_manager.m_genChanceOfLakes       = EditorGUILayout.Slider(GetLabel("Lake Chance"), m_manager.m_genChanceOfLakes, 0f, 1f);
                    m_manager.m_genChanceOfMesas       = EditorGUILayout.Slider(GetLabel("Mesa Chance"), m_manager.m_genChanceOfMesas, 0f, 1f);
                    m_manager.m_genChanceOfMountains   = EditorGUILayout.Slider(GetLabel("Mountain Chance"), m_manager.m_genChanceOfMountains, 0f, 1f);
                    m_manager.m_genChanceOfPlains      = EditorGUILayout.Slider(GetLabel("Plains Chance"), m_manager.m_genChanceOfPlains, 0f, 1f);
                    m_manager.m_genChanceOfRivers      = EditorGUILayout.Slider(GetLabel("River Chance"), m_manager.m_genChanceOfRivers, 0f, 1f);
                    m_manager.m_genChanceOfValleys     = EditorGUILayout.Slider(GetLabel("Valley Chance"), m_manager.m_genChanceOfValleys, 0f, 1f);
                    m_manager.m_genChanceOfVillages    = EditorGUILayout.Slider(GetLabel("Village Chance"), m_manager.m_genChanceOfVillages, 0f, 1f);
                    m_manager.m_genChanceOfWaterfalls  = EditorGUILayout.Slider(GetLabel("Waterfall Chance"), m_manager.m_genChanceOfWaterfalls, 0f, 1f);

                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(GetLabel("Reset Session")))
                    {
                        if (EditorUtility.DisplayDialog("Reset Session ?", "Are you sure you want to reset your session - this can not be undone ?", "Yes", "No"))
                        {
                            m_manager.ResetSession();
                        }
                    }
                    if (GUILayout.Button(GetLabel("Add Stamps")))
                    {
                        m_manager.RandomiseStamps();
                    }
                    GUILayout.EndHorizontal();
                }
                EditorGUILayout.EndToggleGroup();
                GUILayout.EndVertical();
            }

            //Create a nice text intro
            GUILayout.BeginVertical(m_boxStyle);
            m_manager.m_genShowTerrainHelper = EditorGUILayout.BeginToggleGroup(GetLabel(" Terrain Helper"), m_manager.m_genShowTerrainHelper);
            if (m_manager.m_genShowTerrainHelper)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(GetLabel("Flatten Terrain")))
                {
                    if (EditorUtility.DisplayDialog("Flatten Terrain?", "Are you sure you want to flatten your terrain - this can not be undone ?", "Yes", "No"))
                    {
                        GaiaWorldManager wm = new GaiaWorldManager(Terrain.activeTerrains);
                        wm.FlattenWorld();
                    }
                }
                if (GUILayout.Button(GetLabel("Smooth Terrain")))
                {
                    if (EditorUtility.DisplayDialog("Smooth Terrain?", "Are you sure you want to smooth your terrain - this can not be undone ?", "Yes", "No"))
                    {
                        GaiaWorldManager wm = new GaiaWorldManager(Terrain.activeTerrains);
                        wm.SmoothWorld();
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(GetLabel("Clear Trees")))
                {
                    if (EditorUtility.DisplayDialog("Clear Trees?", "Are you sure you want to clear your trees - this can not be undone ?", "Yes", "No"))
                    {
                        TerrainHelper.ClearTrees();
                    }
                }
                if (GUILayout.Button(GetLabel("Clear Details")))
                {
                    if (EditorUtility.DisplayDialog("Clear Details?", "Are you sure you want to clear your details / grass - this can not be undone ?", "Yes", "No"))
                    {
                        TerrainHelper.ClearDetails();
                    }
                }
                GUILayout.EndHorizontal();
            }
            EditorGUILayout.EndToggleGroup();
            GUILayout.EndVertical();


            //Check for changes, make undo record, make changes and let editor know we are dirty
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(m_manager, "Made changes");
                m_manager.m_session.m_name         = name;
                m_manager.m_session.m_description  = description;
                m_manager.m_session.m_isLocked     = locked;
                m_manager.m_session.m_previewImage = previewImage;
                EditorUtility.SetDirty(m_manager.m_session);
                EditorUtility.SetDirty(m_manager);
            }

            GUILayout.BeginVertical("Session Controller", m_boxStyle);
            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            if (m_manager.m_updateSessionCoroutine == null && m_manager.m_updateOperationCoroutine == null)
            {
                if (GUILayout.Button(GetLabel("Play Session")))
                {
                    if (EditorUtility.DisplayDialog("Playback Session ?", "Are you sure you want to playback your session - this can not be undone ?", "Yes", "No"))
                    {
                        m_manager.PlaySession();
                    }
                }
                if (GUILayout.Button(GetLabel("Export Resources")))
                {
                    m_manager.ExportSessionResources();
                }
            }
            else
            {
                if (GUILayout.Button(GetLabel("Cancel")))
                {
                    m_manager.CancelPlayback();
                }
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(5);


            //Debug.Log(m_manager.m_lastUpdateDateTime);

            //Draw the various spawner progress bars
            if (m_manager.m_currentStamper != null)
            {
                if (m_manager.m_currentStamper.IsStamping())
                {
                    ProgressBar(string.Format("{0}:{1} ({2:0.0}%)", m_manager.m_currentStamper.gameObject.name, m_manager.m_currentStamper.m_stampPreviewImage.name, m_manager.m_currentStamper.m_stampProgress * 100f), m_manager.m_currentStamper.m_stampProgress);
                }
            }
            if (m_manager.m_currentSpawner != null)
            {
                if (m_manager.m_currentSpawner.IsSpawning())
                {
                    ProgressBar(string.Format("{0} ({1:0.0}%)", m_manager.m_currentSpawner.gameObject.name, m_manager.m_currentSpawner.m_spawnProgress * 100f), m_manager.m_currentSpawner.m_spawnProgress);
                }
            }

            GUILayout.EndVertical();


            GUILayout.EndVertical();

            //End scroll
            GUILayout.EndScrollView();
        }