Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            m_editorUtils.Initialize(); // Do not remove this!
            m_spawnerSettings = (SpawnerSettings)target;

            string message = m_editorUtils.GetTextValue("Intro");;

            EditorGUILayout.HelpBox(message, MessageType.Info, true);

            if (GUILayout.Button(m_editorUtils.GetContent("AddToScene")))
            {
                m_spawnerSettings.CreateSpawner();
            }

            GUILayout.Label(m_editorUtils.GetContent("SpawnRulePreview"), m_editorUtils.Styles.heading);

            GaiaResource resource = m_spawnerSettings.m_resources;// (GaiaResource)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_spawnerSettings.m_resourcesGUID), typeof(GaiaResource));

            foreach (SpawnRule rule in m_spawnerSettings.m_spawnerRules)
            {
                m_editorUtils.LabelField("Name", new GUIContent(rule.m_name));
                m_editorUtils.LabelField("Type", new GUIContent(rule.m_resourceType.ToString()));


                Texture2D resourceTexture = SpawnerEditor.GetSpawnRulePreviewTexture(rule, resource);

                if (resourceTexture != null)
                {
                    m_editorUtils.Image(resourceTexture, 100, 100);
                }
            }
        }
Esempio n. 2
0
        public static GUIContent PropertyCount(string key, List <AutoMaskExport> list, EditorUtils editorUtils)
        {
            GUIContent content = editorUtils.GetContent(key);

            content.text += " [" + list.Count + "]";
            return(content);
        }
Esempio n. 3
0
        public static GUIContent PropertyCount(string key, List <BiomeSpawnerListEntry> list, EditorUtils editorUtils)
        {
            GUIContent content = editorUtils.GetContent(key);

            content.text += " [" + list.Count + "]";
            return(content);
        }
Esempio n. 4
0
        /// <summary> Panel to display Output options </summary>
        /// <param name="inlineHelp">Should help be displayed?</param>


        private GUIContent PropertyCount(string key, SerializedProperty property)
        {
            GUIContent content = m_editorUtils.GetContent(key);

            content.text += " [" + property.arraySize + "]";
            return(content);
        }
Esempio n. 5
0
        public static GUIContent PropertyCount(string key, Array array, EditorUtils editorUtils)
        {
            GUIContent content = editorUtils.GetContent(key);

            content.text += " [" + array.Length + "]";
            return(content);
        }
Esempio n. 6
0
 void OnEnable()
 {
     if (m_editorUtils == null)
     {
         // Get editor utils for this
         m_editorUtils = PWApp.GetEditorUtils(this);
     }
     titleContent = m_editorUtils.GetContent("WindowTitle");
 }
Esempio n. 7
0
        public static void DrawListElement_AdvancedTab(Rect rect, AdvancedTabBiomeListEntry listEntry, EditorUtils m_editorUtils)
        {
            int oldIndent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;


            Rect labelRect = rect;

            //260 is the total width of the controls at the end of each row
            labelRect.width  = rect.width - 280;
            labelRect.height = EditorGUIUtility.singleLineHeight;

            EditorGUI.LabelField(labelRect, listEntry.m_biomePreset.name);

            EditorGUIUtility.AddCursorRect(labelRect, MouseCursor.Zoom);
            if (labelRect.Contains(Event.current.mousePosition) && Event.current.clickCount > 0)
            {
                Selection.activeObject = listEntry.m_biomePreset;
                EditorGUIUtility.PingObject(Selection.activeObject);
            }

            labelRect.x     = rect.width - 230;
            labelRect.width = 110f;

            EditorGUI.LabelField(labelRect, m_editorUtils.GetContent("SpawnerListAutoAssignPrototypes"));

            labelRect.x     = rect.width - 130f;
            labelRect.width = 20f;

            listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(labelRect, listEntry.m_autoAssignPrototypes);

            labelRect.x     = rect.width - 80f;
            labelRect.width = 100f;
            if (GUI.Button(labelRect, m_editorUtils.GetContent("AdvancedTabAddBiome")))
            {
                BiomeController newBiome = listEntry.m_biomePreset.CreateBiome(listEntry.m_autoAssignPrototypes);
                Selection.activeGameObject = newBiome.gameObject;
            }


            EditorGUI.indentLevel = oldIndent;
        }
