Example #1
0
        private void GlobalPanel(bool helpEnabled)
        {
            EditorGUI.BeginChangeCheck();

            m_editorUtils.Heading("GlobalSettings");
            HDR        = m_bufferManager.m_allowHDR;
            HDR        = m_editorUtils.Toggle("AllowHDR", HDR, helpEnabled);
            RenderSize = m_bufferManager.m_renderSize;
            RenderSize = (PW_RENDER_SIZE)m_editorUtils.EnumPopup("RenderResolution", RenderSize, helpEnabled);
            EditorGUILayout.Space();
            m_editorUtils.Heading("RefreactionSettings");
            RefractionCameraEvent = m_bufferManager.m_cameraEventRefraction;
            if (Application.isPlaying)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("CantBeChangedAtRunTime"), MessageType.Info);
                GUI.enabled = false;
            }
            RefractionCameraEvent = (CameraEvent)m_editorUtils.EnumPopup("RefractionCameraEvent", RefractionCameraEvent, helpEnabled);
            GUI.enabled           = true;

            if (EditorGUI.EndChangeCheck())
            {
                if (ChangesMade())
                {
                    m_bufferManager.ClearBuffers();
                    m_bufferManager.m_allowHDR              = HDR;
                    m_bufferManager.m_renderSize            = RenderSize;
                    m_bufferManager.m_cameraEventRefraction = RefractionCameraEvent;
                    m_bufferManager.RebuildBuffers(false);
                    EditorUtility.SetDirty(m_bufferManager);
                }
            }
        }
Example #2
0
 private void RuntimeControls(bool helpEnabled)
 {
     m_editorUtils.Heading("Controls");
     if (m_profile.m_locationProfile != null)
     {
         m_profile.m_locationProfile.m_mainKey        = (KeyCode)m_editorUtils.EnumPopup("MasterKey", m_profile.m_locationProfile.m_mainKey, helpEnabled);
         m_profile.m_locationProfile.m_addBookmarkKey = (KeyCode)m_editorUtils.EnumPopup("AddNewBookmark", m_profile.m_locationProfile.m_addBookmarkKey, helpEnabled);
         m_profile.m_locationProfile.m_prevBookmark   = (KeyCode)m_editorUtils.EnumPopup("PreviousBookmark", m_profile.m_locationProfile.m_prevBookmark, helpEnabled);
         m_profile.m_locationProfile.m_nextBookmark   = (KeyCode)m_editorUtils.EnumPopup("NextBookmark", m_profile.m_locationProfile.m_nextBookmark, helpEnabled);
     }
     else
     {
         EditorGUILayout.HelpBox("No location profile provided. Please add one.", MessageType.Info);
     }
 }
Example #3
0
 private void CreateWorldMap(bool obj)
 {
     if (m_worldMap.m_worldMapTerrain == null)
     {
         EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("TerrainMissing"), MessageType.Warning);
     }
     else
     {
         EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("CreateTerrainInfo"), MessageType.Info);
     }
     m_worldMap.m_worldMapTileSize    = (GaiaConstants.EnvironmentSize)m_editorUtils.EnumPopup("TileSize", m_worldMap.m_worldMapTileSize);
     m_worldMap.m_heightmapResolution = (GaiaConstants.HeightmapResolution)m_editorUtils.EnumPopup("HeightmapResolution", m_worldMap.m_heightmapResolution);
     if (m_editorUtils.ButtonAutoIndent("CreateTerrainButton"))
     {
         m_worldMap.CreateWorldMapTerrain();
         m_worldMap.LookAtWorldMap();
     }
     return;
 }
