private void TerrainLoadingSettings(bool helpEnabled) { #if GAIA_PRO_PRESENT EditorGUI.BeginChangeCheck(); if (!TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainLoadingEnabled) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("AutoLoadTerrainsDisabled"), MessageType.Warning); GUI.enabled = false; } if (TerrainLoaderManager.ColliderOnlyLoadingActive) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingWarning"), MessageType.Warning); } m_profile.m_terrainLoaderLoadMode = (LoadMode)m_editorUtils.EnumPopup("LoadMode", m_profile.m_terrainLoaderLoadMode, helpEnabled); if (m_profile.m_terrainLoaderLoadMode == LoadMode.RuntimeAlways) { EditorGUI.indentLevel++; m_editorUtils.InlineHelp("RefreshRates", helpEnabled); m_profile.m_terrainLoaderMinRefreshDistance = m_editorUtils.FloatField("MinRefreshDistance", m_profile.m_terrainLoaderMinRefreshDistance, helpEnabled); m_profile.m_terrainLoaderMaxRefreshDistance = m_editorUtils.FloatField("MaxRefreshDistance", m_profile.m_terrainLoaderMaxRefreshDistance, helpEnabled); m_profile.m_terrainLoaderMinRefreshMS = m_editorUtils.FloatField("MinRefreshMS", m_profile.m_terrainLoaderMinRefreshMS, helpEnabled); m_profile.m_terrainLoaderMaxRefreshMS = m_editorUtils.FloatField("MaxRefreshMS", m_profile.m_terrainLoaderMaxRefreshMS, helpEnabled); EditorGUI.indentLevel--; } m_editorUtils.Heading("LoadRange"); EditorGUI.indentLevel++; m_profile.m_terrainLoaderFollowTransform = m_editorUtils.Toggle("FollowTransform", m_profile.m_terrainLoaderFollowTransform, helpEnabled); if (TerrainLoaderManager.ColliderOnlyLoadingActive) { if (!m_profile.m_terrainLoaderFollowTransform) { m_profile.m_terrainLoaderLoadingBoundsCollider.center = m_editorUtils.Vector3Field("LoadingBoundsColliderCenter", m_profile.m_terrainLoaderLoadingBoundsCollider.center, helpEnabled); } m_profile.m_terrainLoaderLoadingBoundsCollider.extents = m_editorUtils.Vector3Field("LoadingBoundsColliderExtents", m_profile.m_terrainLoaderLoadingBoundsCollider.extents, helpEnabled); } else { if (!m_profile.m_terrainLoaderFollowTransform) { m_profile.m_terrainLoaderLoadingBoundsRegular.center = m_editorUtils.Vector3Field("LoadingBoundsCenter", m_profile.m_terrainLoaderLoadingBoundsRegular.center, helpEnabled); } m_profile.m_terrainLoaderLoadingBoundsRegular.extents = m_editorUtils.Vector3Field("LoadingBoundsExtents", m_profile.m_terrainLoaderLoadingBoundsRegular.extents, helpEnabled); if (!m_profile.m_terrainLoaderFollowTransform) { m_profile.m_terrainLoaderLoadingBoundsImpostor.center = m_editorUtils.Vector3Field("LoadingBoundsImpostorCenter", m_profile.m_terrainLoaderLoadingBoundsImpostor.center, helpEnabled); } m_profile.m_terrainLoaderLoadingBoundsImpostor.extents = m_editorUtils.Vector3Field("LoadingBoundsImpostorExtents", m_profile.m_terrainLoaderLoadingBoundsImpostor.extents, helpEnabled); } EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>(); m_profile.UpdateTerrainLoaderFromProfile(ref tl); } #endif }
private void GlobalPanel(bool helpEnabled) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("WindManagerInfo"), MessageType.Info); m_manager.windGlobalMaxDist = m_editorUtils.Slider("GlobalWindDistance", m_manager.windGlobalMaxDist, 100f, 10000f, helpEnabled); EditorGUILayout.Space(); m_editorUtils.Heading("WindSettings"); m_manager.m_useWindAudio = m_editorUtils.Toggle("UseWindAudio", m_manager.m_useWindAudio, helpEnabled); if (m_manager.m_useWindAudio) { EditorGUI.indentLevel++; m_manager.m_windTransitionTime = m_editorUtils.FloatField("WindTransitionTime", m_manager.m_windTransitionTime, helpEnabled); if (m_manager.m_windTransitionTime < 0.1f) { m_manager.m_windTransitionTime = 0.1f; } m_manager.m_windAudioClip = (AudioClip)m_editorUtils.ObjectField("WindAudioClip", m_manager.m_windAudioClip, typeof(AudioClip), false, helpEnabled); EditorGUI.indentLevel--; } }
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 } }
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(); }
private void GlobalSettings(bool helpEnabled) { m_editorUtils.Heading("GlobalSettings"); m_profile.EnableUnderwaterEffects = m_editorUtils.Toggle("EnableUnderwaterEffects", m_profile.EnableUnderwaterEffects, helpEnabled); m_profile.m_seaLevel = m_editorUtils.FloatField("SeaLevel", m_profile.m_seaLevel, helpEnabled); m_profile.m_playerCamera = (Transform)m_editorUtils.ObjectField("PlayerCamera", m_profile.m_playerCamera, typeof(Transform), helpEnabled); m_profile.m_startingUnderwater = m_editorUtils.Toggle("StartingUnderwater", m_profile.m_startingUnderwater, helpEnabled); bool transitionEnabled = m_profile.m_enableTransitionFX; transitionEnabled = m_editorUtils.Toggle("EnableTransitionFX", transitionEnabled, helpEnabled); if (m_profile.m_enableTransitionFX != transitionEnabled) { m_profile.m_enableTransitionFX = transitionEnabled; m_profile.SetupTransitionVFX(m_profile.m_enableTransitionFX); } EditorGUILayout.Space(); m_editorUtils.Heading("CausticSettings"); m_profile.m_useCaustics = m_editorUtils.Toggle("UseCaustics", m_profile.m_useCaustics, helpEnabled); if (m_profile.m_useCaustics) { m_profile.m_mainLight = (Light)m_editorUtils.ObjectField("MainLight", m_profile.m_mainLight, typeof(Light), helpEnabled); m_profile.m_framesPerSecond = m_editorUtils.IntField("FramesPerSecond", m_profile.m_framesPerSecond, helpEnabled); m_profile.m_causticSize = m_editorUtils.Slider("CausticSize", m_profile.m_causticSize, 1f, 100f, helpEnabled); m_profile.m_editCausticTextures = m_editorUtils.Toggle("EditCausticTextures", m_profile.m_editCausticTextures, helpEnabled); if (m_profile.m_editCausticTextures) { for (int i = 0; i < m_profile.m_causticTextures.Count; i++) { EditorGUILayout.BeginHorizontal(); m_profile.m_causticTextures[i] = (Texture2D)EditorGUILayout.ObjectField(new GUIContent("[" + i + "]" + m_editorUtils.GetTextValue("CausticTexture"), m_editorUtils.GetTooltip("CausticTexture")), m_profile.m_causticTextures[i], typeof(Texture2D), false, GUILayout.MaxHeight(16f)); if (m_editorUtils.Button("Remove", GUILayout.MaxWidth(30f))) { m_profile.m_causticTextures.RemoveAt(i); } EditorGUILayout.EndHorizontal(); } if (m_editorUtils.Button("Add")) { m_profile.m_causticTextures.Add(null); } } } EditorGUILayout.Space(); m_editorUtils.Heading("FogSettings"); m_profile.m_supportFog = m_editorUtils.Toggle("SupportFog", m_profile.m_supportFog, helpEnabled); if (m_profile.m_supportFog) { m_profile.m_fogColorGradient = EditorGUILayout.GradientField(new GUIContent(m_editorUtils.GetTextValue("FogColor"), m_editorUtils.GetTooltip("FogColor")), m_profile.m_fogColorGradient); m_editorUtils.InlineHelp("FogColor", helpEnabled); if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition) { if (RenderSettings.fogMode == FogMode.Linear) { m_profile.m_nearFogDistance = m_editorUtils.FloatField("FogStartDistance", m_profile.m_nearFogDistance, helpEnabled); m_profile.m_fogDistance = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled); } else { m_profile.m_fogDensity = m_editorUtils.Slider("FogDensity", m_profile.m_fogDensity, 0f, 1f, helpEnabled); } } else { m_profile.m_fogDistance = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled); } } EditorGUILayout.Space(); m_editorUtils.Heading("AudioSettings"); m_profile.m_playbackVolume = m_editorUtils.Slider("PlaybackVolume", m_profile.m_playbackVolume, 0f, 1f, helpEnabled); m_profile.m_submergeSoundFXDown = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXDown", m_profile.m_submergeSoundFXDown, typeof(AudioClip), helpEnabled); m_profile.m_submergeSoundFXUp = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXUp", m_profile.m_submergeSoundFXUp, typeof(AudioClip), helpEnabled); m_profile.m_underwaterSoundFX = (AudioClip)m_editorUtils.ObjectField("UnderwaterSoundFX", m_profile.m_underwaterSoundFX, typeof(AudioClip), helpEnabled); }