Esempio n. 8
0
        public static void DrawListHeader(Rect rect, bool currentFoldOutState, List <AdvancedTabBiomeListEntry> biomesList, EditorUtils editorUtils, string headerKey)
        {
            int oldIndent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;
            //rect.xMin += 0f;
            EditorGUI.LabelField(rect, editorUtils.GetContent(headerKey));
            //bool newFoldOutState = EditorGUI.Foldout(rect, currentFoldOutState, PropertyCount("SpawnerAdded", spawnerList, editorUtils), true);
            EditorGUI.indentLevel = oldIndent;
            //return newFoldOutState;
        }
Esempio n. 9
0
        public override void OnInspectorGUI()
        {
            m_editorUtils.Initialize(); // Do not remove this!
            m_biomePreset = (BiomePreset)target;
            serializedObject.Update();

            m_editorUtils.Panel("BiomeSettings", DrawBiomeSettings, true);

            if (GUILayout.Button(m_editorUtils.GetContent("AddToScene")))
            {
                BiomeController newBiome = m_biomePreset.CreateBiome(true);
                Selection.activeGameObject = newBiome.gameObject;
            }
        }
Esempio n. 10
0
        public static bool DrawListHeader(Rect rect, bool currentFoldOutState, bool currentToggleAllState, List <AutoMaskExport> autoMaskList, EditorUtils editorUtils, ref GaiaConstants.AutoSpawnerArea autoSpawnerArea)
        {
            int oldIndent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;
            //rect.xMin += 0f;


            Rect dropdownRect = new Rect(rect);

            dropdownRect.width  = 50;
            dropdownRect.height = 15;
            dropdownRect.y     += 2;
            dropdownRect.x      = rect.x + rect.width - 2 - dropdownRect.width;

            GUIStyle dropdownStyle = new GUIStyle(GUI.skin.button);

            dropdownStyle.fixedHeight = 15;

            Rect label2Rect = new Rect(rect);

            label2Rect.width = 30;
            label2Rect.x     = dropdownRect.x - 5 - label2Rect.width;


            Rect label1Rect = new Rect(rect);

            label1Rect.x    += 35;
            label1Rect.width = rect.width - label2Rect.width - 35 - dropdownRect.width - 5 - 10;


            Rect toggleAllRect = new Rect(rect);

            toggleAllRect.x    += 15;
            toggleAllRect.width = 12;

            bool oldToggleOldState = currentToggleAllState;

            currentToggleAllState = EditorGUI.Toggle(toggleAllRect, currentToggleAllState);
            EditorGUI.LabelField(toggleAllRect, editorUtils.GetContent("AutoToggleAllTooltip"));

            if (currentToggleAllState != oldToggleOldState)
            {
                foreach (AutoMaskExport entry in autoMaskList)
                {
                    entry.isActive = currentToggleAllState;
                }
            }

            EditorGUI.LabelField(label1Rect, editorUtils.GetContent("AutoMaskMapExportHeader"));
            EditorGUI.LabelField(label2Rect, editorUtils.GetContent("AutoMaskMapExportAreaLabel"));

            autoSpawnerArea = (GaiaConstants.AutoSpawnerArea)EditorGUI.EnumPopup(dropdownRect, autoSpawnerArea, dropdownStyle);
            EditorGUI.LabelField(dropdownRect, editorUtils.GetContent("AutoMaskMapExportAreaTooltip"));

            //bool newFoldOutState = EditorGUI.Foldout(rect, currentFoldOutState, PropertyCount("SpawnerAdded", spawnerList, editorUtils), true);
            EditorGUI.indentLevel = oldIndent;
            //return newFoldOutState;


            return(currentToggleAllState);
        }