Example #4
0
        private void GlobalSettings(bool helpEnabled)
        {
            m_editorUtils.Heading("ScreenshotSetup");
            EditorGUI.indentLevel++;
            m_profile.m_mainCamera      = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_mainCamera, typeof(Camera), true, helpEnabled);
            m_profile.m_watermark       = (Texture2D)m_editorUtils.ObjectField("Watermark", m_profile.m_watermark, typeof(Texture2D), true, helpEnabled, GUILayout.MaxHeight(16f));
            m_profile.m_targetDirectory = m_editorUtils.TextField("TargetDirectory", m_profile.m_targetDirectory, helpEnabled);
            m_profile.m_screenShotKey   = (KeyCode)m_editorUtils.EnumPopup("ScreenshotKey", m_profile.m_screenShotKey, helpEnabled);
            m_profile.m_imageFormat     = (GaiaConstants.ImageFileType)m_editorUtils.EnumPopup("ImageFormat", m_profile.m_imageFormat, helpEnabled);
            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
            m_editorUtils.Heading("ScreenshotResolutionSetup");
            EditorGUI.indentLevel++;
            m_profile.m_useScreenSize = m_editorUtils.Toggle("UseScreenSize", m_profile.m_useScreenSize, helpEnabled);
            if (!m_profile.m_useScreenSize)
            {
                GaiaConstants.ScreenshotResolution screenshotResolution = m_profile.m_screenshotResolution;
                screenshotResolution = (GaiaConstants.ScreenshotResolution)m_editorUtils.EnumPopup("ScreenshotResolution", screenshotResolution, helpEnabled);
                if (screenshotResolution != m_profile.m_screenshotResolution)
                {
                    m_profile.m_screenshotResolution = screenshotResolution;
                    m_profile.UpdateScreenshotResolution(m_profile.m_screenshotResolution);
                }

                if (screenshotResolution == GaiaConstants.ScreenshotResolution.Custom)
                {
                    EditorGUI.indentLevel++;
                    m_profile.m_targetWidth  = m_editorUtils.IntField("TargetWidth", m_profile.m_targetWidth, helpEnabled);
                    m_profile.m_targetHeight = m_editorUtils.IntField("TargetHeight", m_profile.m_targetHeight, helpEnabled);
                    EditorGUI.indentLevel--;
                }
            }

            EditorGUI.indentLevel--;
        }
Example #5
0
        public override void OnInspectorGUI()
        {
            m_editorUtils.Initialize(); // Do not remove this!

            m_orderBy           = (GaiaStopwatchOrderBy)m_editorUtils.EnumPopup("OrderBy", m_orderBy);
            m_orderbyDescending = m_editorUtils.Toggle("Descending", m_orderbyDescending);
            switch (m_orderBy)
            {
            case GaiaStopwatchOrderBy.FirstStart:
                m_orderByLambda = x => x.m_firstStartTimeStamp;
                break;

            case GaiaStopwatchOrderBy.Name:
                m_orderByLambda = x => x.m_name;
                break;

            case GaiaStopwatchOrderBy.TotalDuration:
                m_orderByLambda = x => x.m_accumulatedTime;
                break;
            }

            List <GaiaStopWatchEvent> relevantEvents;

            if (m_orderbyDescending)
            {
                relevantEvents = m_gaiastopwatchDataset.m_events.FindAll(x => x.m_parent == "" || x.m_parent == null).OrderByDescending(m_orderByLambda).ToList();
            }
            else
            {
                relevantEvents = m_gaiastopwatchDataset.m_events.FindAll(x => x.m_parent == "" || x.m_parent == null).OrderBy(m_orderByLambda).ToList();
            }

            foreach (GaiaStopWatchEvent stopWatchEvent in relevantEvents)
            {
                DrawStopwatchEvent(stopWatchEvent);
            }
        }
Example #6
0
        private void GlobalSettings(bool helpEnabled)
        {
            EditorGUI.BeginChangeCheck();
            GUIBackground    = GUI.backgroundColor;
            m_profile.Player = (Transform)m_editorUtils.ObjectField("Player", m_profile.Player, typeof(Transform), true, helpEnabled, GUILayout.MaxHeight(16f));
            if (m_profile.Player == null)
            {
                m_profile.Player = m_profile.GetPlayer();
            }
            if (m_profile.ReflectionMaskerData.m_maskingTexture == null)
            {
                EditorGUILayout.HelpBox("The mask texture is null. This system needs a mask texture to function please provide one.", MessageType.Error);
                GUI.backgroundColor = Color.red;
            }
            else
            {
                if (!m_profile.ReflectionMaskerData.m_maskingTexture.isReadable)
                {
                    EditorGUILayout.HelpBox("The mask texture " + m_profile.ReflectionMaskerData.m_maskingTexture.name + " is not Read/Write enabled please go to the texture import settings and enable this setting then click apply.", MessageType.Error);
                    GUI.backgroundColor = Color.red;
                }
            }
            m_profile.ReflectionMaskerData.m_maskingTexture = (Texture2D)m_editorUtils.ObjectField("MaskTexture", m_profile.ReflectionMaskerData.m_maskingTexture, typeof(Texture2D), false, helpEnabled, GUILayout.MaxHeight(16f));
            GUI.backgroundColor = GUIBackground;
            EditorGUI.indentLevel++;
            m_profile.ReflectionMaskerData.m_channelSelection = (ReflectionMaskerChannelSelection)m_editorUtils.EnumPopup("ChannelSelection", m_profile.ReflectionMaskerData.m_channelSelection, helpEnabled);
            m_profile.ReflectionMaskerData.m_minValue         = m_editorUtils.Slider("MinValue", m_profile.ReflectionMaskerData.m_minValue, 0f, m_profile.ReflectionMaskerData.m_maxValue - 0.01f, helpEnabled);
            m_profile.ReflectionMaskerData.m_maxValue         = m_editorUtils.Slider("MaxValue", m_profile.ReflectionMaskerData.m_maxValue, m_profile.ReflectionMaskerData.m_minValue + 0.01f, 1f, helpEnabled);
            EditorGUI.indentLevel--;

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(m_profile);
            }
        }
