private void RealtimeUpdateEnabled(bool helpEnabled) { m_profile.m_updateInRealtime = m_editorUtils.ToggleLeft("UpdateChangesInRealtime", m_profile.m_updateInRealtime, helpEnabled); if (m_profile.m_updateInRealtime) { EditorGUILayout.HelpBox("Update In Realtime is enabled this will allow profiles to be endited inside the editor and automatically apply changes every frame. This feature can be expensive and should not be left enabled in testing and builds", MessageType.Warning); } else { if (m_editorUtils.Button("UpdateToScene")) { if (m_profile.m_selectedLightingProfileValuesIndex != -99) { GaiaUtils.GetRuntimeSceneObject(); if (GaiaGlobal.Instance != null) { //GaiaLighting.GetProfile(m_profile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled); EditorUtility.SetDirty(m_profile); } } } m_editorUtils.InlineHelp("UpdateToScene", helpEnabled); if (m_editorUtils.Button("UpdateDynamicGI")) { GaiaLighting.UpdateAmbientEnvironment(); } m_editorUtils.InlineHelp("UpdateDynamicGI", helpEnabled); } }
private void GlobalPanel(bool helpEnabled) { EditorGUILayout.BeginHorizontal(); m_profile.m_tagCheck = m_editorUtils.TextField("TagCheck", m_profile.m_tagCheck); if (m_editorUtils.Button("LoadTagFromGaia", GUILayout.MaxWidth(130f))) { m_profile.LoadTagFromGaia(); } EditorGUILayout.EndHorizontal(); m_editorUtils.InlineHelp("TagCheck", helpEnabled); }
private void DrawBiomeSettings(bool helpEnabled) { m_biomePreset.m_orderNumber = m_editorUtils.IntField("OrderNumber", m_biomePreset.m_orderNumber, helpEnabled); Rect listRect = EditorGUILayout.GetControlRect(true, m_spawnerPresetList.GetHeight()); m_spawnerPresetList.DoList(listRect); m_editorUtils.InlineHelp("SpawnerAdded", helpEnabled); if (m_biomePreset.m_spawnerPresetList.Count == 0) { GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoSpawnersYet"), MessageType.Warning); GUILayout.Space(10); if (m_editorUtils.Button("CreateFirstSpawner")) { GameObject spawnerObj = new GameObject("New Spawner"); Spawner spawner = spawnerObj.AddComponent <Spawner>(); spawner.m_createdfromBiomePreset = true; Selection.activeGameObject = spawnerObj; } GUILayout.Space(20); } else { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (m_editorUtils.Button("CreateAdditionalSpawner", GUILayout.MaxWidth(200))) { GameObject spawnerObj = new GameObject("New Spawner"); Spawner spawner = spawnerObj.AddComponent <Spawner>(); spawner.m_createdfromBiomePreset = true; Selection.activeGameObject = spawnerObj; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.Space(EditorGUIUtility.singleLineHeight); m_biomePreset.GaiaSceneCullingProfile = (GaiaSceneCullingProfile)m_editorUtils.ObjectField("GaiaSceneCullingProfile", m_biomePreset.GaiaSceneCullingProfile, typeof(GaiaSceneCullingProfile), false, helpEnabled); #if UNITY_POST_PROCESSING_STACK_V2 GUILayout.Space(EditorGUIUtility.singleLineHeight); m_biomePreset.postProcessProfile = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_biomePreset.postProcessProfile, typeof(PostProcessProfile), false, helpEnabled); #endif GUILayout.Space(EditorGUIUtility.singleLineHeight); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(m_biomePreset); }
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 SelectStampPanel(bool helpEnabled) { m_editorUtils.InlineHelp("Help", helpEnabled); if (m_editedImageMask == null && m_editedStamperSettings == null) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoConnectedImageMask"), MessageType.Warning, true); } m_editorUtils.Label("StampPreview"); EditorGUILayout.BeginVertical(); if (m_previewTexture != null && m_validStampInCategory) { m_editorUtils.Image(m_previewTexture, position.width - 25, position.width - 25); m_editorUtils.Label(new GUIContent(m_previewTexture.name)); } else { if (!m_validStampInCategory) { GUILayout.Space(71); EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoValidStampInCategory"), MessageType.Info, true); } else if (m_previewTexture == null) { GUILayout.Space(67); EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoTexture"), MessageType.Info, true); } GUILayout.Space(155); } GUILayout.Space(EditorGUIUtility.singleLineHeight); Rect rect = EditorGUILayout.GetControlRect(); if (GUI.Button(new Rect(rect.x, rect.y, 50, EditorGUIUtility.singleLineHeight), m_editorUtils.GetContent("StampBackwardButton"))) { PickNextStamp(-1); } //Building up a value array of incrementing ints of the size of the directory names array, this array will then match the displayed string selection in the popup int[] categoryIDArray = Enumerable .Repeat(0, (int)((m_categoryNames.ToArray().Length - 0) / 1) + 1) .Select((tr, ti) => tr + (1 * ti)) .ToArray(); int previousCategoryID = m_selectedCategoryID; m_selectedCategoryID = EditorGUI.IntPopup(new Rect(rect.x + 60, rect.y, rect.width - 120, EditorGUIUtility.singleLineHeight), m_selectedCategoryID, m_categoryNames.ToArray(), categoryIDArray); if (previousCategoryID != m_selectedCategoryID) { LoadStampDirFileInfo(); m_currentStampIndex = -1; m_validStampInCategory = PickNextStamp(1); } if (GUI.Button(new Rect(rect.x + 60 + rect.width - 110, rect.y, 50, EditorGUIUtility.singleLineHeight), m_editorUtils.GetContent("StampForwardButton"))) { PickNextStamp(1); } rect.y += EditorGUIUtility.singleLineHeight * 2; if (GUI.Button(new Rect(rect.x + 20, rect.y, 100, EditorGUIUtility.singleLineHeight * 2), m_editorUtils.GetContent("ApplyButton"))) { Close(); } if (GUI.Button(new Rect(rect.x + rect.width - 100 - 20, rect.y, 100, EditorGUIUtility.singleLineHeight * 2), m_editorUtils.GetContent("CancelButton"))) { //Load original stamp back in and close if (m_editedImageMask != null) { m_editedImageMask.ImageMaskTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_originalTextureGUID), typeof(Texture2D)); } //if (m_editedStamperSettings != null) //{ // m_editedStamperSettings.m_stamperInputImage = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_originalTextureGUID), typeof(Texture2D)); //} UpdateToolsAndScene(); Close(); } EditorGUILayout.EndVertical(); }
private void BookmarkSetup(bool helpEnabled) { if (m_profile.m_locationProfile != null) { m_editorUtils.Heading("BookmarkSetup"); m_profile.m_locationProfile.m_autoLoad = m_editorUtils.Toggle("AutoLoad", m_profile.m_locationProfile.m_autoLoad, helpEnabled); if (m_profile.m_locationProfile.m_bookmarkedLocationNames.Count > 0) { int selected = m_profile.m_selectedBookmark; for (int i = 0; i < m_profile.m_locationProfile.m_bookmarkedLocationNames.Count; i++) { if (m_profile.m_locationProfile.m_bookmarkedLocationNames[i] == m_profile.m_bookmarkName) { m_profile.m_bookmarkName = ObjectNames.GetUniqueName(m_profile.m_locationProfile.m_bookmarkedLocationNames.ToArray(), m_profile.m_bookmarkName); } } EditorGUILayout.BeginHorizontal(); m_profile.m_bookmarkName = m_editorUtils.TextField("BookmarkName", m_profile.m_bookmarkName); if (m_editorUtils.Button("AddBookmark", GUILayout.MaxWidth(60f))) { m_profile.m_locationProfile.AddNewBookmark(m_profile); selected = m_profile.m_locationProfile.m_bookmarkedLocationNames.Count - 1; m_profile.m_selectedBookmark = m_profile.m_locationProfile.m_bookmarkedLocationNames.Count - 1; } EditorGUILayout.EndHorizontal(); m_editorUtils.InlineHelp("BookmarkName", helpEnabled); if (!m_profile.m_rename) { EditorGUILayout.BeginHorizontal(); selected = EditorGUILayout.Popup(new GUIContent(m_editorUtils.GetTextValue("SelectedBookmark"), m_editorUtils.GetTooltip("SelectedBookmark")), selected, m_profile.m_locationProfile.m_bookmarkedLocationNames.ToArray()); if (selected != m_profile.m_selectedBookmark) { m_profile.m_selectedBookmark = selected; if (m_profile.m_locationProfile.m_autoLoad) { m_profile.m_locationProfile.LoadBookmark(m_profile); } } if (m_editorUtils.Button("Rename", GUILayout.MaxWidth(60f))) { m_profile.m_savedName = m_profile.m_locationProfile.m_bookmarkedLocationNames[m_profile.m_selectedBookmark]; m_profile.m_rename = true; } if (m_editorUtils.Button("Override", GUILayout.MaxWidth(60f))) { m_profile.m_locationProfile.OverrideBookmark(m_profile); } if (!m_profile.m_locationProfile.m_autoLoad) { if (m_editorUtils.Button("LoadBookmark", GUILayout.MaxWidth(60f))) { m_profile.m_locationProfile.LoadBookmark(m_profile); } } EditorGUILayout.EndHorizontal(); m_editorUtils.InlineHelp("SelectedBookmark", helpEnabled); if (m_profile.m_locationProfile.m_bookmarkedLocationNames.Count > 0) { EditorGUILayout.LabelField("Current Bookmark Controller Type Used: " + m_profile.m_locationProfile.m_bookmarkedSettings[selected].m_controllerUsed, EditorStyles.boldLabel); } EditorGUILayout.LabelField("Current Bookmark Was Created In Scene: " + m_profile.m_locationProfile.m_bookmarkedSettings[selected].m_sceneName, EditorStyles.boldLabel); } else { EditorGUILayout.BeginHorizontal(); m_profile.m_savedName = m_editorUtils.TextField("BookmarkRename", m_profile.m_savedName); if (m_editorUtils.Button("Save", GUILayout.MaxWidth(55f))) { m_profile.m_locationProfile.m_bookmarkedLocationNames[m_profile.m_selectedBookmark] = m_profile.m_savedName; m_profile.m_rename = false; } EditorGUILayout.EndHorizontal(); m_editorUtils.InlineHelp("BookmarkRename", helpEnabled); } EditorGUILayout.BeginHorizontal(); if (m_editorUtils.Button("RemoveBookmark")) { if (EditorUtility.DisplayDialog("Removing Bookmark", "Are you sure you want to remove " + m_profile.m_locationProfile.m_bookmarkedLocationNames[selected] + " bookmark?", "Yes", "No")) { m_profile.m_locationProfile.RemoveBookmark(m_profile.m_selectedBookmark, m_profile); } } if (m_editorUtils.Button("RemoveAllBookmark")) { if (EditorUtility.DisplayDialog("Removing All Bookmarks", "Are you sure you want to remove all the bookmarks?", "Yes", "No")) { m_profile.m_locationProfile.RemoveAllBookmarks(); } } EditorGUILayout.EndHorizontal(); } else { m_profile.m_selectedBookmark = 0; EditorGUILayout.BeginHorizontal(); m_profile.m_bookmarkName = m_editorUtils.TextField("BookmarkName", m_profile.m_bookmarkName); if (m_editorUtils.Button("AddBookmark", GUILayout.MaxWidth(55f))) { m_profile.m_locationProfile.AddNewBookmark(m_profile); m_profile.m_selectedBookmark = m_profile.m_locationProfile.m_bookmarkedLocationNames.Count - 1; } EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("No bookmarks added to use bookmark features please press 'Add Bookmark'", MessageType.Info); } } else { EditorGUILayout.HelpBox("No location profile provided. Please add one.", MessageType.Info); } }
private void GlobalPanel(bool helpEnabled) { //Text intro GUILayout.BeginVertical("Gaia Scanner", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("The Gaia Scanner allows you to create new stamps from Windows R16, Windows 16 bit RAW, Mac 16 bit RAW, Terrains, Textures or Meshes. Just drag and drop the file or object onto the area below to scan it.", m_wrapStyle); GUILayout.EndVertical(); DropAreaGUI(); bool originalGUIState = GUI.enabled; if (!m_scanner.m_objectScanned) { GUI.enabled = false; } //DrawDefaultInspector(); GUILayout.BeginVertical("Setup", m_boxStyle); GUILayout.Space(20); m_editorUtils.Heading("GlobalSettings"); m_scanner.m_previewMaterial = (Material)m_editorUtils.ObjectField("PreviewMaterial", m_scanner.m_previewMaterial, typeof(Material), false, helpEnabled); EditorGUILayout.BeginHorizontal(); m_scanner.m_exportFolder = m_editorUtils.TextField("ExportPath", m_scanner.m_exportFolder); if (m_editorUtils.Button("ExportDirectoryOpen", GUILayout.Width(80))) { string path = EditorUtility.SaveFolderPanel(m_editorUtils.GetTextValue("ExportDirectoryWindowTitle"), GaiaDirectories.GetUserStampDirectory(), GaiaDirectories.SCANNER_EXPORT_DIRECTORY.Replace("/", "")); if (path.Contains(Application.dataPath)) { m_scanner.m_exportFolder = GaiaDirectories.GetPathStartingAtAssetsFolder(path); } else { EditorUtility.DisplayDialog("Path outside the Assets folder", "The selected path needs to be inside the Assets folder of the project. Please select an appropiate path.", "OK"); m_scanner.m_exportFolder = GaiaDirectories.GetScannerExportDirectory(); } } EditorGUILayout.EndHorizontal(); m_editorUtils.InlineHelp("ExportPath", helpEnabled); m_scanner.m_exportFileName = m_editorUtils.TextField("ExportFilename", m_scanner.m_exportFileName, helpEnabled); float oldBaseLevel = m_scanner.m_baseLevel; m_scanner.m_baseLevel = m_editorUtils.Slider("BaseLevel", m_scanner.m_baseLevel, 0f, 1f, helpEnabled); if (oldBaseLevel != m_scanner.m_baseLevel) { SceneView.lastActiveSceneView.Repaint(); } EditorGUILayout.Space(10f); m_editorUtils.Heading("ObjectTypeSettings"); if (m_scanner.m_scannerObjectType == ScannerObjectType.Mesh) { m_scanner.m_scanResolution = m_editorUtils.Slider("ScanResolution", m_scanner.m_scanResolution, 0.0001f, 1f, helpEnabled); if (m_scanner.m_lastScanResolution != m_scanner.m_scanResolution) { if (m_editorUtils.Button("RefreshScan")) { m_scanner.LoadGameObject(m_scanner.m_lastScannedMesh); } } } if (m_scanner.m_scannerObjectType == ScannerObjectType.Raw) { //Drop Options section GUILayout.BeginHorizontal(); { EditorGUILayout.PrefixLabel(BYTE_ORDER_LABEL); EditorGUI.BeginChangeCheck(); { m_rawByteOrder = (GaiaConstants.RawByteOrder)GUILayout.Toolbar((int)m_rawByteOrder, new string[] { "IBM PC", "Macintosh" }); } if (EditorGUI.EndChangeCheck()) { ReloadRawFile(); } } GUILayout.EndHorizontal(); m_editorUtils.InlineHelp("RawFileByteOrder", helpEnabled); EditorGUI.BeginChangeCheck(); { m_rawBitDepth = (GaiaConstants.RawBitDepth)EditorGUILayout.Popup(BIT_DEPTH_LABEL, (int)m_rawBitDepth, BIT_DEPTHS_LABELS); m_editorUtils.InlineHelp("RawFileBitDepth", helpEnabled); } if (EditorGUI.EndChangeCheck()) { ReloadRawFile(); } GUILayout.BeginVertical(); if (m_showRawInfo) { EditorGUILayout.HelpBox("Assumed " + (m_rawBitDepth == GaiaConstants.RawBitDepth.Sixteen ? "16-bit" : "8-bit") + " RAW " + m_assumedRawRes + " x " + m_assumedRawRes, MessageType.Info); } if (m_showBitDepthWarning) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("8BitWarning"), MessageType.Warning); } GUILayout.EndVertical(); } EditorGUILayout.Space(10f); m_editorUtils.Heading("ExportSettings"); //m_scanner.m_textureExportResolution = (GaiaConstants.GaiaProWaterReflectionsQuality) EditorGUILayout.EnumPopup(new GUIContent("Export Resolution", "Sets the export resolution of the texture generated"), m_scanner.m_textureExportResolution); m_scanner.m_normalize = m_editorUtils.Toggle("Normalize", m_scanner.m_normalize, helpEnabled); m_scanner.m_exportTextureAlso = m_editorUtils.Toggle("ExportPNG", m_scanner.m_exportTextureAlso, helpEnabled); //m_scanner.m_exportBytesData = m_editorUtils.Toggle("ExportBytesData", m_scanner.m_exportBytesData, helpEnabled); GUILayout.EndVertical(); //Terraform section GUILayout.BeginVertical("Scanner Controller", m_boxStyle); GUILayout.Space(20); if (!string.IsNullOrEmpty(m_infoMessage)) { EditorGUILayout.HelpBox(m_infoMessage, MessageType.Info); } if (m_scanner.m_scanMap == null) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoScanDataInfo"), MessageType.Info); GUI.enabled = false; } GUILayout.BeginHorizontal(); Color normalBGColor = GUI.backgroundColor; if (m_settings == null) { m_settings = GaiaUtils.GetGaiaSettings(); } GUI.backgroundColor = m_settings.GetActionButtonColor(); if (m_editorUtils.Button("SaveScan")) { string path = m_scanner.SaveScan(); AssetDatabase.Refresh(); path += ".exr"; Object exportedTexture = AssetDatabase.LoadAssetAtPath(path, typeof(Object)); if (exportedTexture != null) { m_infoMessage = "Scan exported to: " + path; Debug.Log(m_infoMessage); EditorGUIUtility.PingObject(exportedTexture); } } GUI.backgroundColor = normalBGColor; GUI.enabled = true; if (m_editorUtils.Button("Clear")) { m_scanner.Clear(); } GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.EndVertical(); GUILayout.Space(5f); m_showRawInfo = m_assumedRawRes > 0; m_showBitDepthWarning = m_rawBitDepth == GaiaConstants.RawBitDepth.Eight; GUI.enabled = originalGUIState; }
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(); }
/// <summary> Panel to show "Clip" options of Sequence </summary> /// <param name="inlineHelp">Should help be displayed?</param> public void ClipsPanel(bool inlineHelp) { ++EditorGUI.indentLevel; EditorGUI.BeginChangeCheck(); Rect clipsRect; if (m_clipsExpanded) { clipsRect = EditorGUILayout.GetControlRect(true, m_clipsReorderable.GetHeight()); m_clipsReorderable.DoList(clipsRect); } else { int oldIndent = EditorGUI.indentLevel; EditorGUI.indentLevel = 1; m_clipsExpanded = EditorGUILayout.Foldout(m_clipsExpanded, PropertyCount("mClips", m_clipData), true); clipsRect = GUILayoutUtility.GetLastRect(); EditorGUI.indentLevel = oldIndent; } if (Event.current.type == EventType.DragUpdated) { bool isValid = false; for (int i = 0; i < DragAndDrop.objectReferences.Length; ++i) { if (DragAndDrop.objectReferences[i] is AudioClip) { isValid = true; break; } } if (isValid) { DragAndDrop.visualMode = DragAndDropVisualMode.Link; } else { DragAndDrop.visualMode = DragAndDropVisualMode.Rejected; } } else if (Event.current.type == EventType.DragPerform) { for (int i = 0; i < DragAndDrop.objectReferences.Length; ++i) { if (!(DragAndDrop.objectReferences[i] is AudioClip)) { continue; } int idx = m_clipData.arraySize; m_clipData.InsertArrayElementAtIndex(idx); SerializedProperty clipData = m_clipData.GetArrayElementAtIndex(idx); clipData.FindPropertyRelative("m_volume").floatValue = 1f; clipData.FindPropertyRelative("m_clip").objectReferenceValue = DragAndDrop.objectReferences[i]; } Event.current.Use(); } m_editorUtils.InlineHelp("mClips", inlineHelp); //PropertyCountField("mClips", true, m_clips, ((Sequence)target).m_clips.Length, inlineHelp); //int badClipCount = 0; //for (int x = 0; x < m_clipData.arraySize; ++x) //{ // AudioClip clip = m_clipData.GetArrayElementAtIndex(x).FindPropertyRelative("m_clip").objectReferenceValue as AudioClip; // if (clip != null) // { // if (clip.loadType != AudioClipLoadType.DecompressOnLoad) // { // ++badClipCount; // } // } //} //if (badClipCount > 0) //{ // EditorGUILayout.HelpBox(m_editorUtils.GetContent("InvalidClipMessage").text, MessageType.Warning, true); // if (m_editorUtils.ButtonRight("InvalidClipButton")) // { // GUIContent progressBarContent = m_editorUtils.GetContent("InvalidClipPopup"); // for (int x = 0; x < m_clipData.arraySize; ++x) // { // AudioClip clip = m_clipData.GetArrayElementAtIndex(x).FindPropertyRelative("m_clip").objectReferenceValue as AudioClip; // EditorUtility.DisplayProgressBar(progressBarContent.text, progressBarContent.tooltip + clip.name, x / (float)badClipCount); // if (clip != null) // { // if (clip.loadType != AudioClipLoadType.DecompressOnLoad) // { // AudioImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(clip)) as AudioImporter; // AudioImporterSampleSettings sampleSettings = importer.defaultSampleSettings; // sampleSettings.loadType = AudioClipLoadType.DecompressOnLoad; // importer.defaultSampleSettings = sampleSettings; // if (importer.ContainsSampleSettingsOverride("Standalone")) // { // sampleSettings = importer.GetOverrideSampleSettings("Standalone"); // sampleSettings.loadType = AudioClipLoadType.DecompressOnLoad; // importer.SetOverrideSampleSettings("Standalone", sampleSettings); // } // importer.SaveAndReimport(); // } // } // } // EditorUtility.ClearProgressBar(); // } //} //m_editorUtils.PropertyField("mTrackFadeTime", m_trackFadeTime, inlineHelp); //if (m_trackFadeTime.floatValue < 0f) // m_trackFadeTime.floatValue = 0f; //m_editorUtils.PropertyField("mVolume", m_volume, inlineHelp); //m_editorUtils.PropertyField("mVolumeFadeTime", m_volumeFadeTime, inlineHelp); //if (m_volumeFadeTime.floatValue < 0f) // m_volumeFadeTime.floatValue = 0f; ////EditorGUI.BeginDisabledGroup(syncGroup.target && ((SyncType)System.Enum.GetValues(typeof(SyncType)).GetValue(m_syncType.enumValueIndex) & SyncType.FIT) > 0); ////{ //// m_editorUtils.PropertyField("mPlaybackSpeed", m_playbackSpeed, inlineHelp); //// if (m_playbackSpeed.floatValue < 0f) //// m_playbackSpeed.floatValue = 0f; ////} ////EditorGUI.EndDisabledGroup(); //EditorGUI.BeginDisabledGroup(syncGroup.target); //{ // m_editorUtils.PropertyField("mPlaybackSpeedFadeTime", m_playbackSpeedFadeTime, inlineHelp); // if (m_playbackSpeedFadeTime.floatValue < 0f) // m_playbackSpeedFadeTime.floatValue = 0f; // m_editorUtils.PropertyField("mCrossFade", m_crossFade, inlineHelp); // if (m_crossFade.floatValue < 0f) // m_crossFade.floatValue = 0f; //} //EditorGUI.EndDisabledGroup(); --EditorGUI.indentLevel; }
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); } }
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; } } }
private void DrawUserFiles(bool helpEnabled) { m_userFiles.m_autoAddNewFiles = m_editorUtils.Toggle("AutoAddNewFiles", m_userFiles.m_autoAddNewFiles, helpEnabled); m_userFiles.m_updateFilesWithGaiaUpdate = m_editorUtils.Toggle("UpdateWithGaia", m_userFiles.m_updateFilesWithGaiaUpdate, helpEnabled); GUILayout.Space(10); if (m_editorUtils.Button("AddDefaults")) { if (EditorUtility.DisplayDialog("Add Gaia Default Biomes?", "This will add the default Biomes & Spawners of Gaia back to the lists in case they are missing. Continue?", "Add Defaults", "Cancel")) { GaiaUtils.ResetBiomePresets(true); } } GUILayout.Space(10); m_editorUtils.Heading("BiomePresetHeading"); m_editorUtils.InlineHelp("BiomePresetHeading", helpEnabled); float deleteButtonWidth = 50; for (int i = 0; i < m_userFiles.m_gaiaManagerBiomePresets.Count; i++) { GUILayout.BeginHorizontal(); { m_userFiles.m_gaiaManagerBiomePresets[i] = (BiomePreset)EditorGUILayout.ObjectField(m_userFiles.m_gaiaManagerBiomePresets[i], typeof(BiomePreset), false); if (m_editorUtils.Button("DeleteBiomePreset", GUILayout.Width(deleteButtonWidth))) { m_userFiles.m_gaiaManagerBiomePresets.RemoveAt(i); } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); { GUILayout.Space(EditorGUIUtility.labelWidth); if (m_editorUtils.Button("AddBiomePreset")) { m_userFiles.m_gaiaManagerBiomePresets.Add(null); } } GUILayout.EndHorizontal(); GUILayout.Space(10); m_editorUtils.Heading("SpawnerSettingsHeading"); m_editorUtils.InlineHelp("SpawnerSettingsHeading", helpEnabled); for (int i = 0; i < m_userFiles.m_gaiaManagerSpawnerSettings.Count; i++) { GUILayout.BeginHorizontal(); { m_userFiles.m_gaiaManagerSpawnerSettings[i] = (SpawnerSettings)EditorGUILayout.ObjectField(m_userFiles.m_gaiaManagerSpawnerSettings[i], typeof(SpawnerSettings), false); if (m_editorUtils.Button("DeleteSpawnerSettings", GUILayout.Width(deleteButtonWidth))) { m_userFiles.m_gaiaManagerSpawnerSettings.RemoveAt(i); } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); { GUILayout.Space(EditorGUIUtility.labelWidth); if (m_editorUtils.Button("AddSpawnerSettings")) { m_userFiles.m_gaiaManagerSpawnerSettings.Add(null); } } GUILayout.EndHorizontal(); GUILayout.Space(10); m_editorUtils.Heading("ExportTerrainSettingsHeading"); m_editorUtils.InlineHelp("ExportTerrainSettingsHeading", helpEnabled); for (int i = 0; i < m_userFiles.m_exportTerrainSettings.Count; i++) { GUILayout.BeginHorizontal(); { m_userFiles.m_exportTerrainSettings[i] = (ExportTerrainSettings)EditorGUILayout.ObjectField(m_userFiles.m_exportTerrainSettings[i], typeof(ExportTerrainSettings), false); if (m_editorUtils.Button("DeleteExportTerrainSettings", GUILayout.Width(deleteButtonWidth))) { m_userFiles.m_exportTerrainSettings.RemoveAt(i); } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); { GUILayout.Space(EditorGUIUtility.labelWidth); if (m_editorUtils.Button("AddExportTerrainSettings")) { m_userFiles.m_exportTerrainSettings.Add(null); } } GUILayout.EndHorizontal(); }
private void SimpleLayerCulling(bool helpEnabled) { EditorGUI.BeginChangeCheck(); m_simpleCameraLayerCulling.m_applyToGameCamera = m_editorUtils.Toggle("ApplyToGameCamera", m_simpleCameraLayerCulling.m_applyToGameCamera); m_simpleCameraLayerCulling.m_applyToSceneCamera = m_editorUtils.Toggle("ApplyToSceneCamera", m_simpleCameraLayerCulling.m_applyToSceneCamera); if (m_simpleCameraLayerCulling.m_profile != null) { EditorGUILayout.Space(); m_editorUtils.LabelField("ObjectCullingSettings", EditorStyles.boldLabel); EditorGUI.indentLevel++; m_editorUtils.InlineHelp("ObjectCullingSettings", helpEnabled); for (int i = 0; i < m_simpleCameraLayerCulling.m_profile.m_layerDistances.Length; i++) { string layerName = LayerMask.LayerToName(i); if (!string.IsNullOrEmpty(layerName)) { m_simpleCameraLayerCulling.m_profile.m_layerDistances[i] = EditorGUILayout.FloatField(string.Format("[{0}] {1}", i, layerName), m_simpleCameraLayerCulling.m_profile.m_layerDistances[i]); } } EditorGUI.indentLevel--; if (m_editorUtils.Button("RevertCullingToDefaults")) { GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings(); m_simpleCameraLayerCulling.m_profile.UpdateCulling(gaiaSettings); EditorUtility.SetDirty(m_simpleCameraLayerCulling.m_profile); } EditorGUILayout.Space(); m_editorUtils.LabelField("ShadowCullingSettings", EditorStyles.boldLabel); EditorGUI.indentLevel++; m_editorUtils.InlineHelp("ShadowCullingSettings", helpEnabled); for (int i = 0; i < m_simpleCameraLayerCulling.m_profile.m_shadowLayerDistances.Length; i++) { string layerName = LayerMask.LayerToName(i); if (!string.IsNullOrEmpty(layerName)) { m_simpleCameraLayerCulling.m_profile.m_shadowLayerDistances[i] = EditorGUILayout.FloatField(string.Format("[{0}] {1}", i, layerName), m_simpleCameraLayerCulling.m_profile.m_shadowLayerDistances[i]); } } EditorGUI.indentLevel--; if (m_editorUtils.Button("RevertShadowToDefaults")) { m_simpleCameraLayerCulling.m_profile.UpdateShadow(); EditorUtility.SetDirty(m_simpleCameraLayerCulling.m_profile); } EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(m_simpleCameraLayerCulling); ApplyToSceneCamera(); m_simpleCameraLayerCulling.ApplyToGameCamera(); m_simpleCameraLayerCulling.ResetDirectionalLight(); SceneView.RepaintAll(); } }
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); }