Esempio n. 11
0
        /// <summary>
        /// Global settings
        /// </summary>
        /// <param name="helpEnabled"></param>
        private void GlobalSettings(bool helpEnabled)
        {
            //m_profile.m_hideAllParentsInHierarchy = m_editorUtils.ToggleLeft("HideAllParentsInHierarchy", m_profile.m_hideAllParentsInHierarchy, helpEnabled);

            if (m_profile.m_visibilityEntries != null)
            {
                int count = m_profile.m_visibilityEntries.Count;
                if (count == 0)
                {
                    EditorGUILayout.HelpBox("No Objects found below this object to use this system please spawn some game objects to use the hide system.", MessageType.Info);
                }
                else
                {
                    GUI.backgroundColor = m_orangeGUI;
                    if (m_settingsChangedInfo)
                    {
                        if (m_editorUtils.Button("ApplyNow"))
                        {
                            ApplyNow();
                        }
                    }
                    GUI.backgroundColor = m_guiBackground;
                    GUIContent checkboxContent = m_editorUtils.GetContent("CheckboxTooltip");
                    foreach (GaiaHierarchyVisibility ghv in m_profile.m_visibilityEntries)
                    {
                        EditorGUILayout.BeginHorizontal();
                        ghv.m_isVisible = m_editorUtils.Toggle(ghv.m_isVisible, checkboxContent, GUILayout.Width(20));
                        GUILayout.Label(ghv.m_name);
                        EditorGUILayout.EndHorizontal();
                    }

                    GUI.backgroundColor = m_orangeGUI;
                    if (m_settingsChangedInfo)
                    {
                        if (m_editorUtils.Button("ApplyNow"))
                        {
                            ApplyNow();
                        }
                    }
                    GUI.backgroundColor = m_guiBackground;

                    GUI.backgroundColor = m_redGUI;
                    if (m_editorUtils.Button("HideAll"))
                    {
                        foreach (GaiaHierarchyVisibility ghv in m_profile.m_visibilityEntries)
                        {
                            ghv.m_isVisible = false;
                        }
                        m_profile.SetupHideInHierarchy();
                    }

                    GUI.backgroundColor = m_greenGUI;
                    if (m_editorUtils.Button("ShowAll"))
                    {
                        foreach (GaiaHierarchyVisibility ghv in m_profile.m_visibilityEntries)
                        {
                            ghv.m_isVisible = true;
                        }
                        m_profile.SetupHideInHierarchy();
                    }

                    //EditorGUILayout.LabelField("Object count in parent: " + count);
                    //if (m_profile.m_hideAllParentsInHierarchy)
                    //{
                    //    GUI.backgroundColor = m_redGUI;
                    //    if (m_editorUtils.Button("Show"))
                    //    {
                    //        m_profile.m_hideAllParentsInHierarchy = false;
                    //    }
                    //}
                    //else
                    //{

                    //}

                    GUI.backgroundColor = m_guiBackground;

                    //m_editorUtils.InlineHelp("HideAllParentsInHierarchy", helpEnabled);

                    if (m_editorUtils.Button("ConfigureAllInScene"))
                    {
                        m_profile.SetupAllHideInHierarchy();
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("Object count in parent: 0");
            }
        }
Esempio n. 12
0
        private void DrawSummary(bool helpEnabled)
        {
            m_manager.m_session = (GaiaSession)m_editorUtils.ObjectField("SessionData", m_manager.m_session, typeof(GaiaSession), helpEnabled);
            m_editorUtils.InlineHelp("SessionData", helpEnabled);
            if (m_manager.m_session == null)
            {
                if (m_editorUtils.Button("CreateSessionButton"))
                {
                    m_manager.CreateSession();
                }
            }
            if (m_manager.m_session == null)
            {
                return;
            }
            EditorGUI.BeginChangeCheck();
            m_manager.m_session.m_name = m_editorUtils.DelayedTextField("Name", m_manager.m_session.m_name, helpEnabled);
            if (EditorGUI.EndChangeCheck())
            {
                //Get the old path
                string oldSessionDataPath = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session);
                //Rename the session asset
                AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(m_manager.m_session), m_manager.m_session.m_name + ".asset");
                //rename the session data path as well
                string newSessionDataPath = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session, false);
                AssetDatabase.MoveAsset(oldSessionDataPath, newSessionDataPath);
                //if we have terrain scenes stored in the Terrain Loader, we need to update the paths in there as well
                foreach (TerrainScene terrainScene in TerrainLoaderManager.TerrainScenes)
                {
                    terrainScene.m_scenePath         = terrainScene.m_scenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_impostorScenePath = terrainScene.m_impostorScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_backupScenePath   = terrainScene.m_backupScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_colliderScenePath = terrainScene.m_colliderScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                }
                TerrainLoaderManager.Instance.SaveStorageData();

                AssetDatabase.DeleteAsset(oldSessionDataPath);
                AssetDatabase.SaveAssets();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(m_editorUtils.GetContent("Description"), GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
            m_manager.m_session.m_description = EditorGUILayout.TextArea(m_manager.m_session.m_description, GUILayout.MinHeight(100));
            EditorGUILayout.EndHorizontal();
            m_editorUtils.InlineHelp("Description", helpEnabled);
            m_manager.m_session.m_previewImage = (Texture2D)m_editorUtils.ObjectField("PreviewImage", m_manager.m_session.m_previewImage, typeof(Texture2D), helpEnabled);
            GUILayout.BeginHorizontal();
            Rect rect = EditorGUILayout.GetControlRect();

            GUILayout.Space(rect.width - 20);
            if (GUILayout.Button("Generate Image"))
            {
                string textureFileName = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session) + Path.DirectorySeparatorChar + m_manager.m_session + "_Preview";
                var    originalLODBias = QualitySettings.lodBias;
                QualitySettings.lodBias = 100;
                OrthographicBake.BakeTerrain(Terrain.activeTerrain, 2048, 2048, Camera.main.cullingMask, textureFileName);
                OrthographicBake.RemoveOrthoCam();
                QualitySettings.lodBias = originalLODBias;
                textureFileName        += ".png";
                AssetDatabase.ImportAsset(textureFileName);
                var importer = AssetImporter.GetAtPath(textureFileName) as TextureImporter;
                if (importer != null)
                {
                    importer.sRGBTexture         = false;
                    importer.alphaIsTransparency = false;
                    importer.alphaSource         = TextureImporterAlphaSource.None;
                    importer.mipmapEnabled       = false;
                }
                AssetDatabase.ImportAsset(textureFileName);
                m_manager.m_session.m_previewImage = (Texture2D)AssetDatabase.LoadAssetAtPath(textureFileName, typeof(Texture2D));
            }
            GUILayout.EndHorizontal();
            m_editorUtils.InlineHelp("PreviewImage", helpEnabled);
            m_editorUtils.LabelField("Created", new GUIContent(m_manager.m_session.m_dateCreated), helpEnabled);
            m_manager.m_session.m_isLocked = m_editorUtils.Toggle("Locked", m_manager.m_session.m_isLocked, helpEnabled);
            float maxSeaLevel = 2000f;

            if (Terrain.activeTerrain != null)
            {
                maxSeaLevel = Terrain.activeTerrain.terrainData.size.y + Terrain.activeTerrain.transform.position.y;
            }
            else
            {
                maxSeaLevel = m_manager.GetSeaLevel(false) + 500f;
            }

            float oldSeaLevel = m_manager.GetSeaLevel(false);
            float newSeaLEvel = oldSeaLevel;

            newSeaLEvel = m_editorUtils.Slider("SeaLevel", newSeaLEvel, 0, maxSeaLevel, helpEnabled);
            if (newSeaLEvel != oldSeaLevel)
            {
                //Do we have a water instance? If yes, update it & it will update the sea level in the session as well
                if (PWS_WaterSystem.Instance != null)
                {
                    PWS_WaterSystem.Instance.SeaLevel = newSeaLEvel;
                }
                else
                {
                    //no water instance yet, just update the sea level in the session
                    m_manager.SetSeaLevel(newSeaLEvel, false);
                    SceneView.RepaintAll();
                }
            }

            m_manager.m_session.m_spawnDensity = m_editorUtils.FloatField("SpawnDensity", Mathf.Max(0.01f, m_manager.m_session.m_spawnDensity), helpEnabled);
            GUILayout.BeginHorizontal();
            if (m_editorUtils.Button("DeleteAllOperations"))
            {
                if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("PopupDeleteAllTitle"), m_editorUtils.GetTextValue("PopupDeleteAllMessage"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
                {
                    foreach (GaiaOperation op in m_manager.m_session.m_operations)
                    {
                        try
                        {
                            if (!String.IsNullOrEmpty(op.scriptableObjectAssetGUID))
                            {
                                AssetDatabase.DeleteAsset(AssetDatabase.GUIDToAssetPath(op.scriptableObjectAssetGUID));
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogError("Error while deleting one of the operation data files: " + ex.Message + " Stack Trace:" + ex.StackTrace);
                        }
                    }

                    m_manager.m_session.m_operations.Clear();
                }
            }

            if (m_editorUtils.Button("PlaySession"))
            {
                GaiaLighting.SetDefaultAmbientLight(GaiaUtils.GetGaiaSettings().m_gaiaLightingProfile);
                GaiaSessionManager.PlaySession();
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 13
0
        //public static void DrawListElement_GaiaManager(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils, EditorWindow window = null)
        //{
        //    int oldIndent = EditorGUI.indentLevel;
        //    Rect controlRect = new Rect(rect);
        //    controlRect.width = 40;
        //    controlRect.height = EditorGUIUtility.singleLineHeight;
        //    EditorGUI.indentLevel = 0;
        //    EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("SpawnerListActive"));
        //    controlRect.x = rect.x + 40;
        //    controlRect.width = 10;
        //    listEntry.m_isActiveInStamper = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInStamper);
        //    controlRect.width = 40;
        //    EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("BiomeActive"));
        //    controlRect.x = rect.x + 40;
        //    controlRect.width = 10;
        //    listEntry.m_isActiveInBiome = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInBiome);
        //    controlRect.x = rect.x + 60;
        //    controlRect.width = 70;
        //    controlRect.height = EditorGUIUtility.singleLineHeight;
        //    EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("SpawnerListAutoAssignPrototypes"));
        //    controlRect.x = rect.x + 125;
        //    controlRect.width = 10;
        //    listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(controlRect, listEntry.m_autoAssignPrototypes);
        //    controlRect.width = 26;
        //    controlRect.x = rect.x + rect.width - 30;
        //    int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);
        //    if (GUI.Button(controlRect, " "))
        //    {
        //        EditorGUIUtility.ShowObjectPicker<SpawnerSettings>(listEntry.m_spawnerSettings, false, "l:GaiaManagerSpawner", controlID);
        //    }
        //    controlRect.width = rect.width - 160;
        //    controlRect.x = rect.x + 150;
        //    listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);

        //    string commandName = Event.current.commandName;
        //    if (commandName == "ObjectSelectorUpdated")
        //    {
        //        if (controlID == EditorGUIUtility.GetObjectPickerControlID())
        //        {
        //            listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
        //            if (window != null)
        //            {
        //                window.Repaint();
        //            }
        //        }
        //    }
        //    else if (commandName == "ObjectSelectorClosed")
        //    {
        //        if (controlID == EditorGUIUtility.GetObjectPickerControlID())
        //        {
        //            listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
        //        }
        //    }

        //    EditorGUI.indentLevel = oldIndent;
        //}

        public static void DrawListElement(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils, EditorWindow window = null)
        {
            int  oldIndent   = EditorGUI.indentLevel;
            Rect controlRect = new Rect(rect);

            EditorGUI.indentLevel = 0;
            controlRect.height    = EditorGUIUtility.singleLineHeight;
            controlRect.width     = 12;
            EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("StamperActive"));
            controlRect.x                 = rect.x + 12;
            controlRect.width             = 20;
            listEntry.m_isActiveInStamper = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInStamper);
            controlRect.x                 = controlRect.x + 20;
            controlRect.width             = 12;
            EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("BiomeActive"));
            controlRect.x               = controlRect.x + 12;
            controlRect.width           = 15;
            listEntry.m_isActiveInBiome = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInBiome);
            controlRect.x               = controlRect.x + 20;
            controlRect.width           = 12;
            EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("AutoAssignPrototypes"));
            controlRect.x     = controlRect.x + 12;
            controlRect.width = 15;
            listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(controlRect, listEntry.m_autoAssignPrototypes);
            controlRect.x     = rect.x + 10;
            controlRect.width = 20;
            controlRect.x     = rect.x + rect.width - 20;
            int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);

            if (GUI.Button(controlRect, " "))
            {
                EditorGUIUtility.ShowObjectPicker <SpawnerSettings>(listEntry.m_spawnerSettings, false, "l:" + GaiaConstants.gaiaManagerSpawnerLabel, controlID);
            }
            controlRect.width = rect.width - 100;
            controlRect.x     = rect.x + 100;

            EditorGUI.BeginChangeCheck();
            listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);

            string commandName = Event.current.commandName;

            if (commandName == "ObjectSelectorUpdated")
            {
                if (controlID == EditorGUIUtility.GetObjectPickerControlID())
                {
                    //Triggers when the custom picker object was updated
                    listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
                    listEntry.m_spawnerSettings.RefreshGUID();
                    if (window != null)
                    {
                        window.Repaint();
                    }
                }
            }
            else if (commandName == "ObjectSelectorClosed")
            {
                if (controlID == EditorGUIUtility.GetObjectPickerControlID())
                {
                    //Triggers when the custom picker object was closed
                    listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
                    listEntry.m_spawnerSettings.RefreshGUID();
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                //Triggers when the user drags and drops a spawner settings file into the slot
                listEntry.m_spawnerSettings.RefreshGUID();
            }

            EditorGUI.indentLevel = oldIndent;
        }