Example #7
0
        private void GlobalSettingsEnabled(bool helpEnabled)
        {
            if (PlayerSettings.colorSpace != ColorSpace.Linear)
            {
                GUI.backgroundColor = Color.yellow;
                EditorGUILayout.HelpBox("Gaia lighting looks best in Linear Color Space. Go to Gaia standard tab and press Set Linear Deferred", MessageType.Warning);
            }

            GUI.backgroundColor = defaultBackground;

            m_editorUtils.Heading("SetupSettings");
            m_profile.m_multiSceneLightingSupport = m_editorUtils.Toggle("MultiSceneSupport", m_profile.m_multiSceneLightingSupport, helpEnabled);
            if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition)
            {
                m_profile.m_masterSkyboxMaterial = (Material)m_editorUtils.ObjectField("MasterSkyboxMaterial", m_profile.m_masterSkyboxMaterial, typeof(Material), false, GUILayout.Height(16f));
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("LightmappingSettings");
            m_profile.m_lightingBakeMode = (GaiaConstants.BakeMode)m_editorUtils.EnumPopup("LightmappingBakeMode", m_profile.m_lightingBakeMode, helpEnabled);
#if UNITY_2020_1_OR_NEWER
            m_profile.m_lightmappingMode = (LightingSettings.Lightmapper)EditorGUILayout.EnumPopup("Lightmapping Mode", m_profile.m_lightmappingMode);
#else
            m_profile.m_lightmappingMode = (LightmapEditorSettings.Lightmapper)EditorGUILayout.EnumPopup("Lightmapping Mode", m_profile.m_lightmappingMode);
#endif
            EditorGUILayout.Space();

            m_editorUtils.Heading("PostProcessingSettings");
            m_profile.m_enablePostProcessing = m_editorUtils.ToggleLeft("EnablePostProcessing", m_profile.m_enablePostProcessing);
            if (m_profile.m_enablePostProcessing)
            {
                m_profile.m_hideProcessVolume = m_editorUtils.ToggleLeft("HidePostProcessingVolumesInScene", m_profile.m_hideProcessVolume);
                m_profile.m_antiAliasingMode  = (GaiaConstants.GaiaProAntiAliasingMode)EditorGUILayout.EnumPopup("Anti-Aliasing Mode", m_profile.m_antiAliasingMode);
                if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.BuiltIn)
                {
                    if (m_profile.m_antiAliasingMode == GaiaConstants.GaiaProAntiAliasingMode.TAA)
                    {
                        m_profile.m_AAJitterSpread       = m_editorUtils.Slider("AAJitterSpread", m_profile.m_AAJitterSpread, 0f, 1f, helpEnabled);
                        m_profile.m_AAStationaryBlending = m_editorUtils.Slider("AAStationaryBlending", m_profile.m_AAStationaryBlending, 0f, 1f, helpEnabled);
                        m_profile.m_AAMotionBlending     = m_editorUtils.Slider("AAMotionBlending", m_profile.m_AAMotionBlending, 0f, 1f, helpEnabled);
                        m_profile.m_AASharpness          = m_editorUtils.Slider("AASharpness", m_profile.m_AASharpness, 0f, 1f, helpEnabled);
                    }
                }
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("CameraSettings");
            m_profile.m_enableAutoDOF = m_editorUtils.Toggle("UseAutoDOF", m_profile.m_enableAutoDOF, helpEnabled);
            if (m_profile.m_enableAutoDOF)
            {
                m_profile.m_dofLayerDetection = GaiaEditorUtils.LayerMaskField(new GUIContent(m_editorUtils.GetTextValue("DOFLayerDetection"), m_editorUtils.GetTooltip("DOFLayerDetection")), m_profile.m_dofLayerDetection);
            }
            EditorGUILayout.Space();

            m_profile.m_usePhysicalCamera = m_editorUtils.Toggle("UsePhysicalCamera", m_profile.m_usePhysicalCamera, helpEnabled);
            if (m_profile.m_usePhysicalCamera)
            {
                m_profile.m_cameraFocalLength = m_editorUtils.FloatField("CameraFocalLength", m_profile.m_cameraFocalLength, helpEnabled);
                m_profile.m_cameraSensorSize  = m_editorUtils.Vector2Field("CameraSensorSize", m_profile.m_cameraSensorSize, helpEnabled);
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("MiscellaneousSettings");
            m_profile.m_globalReflectionProbe = m_editorUtils.ToggleLeft("GlobalReflectionProbe", m_profile.m_globalReflectionProbe);
            m_profile.m_parentObjects         = m_editorUtils.ToggleLeft("ParentObjectsToGaia", m_profile.m_parentObjects);
            m_profile.m_enableAmbientAudio    = m_editorUtils.ToggleLeft("EnableAmbientAudio", m_profile.m_enableAmbientAudio);

            if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition)
            {
                m_profile.m_enableFog = m_editorUtils.ToggleLeft("EnableFog", m_profile.m_enableFog);
            }
            else
            {
#if UNITY_2019_3_OR_NEWER
                EditorGUILayout.Space();
                m_editorUtils.Heading("HDRPSettings");
                if (m_profile.m_antiAliasingMode == GaiaConstants.GaiaProAntiAliasingMode.TAA)
                {
                    m_profile.m_antiAliasingTAAStrength = m_editorUtils.Slider("TAAStrength", m_profile.m_antiAliasingTAAStrength, 0f, 2f, helpEnabled);
                }
                m_profile.m_cameraDithering = m_editorUtils.Toggle("CameraDithering", m_profile.m_cameraDithering, helpEnabled);
                m_profile.m_cameraAperture  = m_editorUtils.Slider("CameraAperture", m_profile.m_cameraAperture, 1f, 32f, helpEnabled);
#endif
            }
        }
Example #8
0
        private void GlobalSettingsPanel(bool helpEnabled)
        {
            if (Application.isPlaying)
            {
                LoadFromApplicationPlaying();
            }

            m_editorUtils.Text("GaiaRuntimeInfo");
            EditorGUILayout.Space();

            m_profile.m_mainCamera = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_mainCamera, typeof(Camera), true, helpEnabled);
            if (m_profile.SceneProfile != null)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.BeginHorizontal();

                m_profile.SceneProfile.m_lightSystemMode = (GaiaConstants.GlobalSystemMode)m_editorUtils.EnumPopup("LightingSystemMode", m_profile.SceneProfile.m_lightSystemMode);
                if (m_profile.SceneProfile.m_lightSystemMode == GaiaConstants.GlobalSystemMode.Gaia)
                {
                    if (m_profile.SceneProfile.m_lightingProfiles.Count > 0)
                    {
                        if (m_editorUtils.Button("AdvancedLightingSettings", GUILayout.MaxWidth(170f)))
                        {
                            GaiaLighting.FocusGaiaLightingProfile();
                        }
                    }
                }
                else if (m_profile.SceneProfile.m_lightSystemMode == GaiaConstants.GlobalSystemMode.ThirdParty)
                {
                    if (m_editorUtils.Button("AdvancedLightingSettings", GUILayout.MaxWidth(170f)))
                    {
                        GaiaLighting.FocusGaiaLightingProfile();
                    }

                    /*if (m_profile.SceneProfile.m_thirdPartyLightObject != null)
                     * {
                     *  if (m_editorUtils.Button("EditThirdParty", GUILayout.MaxWidth(170f)))
                     *  {
                     *      Selection.activeObject = m_profile.SceneProfile.m_thirdPartyLightObject;
                     *  }
                     * }
                     * else
                     * {
                     *  if (m_editorUtils.Button("AdvancedLightingSettings", GUILayout.MaxWidth(170f)))
                     *  {
                     *      GaiaLighting.FocusGaiaLightingProfile();
                     *  }
                     * }*/
                }
                EditorGUILayout.EndHorizontal();

                m_editorUtils.InlineHelp("LightingSystemMode", helpEnabled);

                if (m_profile.SceneProfile.m_lightSystemMode == GaiaConstants.GlobalSystemMode.Gaia)
                {
                    if (m_profile.SceneProfile.m_lightingProfiles.Count < 1)
                    {
                        EditorGUILayout.HelpBox("No lighting data has been set you can go to Gaia Manager and click step 2 to create skies and water or you can go to Save and Load and click Revert To Defaults to load the skies and water data.", MessageType.Info);
                    }
                }
                else if (m_profile.SceneProfile.m_lightSystemMode == GaiaConstants.GlobalSystemMode.ThirdParty)
                {
                    if (m_profile.SceneProfile.m_thirdPartyLightObject == null)
                    {
                        EditorGUILayout.HelpBox("No Lighting System has been set, open 'Advanced Lighting Settings' to setup", MessageType.Info);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Lighting System Mode is set to 'None' to use light set the mode to 'Gaia or ThirdParty'", MessageType.Info);
                }

                EditorGUILayout.BeginHorizontal();

                m_profile.SceneProfile.m_waterSystemMode = (GaiaConstants.GlobalSystemMode)m_editorUtils.EnumPopup("WaterSystemMode", m_profile.SceneProfile.m_waterSystemMode);
                if (m_profile.SceneProfile.m_waterSystemMode == GaiaConstants.GlobalSystemMode.Gaia)
                {
                    if (m_profile.SceneProfile.m_waterProfiles.Count > 0)
                    {
                        if (m_editorUtils.Button("AdvancedWaterSettings", GUILayout.MaxWidth(170f)))
                        {
                            GaiaUtils.FocusWaterProfile();
                        }
                    }
                }
                else if (m_profile.SceneProfile.m_waterSystemMode == GaiaConstants.GlobalSystemMode.ThirdParty)
                {
                    if (m_editorUtils.Button("AdvancedWaterSettings", GUILayout.MaxWidth(170f)))
                    {
                        GaiaUtils.FocusWaterProfile();
                    }

                    /*if (m_profile.SceneProfile.m_thirdPartyWaterObject != null)
                     * {
                     *  if (m_editorUtils.Button("EditThirdParty", GUILayout.MaxWidth(170f)))
                     *  {
                     *      Selection.activeObject = m_profile.SceneProfile.m_thirdPartyLightObject;
                     *  }
                     * }
                     * else
                     * {
                     *  if (m_editorUtils.Button("AdvancedWaterSettings", GUILayout.MaxWidth(170f)))
                     *  {
                     *      GaiaUtils.FocusWaterProfile();
                     *  }
                     * }*/
                }
                EditorGUILayout.EndHorizontal();
                m_editorUtils.InlineHelp("WaterSystemMode", helpEnabled);

                if (m_profile.SceneProfile.m_waterSystemMode == GaiaConstants.GlobalSystemMode.Gaia)
                {
                    if (m_profile.SceneProfile.m_lightingProfiles.Count < 1)
                    {
                        EditorGUILayout.HelpBox("No lighting data has been set you can go to Gaia Manager and click step 2 to create skies and water or you can go to Save and Load and click Revert To Defaults to load the skies and water data.", MessageType.Info);
                    }
                }
                else if (m_profile.SceneProfile.m_waterSystemMode == GaiaConstants.GlobalSystemMode.ThirdParty)
                {
                    if (m_profile.SceneProfile.m_thirdPartyWaterObject == null)
                    {
                        EditorGUILayout.HelpBox("No Water System has been set, open 'Advanced Water Settings' to setup", MessageType.Info);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Water System Mode is set to 'None' to use light set the mode to 'Gaia or ThirdParty'", MessageType.Info);
                }

                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(m_profile);
                    Undo.RecordObject(m_profile, "Changes Made");

                    m_profile.UpdateGaiaTimeOfDay(false);
                    m_profile.UpdateGaiaWeather();
                }

                m_editorUtils.Panel("SaveAndLoad", SaveAndLoad);
            }
        }