Esempio n. 14
0
        public static void DrawMaskListElement(Rect rect, int index, CollisionMask collisionMask, EditorUtils m_editorUtils, Terrain currentTerrain, GaiaConstants.FeatureOperation operation)
        {
            int oldIndent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;
            //Active Label
            Rect fieldRect = new Rect(rect.x, rect.y, rect.width * 0.1f, EditorGUIUtility.singleLineHeight);

            EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("MaskActive"));
            //Active Checkbox
            fieldRect.x           += rect.width * 0.1f;
            fieldRect.width        = rect.width * 0.05f;
            collisionMask.m_active = EditorGUI.Toggle(fieldRect, collisionMask.m_active);
            //Invert Label
            fieldRect.x    += rect.width * 0.05f;
            fieldRect.width = rect.width * 0.1f;
            EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("MaskInvert"));
            //Invert Checkbox
            fieldRect.x           += rect.width * 0.1f;
            fieldRect.width        = rect.width * 0.05f;
            collisionMask.m_invert = EditorGUI.Toggle(fieldRect, collisionMask.m_invert);
            //Type dropdown
            fieldRect.x    += rect.width * 0.05f;
            fieldRect.width = rect.width * 0.2f;
            BakedMaskType oldType = collisionMask.m_type;

            collisionMask.m_type = (BakedMaskType)EditorGUI.EnumPopup(fieldRect, collisionMask.m_type);
            EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("CollisionMaskTypeTooltip"));
            switch (collisionMask.m_type)
            {
            case BakedMaskType.RadiusTree:
                //Tree dropdown
                string oldTreeId = collisionMask.m_treeSpawnRuleGUID;
                fieldRect.x += rect.width * 0.2f;
                int selectedGUIDIndex = 0;
                if (collisionMask.m_treeSpawnRuleGUID != "")
                {
                    SpawnRule selectedRule = CollisionMask.m_allTreeSpawnRules.FirstOrDefault(x => x.GUID == collisionMask.m_treeSpawnRuleGUID);
                    if (selectedRule != null)
                    {
                        selectedGUIDIndex = Array.IndexOf(CollisionMask.m_allTreeSpawnRules, selectedRule);
                    }
                }
                selectedGUIDIndex = EditorGUI.IntPopup(fieldRect, selectedGUIDIndex, CollisionMask.m_allTreeSpawnRuleNames, CollisionMask.m_allTreeSpawnRuleIndices);
                if (selectedGUIDIndex >= 0 && selectedGUIDIndex < CollisionMask.m_allTreeSpawnRules.Length)
                {
                    collisionMask.m_treeSpawnRuleGUID = CollisionMask.m_allTreeSpawnRules[selectedGUIDIndex].GUID;
                }
                if (oldType != collisionMask.m_type || oldTreeId != collisionMask.m_treeSpawnRuleGUID)
                {
                    SpawnRule selectedRule = CollisionMask.m_allTreeSpawnRules.FirstOrDefault(x => x.GUID == collisionMask.m_treeSpawnRuleGUID);
                    if (selectedRule != null)
                    {
                        Spawner spawner = CollisionMask.m_allTreeSpawners.FirstOrDefault(x => x.m_settings.m_spawnerRules.Contains(selectedRule));
                        if (spawner != null)
                        {
                            GameObject treePrefab = spawner.m_settings.m_resources.m_treePrototypes[selectedRule.m_resourceIdx].m_desktopPrefab;
                            collisionMask.m_Radius = GaiaUtils.GetTreeRadius(treePrefab);
                        }
                    }
                }

                fieldRect.x           += rect.width * 0.2f;
                fieldRect.width        = rect.width * 0.1f;
                collisionMask.m_Radius = EditorGUI.FloatField(fieldRect, collisionMask.m_Radius);
                fieldRect.x           += rect.width * 0.1f;
                fieldRect.width        = rect.width * 0.2f;
                break;

            case BakedMaskType.RadiusTag:
                //Tree dropdown
                fieldRect.x += rect.width * 0.2f;
                ////Building up a value array of incrementing ints of the size of the available tags this array will then match the displayed string selection in the popup
                //int[] tagValueArray = Enumerable
                //                    .Repeat(0, (int)((currentTerrain.terrainData.treePrototypes.Length - 0) / 1) + 1)
                //                    .Select((tr, ti) => tr + (1 * ti))
                //                    .ToArray();
                string oldTag = collisionMask.m_tag;
                collisionMask.m_tag = EditorGUI.TagField(fieldRect, collisionMask.m_tag);

                if (oldType != collisionMask.m_type || oldTag != collisionMask.m_tag)
                {
                    collisionMask.m_Radius = GaiaUtils.GetBoundsForTaggedObject(collisionMask.m_tag);
                }


                fieldRect.x           += rect.width * 0.2f;
                fieldRect.width        = rect.width * 0.1f;
                collisionMask.m_Radius = EditorGUI.FloatField(fieldRect, collisionMask.m_Radius);
                fieldRect.x           += rect.width * 0.1f;
                fieldRect.width        = rect.width * 0.2f;
                break;

            case (BakedMaskType.LayerGameObject):
                //Layer mask selection
                fieldRect.x += rect.width * 0.2f;
                EditorGUI.BeginChangeCheck();
                collisionMask.m_layerMask = GaiaEditorUtils.LayerMaskFieldRect(fieldRect, new GUIContent(""), collisionMask.m_layerMask);
                if (EditorGUI.EndChangeCheck())
                {
                    collisionMask.m_layerMaskLayerNames = GaiaUtils.LayerMaskToString(collisionMask.m_layerMask);
                }
                EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("CollisionMaskLayerSelectionTooltip"));
                fieldRect.x    += rect.width * 0.2f;
                fieldRect.width = rect.width * 0.1f;
                collisionMask.m_growShrinkDistance = EditorGUI.FloatField(fieldRect, collisionMask.m_growShrinkDistance);
                EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("CollisionMaskGrowShrinkDistanceTooltip"));
                fieldRect.x    += rect.width * 0.1f;
                fieldRect.width = rect.width * 0.2f;

                break;

            case (BakedMaskType.LayerTree):
                //Layer mask selection
                fieldRect.x += rect.width * 0.2f;
                EditorGUI.BeginChangeCheck();
                collisionMask.m_layerMask = GaiaEditorUtils.LayerMaskFieldRect(fieldRect, new GUIContent(""), collisionMask.m_layerMask);
                if (EditorGUI.EndChangeCheck())
                {
                    collisionMask.m_layerMaskLayerNames = GaiaUtils.LayerMaskToString(collisionMask.m_layerMask);
                }
                EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("CollisionMaskLayerSelectionTooltip"));
                fieldRect.x    += rect.width * 0.2f;
                fieldRect.width = rect.width * 0.1f;
                collisionMask.m_growShrinkDistance = EditorGUI.FloatField(fieldRect, collisionMask.m_growShrinkDistance);
                EditorGUI.LabelField(fieldRect, m_editorUtils.GetContent("CollisionMaskGrowShrinkDistanceTooltip"));
                fieldRect.x    += rect.width * 0.1f;
                fieldRect.width = rect.width * 0.2f;

                break;
            }

            if (GUI.Button(fieldRect, m_editorUtils.GetContent("MaskCollisionBake")))
            {
                switch (collisionMask.m_type)
                {
                case BakedMaskType.RadiusTree:
                    GaiaSessionManager.GetSessionManager().m_bakedMaskCache.BakeAllTreeCollisions(collisionMask.m_treeSpawnRuleGUID, collisionMask.m_Radius);
                    break;

                case BakedMaskType.RadiusTag:
                    GaiaSessionManager.GetSessionManager().m_bakedMaskCache.BakeAllTagCollisions(collisionMask.m_tag, collisionMask.m_Radius);
                    break;

                case BakedMaskType.LayerGameObject:
                    GaiaSessionManager.GetSessionManager().m_bakedMaskCache.BakeAllLayerGameObjectCollisions(collisionMask.m_layerMask, collisionMask.m_growShrinkDistance);     //, collisionMask.m_Radius);
                    break;

                case BakedMaskType.LayerTree:
                    GaiaSessionManager.GetSessionManager().m_bakedMaskCache.BakeAllLayerTreeCollisions(collisionMask.m_layerMask, collisionMask.m_growShrinkDistance);     //, collisionMask.m_Radius);
                    break;
                }
            }
            EditorGUI.indentLevel = oldIndent;
        }