Example #9
0
        private void DrawGeneralSettings(bool helpEnabled)
        {
            m_terrainLoaderManager.TerrainSceneStorage = (TerrainSceneStorage)m_editorUtils.ObjectField("TerrainSceneStorage", m_terrainLoaderManager.TerrainSceneStorage, typeof(TerrainSceneStorage), false, helpEnabled);

            bool oldLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled;

            m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled = m_editorUtils.Toggle("TerrainLoadingEnabled", m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled, helpEnabled);
            if (!oldLoadingEnabled && m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled)
            {
                //User re-enabled the loaders
                m_terrainLoaderManager.UpdateTerrainLoadState();
            }
            if (oldLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled)
            {
                //Value was changed, dirty the object to make sure the value is being saved
                EditorUtility.SetDirty(m_terrainLoaderManager.TerrainSceneStorage);
            }

            bool originalGUIState = GUI.enabled;

            m_terrainLoaderManager.m_terrainLoadingTresholdMS    = m_editorUtils.IntField("LoadingTimeTreshold", m_terrainLoaderManager.m_terrainLoadingTresholdMS, helpEnabled);
            m_terrainLoaderManager.m_trackLoadingProgressTimeOut = m_editorUtils.LongField("LoadingProgressTimeout", m_terrainLoaderManager.m_trackLoadingProgressTimeOut, helpEnabled);
            GUILayout.Space(10);
            m_editorUtils.Heading("SceneViewLoading");
            m_terrainLoaderManager.CenterSceneViewLoadingOn = (CenterSceneViewLoadingOn)m_editorUtils.EnumPopup("CenterSceneViewLoadingOn", m_terrainLoaderManager.CenterSceneViewLoadingOn, helpEnabled);
            double loadingRange         = m_editorUtils.DoubleField("SceneViewLoadingRange", m_terrainLoaderManager.GetLoadingRange(), helpEnabled);
            double impostorLoadingRange = m_terrainLoaderManager.GetImpostorLoadingRange();

            if (GaiaUtils.HasImpostorTerrains())
            {
                impostorLoadingRange = m_editorUtils.DoubleField("SceneViewImpostorLoadingRange", m_terrainLoaderManager.GetImpostorLoadingRange(), helpEnabled);
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                m_editorUtils.Label("SceneViewImpostorLoadingRange");
                //offer button to create impostors setup
                if (m_editorUtils.Button("OpenTerrainMeshExporterForImpostors", GUILayout.Width(EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 38)))
                {
                    ExportTerrain exportTerrainWindow = EditorWindow.GetWindow <ExportTerrain>();
                    exportTerrainWindow.FindAndSetPreset("Create Impostors");
                    exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false;
                }
                EditorGUILayout.EndHorizontal();
            }

            if (loadingRange != m_terrainLoaderManager.GetLoadingRange() || impostorLoadingRange != m_terrainLoaderManager.GetImpostorLoadingRange())
            {
                m_terrainLoaderManager.SetLoadingRange(loadingRange, impostorLoadingRange);
            }

            GUILayout.Space(10);
            m_editorUtils.Heading("CachingSettings");
            m_editorUtils.InlineHelp("CachingSettings", helpEnabled);
            EditorGUI.BeginChangeCheck();
            m_terrainLoaderManager.m_cacheInRuntime = m_editorUtils.Toggle("CacheInRuntime", m_terrainLoaderManager.m_cacheInRuntime, helpEnabled);
            m_terrainLoaderManager.m_cacheInEditor  = m_editorUtils.Toggle("CacheInEditor", m_terrainLoaderManager.m_cacheInEditor, helpEnabled);
            string allocatedMegabytes = (Math.Round(Profiler.GetTotalAllocatedMemoryLong() / Math.Pow(1024, 2))).ToString();
            string availableMegabytes = SystemInfo.systemMemorySize.ToString();

            allocatedMegabytes = allocatedMegabytes.PadLeft(allocatedMegabytes.Length + (availableMegabytes.Length - allocatedMegabytes.Length) * 3, ' ');

            GUIStyle style = new GUIStyle(GUI.skin.label);

            if (m_terrainLoaderManager.m_cacheMemoryThreshold < Profiler.GetTotalAllocatedMemoryLong())
            {
                style = redStyle;
            }
            else
            {
                style = greenStyle;
            }
            m_editorUtils.LabelField("MemoryAvailable", new GUIContent(availableMegabytes), helpEnabled);
            m_editorUtils.LabelField("MemoryAllocated", new GUIContent(allocatedMegabytes), style, helpEnabled);

            //GUI.color = originalGUIColor;

            if (m_terrainLoaderManager.m_cacheInRuntime || m_terrainLoaderManager.m_cacheInEditor)
            {
                m_terrainLoaderManager.m_cacheMemoryThresholdPreset = (CacheSizePreset)m_editorUtils.EnumPopup("CacheMemoryThreshold", m_terrainLoaderManager.m_cacheMemoryThresholdPreset, helpEnabled);
                if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset == CacheSizePreset.Custom)
                {
                    EditorGUI.indentLevel++;
                    m_terrainLoaderManager.m_cacheMemoryThreshold = m_editorUtils.LongField("ThresholdInBytes", m_terrainLoaderManager.m_cacheMemoryThreshold, helpEnabled);
                    EditorGUI.indentLevel--;
                }
                int cacheKeepAliveSeconds = (int)m_terrainLoaderManager.m_cacheKeepAliveTime / 1000;
                cacheKeepAliveSeconds = m_editorUtils.IntField("CacheKeepAliveSeconds", cacheKeepAliveSeconds, helpEnabled);
                m_terrainLoaderManager.m_cacheKeepAliveTime = cacheKeepAliveSeconds * 1000;
            }
            if (EditorGUI.EndChangeCheck())
            {
                if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset != CacheSizePreset.Custom)
                {
                    m_terrainLoaderManager.m_cacheMemoryThreshold = (long)((int)m_terrainLoaderManager.m_cacheMemoryThresholdPreset * Math.Pow(1024, 3));
                }
                m_terrainLoaderManager.UpdateCaching();
            }



            GUILayout.Space(10);

            if (!GaiaUtils.HasColliderTerrains())
            {
                GUI.enabled = false;
            }

            m_editorUtils.Heading("ColliderOnlyLoadingHeader");
            //This flag is special in so far as that when the user switches it, we must first perform a scene unload while the old value is still active
            //then change the flag in the terrain scene storage and then do a refresh with the new setting applied.
            bool colliderLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading;

            colliderLoadingEnabled = m_editorUtils.Toggle("ColliderOnlyLoadingEnabled", colliderLoadingEnabled, helpEnabled);
            if (colliderLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading)
            {
                //User changed the flag, do an unload with the old setting
                m_terrainLoaderManager.UnloadAll(true);
                //then change the actual flag in storage
                m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading = colliderLoadingEnabled;
                //now do a refresh under the new setting
                m_terrainLoaderManager.RefreshSceneViewLoadingRange();

                //Add the required scenes to build settings
                if (colliderLoadingEnabled)
                {
                    GaiaSessionManager.AddOnlyColliderScenesToBuildSettings(TerrainLoaderManager.TerrainScenes);
                }
                else
                {
                    GaiaSessionManager.AddTerrainScenesToBuildSettings(TerrainLoaderManager.TerrainScenes);
                }
            }

            GUI.enabled = originalGUIState;

            if (colliderLoadingEnabled)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingInfo"), MessageType.Info);
                m_editorUtils.Heading("DeactivateRuntimeHeader");
                EditorGUI.indentLevel++;
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer        = m_editorUtils.Toggle("DeactivateRuntimePlayer", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer, helpEnabled);
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting      = m_editorUtils.Toggle("DeactivateRuntimeLighting", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting, helpEnabled);
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio         = m_editorUtils.Toggle("DeactivateRuntimeAudio", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio, helpEnabled);
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather       = m_editorUtils.Toggle("DeactivateRuntimeWeather", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather, helpEnabled);
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater         = m_editorUtils.Toggle("DeactivateRuntimeWater", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater, helpEnabled);
                m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter = m_editorUtils.Toggle("DeactivateRuntimeScreenShotter", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter, helpEnabled);
                EditorGUI.indentLevel--;
            }
            else
            {
                //offer button to create collider setup
                if (m_editorUtils.Button("OpenTerrainMeshExporterForColliders"))
                {
                    ExportTerrain exportTerrainWindow = EditorWindow.GetWindow <ExportTerrain>();
                    exportTerrainWindow.FindAndSetPreset("Collider");
                    exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false;
                }
            }
        }
Example #10
0
        private void GlobalSettings(bool helpEnabled)
        {
            if (GaiaGlobal.Instance.SceneProfile.m_lightingProfiles.Count > 0)
            {
                if (m_profile.m_selectedLightingProfileValuesIndex != -99)
                {
                    profile = GaiaGlobal.Instance.SceneProfile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex];
                }
            }

            if (m_gaiaSettings.m_currentRenderer == GaiaConstants.EnvironmentRenderer.BuiltIn)
            {
                bool postfx = m_profile.m_setupPostFX;
                m_profile.m_setupPostFX = m_editorUtils.Toggle("SetupPostFX", m_profile.m_setupPostFX, helpEnabled);
                if (postfx != m_profile.m_setupPostFX)
                {
                    if (m_profile.m_setupPostFX)
                    {
                        if (profile != null)
                        {
                            GaiaLighting.SetupPostProcessing(profile, m_profile, GaiaUtils.GetActivePipeline(), true);
                        }
                    }
                    else
                    {
                        GaiaLighting.RemoveAllPostProcessV2CameraLayer();
                    }
                }
            }
            m_profile.m_spawnPlayerAtCurrentLocation = m_editorUtils.Toggle("SpawnPlayerAtCurrentLocation", m_profile.m_spawnPlayerAtCurrentLocation, helpEnabled);

            GaiaConstants.EnvironmentControllerType controller = m_profile.m_controllerType;
            controller = (GaiaConstants.EnvironmentControllerType)m_editorUtils.EnumPopup("ControllerType", controller, helpEnabled);
            if (controller != m_profile.m_controllerType)
            {
                m_gaiaSettings.m_currentController = controller;
                switch (controller)
                {
                case GaiaConstants.EnvironmentControllerType.FirstPerson:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFirstPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.FlyingCamera:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFlyCamName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.ThirdPerson:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerThirdPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.Car:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.m_carPlayerPrefabName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.XRController:
#if GAIA_XR
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "XRController", m_profile.m_spawnPlayerAtCurrentLocation);
#else
                    EditorUtility.DisplayDialog("XR Support not enabled", "The XR Controller is a default player for Virtual / Augmented Reality projects. Please open the Setup Panel in the Gaia Manager Standard Tab to enable XR Support in order to use the XR Player Controller. Please also make sure you have the Unity XR Interaction Toolkit package installed before doing so.", "OK");
                    controller = GaiaConstants.EnvironmentControllerType.FlyingCamera;
                    m_gaiaSettings.m_currentController = GaiaConstants.EnvironmentControllerType.FlyingCamera;
#endif
                    break;
                }

                SetPostProcessing(profile);
#if GAIA_PRO_PRESENT
                if (GaiaUtils.HasDynamicLoadedTerrains())
                {
                    TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                    if (tl != null)
                    {
                        m_profile.UpdateTerrainLoaderFromProfile(ref tl);
                    }
                }
#endif
                m_profile.m_controllerType = controller;
            }

            if (controller == GaiaConstants.EnvironmentControllerType.Custom)
            {
                m_profile.m_customPlayer = (GameObject)m_editorUtils.ObjectField("MainPlayer", m_profile.m_customPlayer, typeof(GameObject), true, helpEnabled);
                m_profile.m_customCamera = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_customCamera, typeof(Camera), true, helpEnabled);

                if (m_editorUtils.Button("ApplySetup"))
                {
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "Custom", m_profile.m_spawnPlayerAtCurrentLocation, m_profile.m_customPlayer, m_profile.m_customCamera, true);
                    SetPostProcessing(profile);
#if GAIA_PRO_PRESENT
                    if (GaiaUtils.HasDynamicLoadedTerrains())
                    {
                        TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                        if (tl != null)
                        {
                            m_profile.UpdateTerrainLoaderFromProfile(ref tl);
                        }
                    }
#endif
                }
            }

            EditorGUILayout.BeginHorizontal();

            if (m_editorUtils.Button("MoveCameraToPlayer"))
            {
                GaiaSceneManagement.MoveCameraToPlayer(m_gaiaSettings);
            }

            if (m_editorUtils.Button("MovePlayerToCamera"))
            {
                GaiaSceneManagement.MovePlayerToCamera(m_gaiaSettings);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            m_editorUtils.Panel("AutoDepthOfFieldSettings", AutoDepthOfField);
            m_editorUtils.Panel("LocationManagerSettings", LocationManagerSettings);
            m_editorUtils.Panel("PlayerCameraCullingSettings", CameraCullingSettings);
            if (GaiaUtils.HasDynamicLoadedTerrains())
            {
                m_editorUtils.Panel("TerrainLoadingSettings", TerrainLoadingSettings);
            }
        }