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 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--; }
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 LightingProfileSettingsEnabled(bool helpEnabled) { //Building up a value array of incrementing ints of the size of the lighting profile values array, this array will then match the displayed string selection in the popup int[] lightingProfileValuesIndices = Enumerable .Repeat(0, (int)((m_profile.m_lightingProfiles.Count - 1) / 1) + 1) .Select((tr, ti) => tr + (1 * ti)) .ToArray(); string[] profileNames = m_profile.m_lightingProfiles.Select(x => x.m_typeOfLighting).ToArray(); //Injecting the "None" option lightingProfileValuesIndices = GaiaUtils.AddElementToArray(lightingProfileValuesIndices, -99); profileNames = GaiaUtils.AddElementToArray(profileNames, "None"); EditorGUILayout.BeginHorizontal(); if (m_profile.m_renamingProfile) { m_profileValues.m_profileRename = m_editorUtils.TextField("NewProfileName", m_profileValues.m_profileRename); } else { m_profile.m_selectedLightingProfileValuesIndex = EditorGUILayout.IntPopup("Lighting Profile", m_profile.m_selectedLightingProfileValuesIndex, profileNames, lightingProfileValuesIndices); } #if !GAIA_PRO_PRESENT bool currentGUIState = GUI.enabled; if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { GUI.enabled = false; } #endif if (m_profile.m_selectedLightingProfileValuesIndex != -99) { m_profileValues = m_profile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex]; m_profileValues.m_ambientMode = RenderSettings.ambientMode; } if (m_profileValues.m_userCustomProfile) { if (m_profile.m_renamingProfile) { if (m_editorUtils.Button("Save", GUILayout.MaxWidth(55f))) { m_profileValues.m_typeOfLighting = m_profileValues.m_profileRename; m_profile.m_renamingProfile = false; } } else { if (m_editorUtils.Button("Rename", GUILayout.MaxWidth(55f))) { m_profile.m_renamingProfile = true; m_profileValues.m_profileRename = m_profileValues.m_typeOfLighting; } } if (m_editorUtils.Button("Remove", GUILayout.MaxWidth(30f))) { m_profile.m_renamingProfile = false; m_profile.m_lightingProfiles.RemoveAt(m_profile.m_selectedLightingProfileValuesIndex); m_profile.m_selectedLightingProfileValuesIndex--; } } if (m_editorUtils.Button("MakeCopy", GUILayout.MaxWidth(30f))) { AddNewCustomProfile(); } EditorGUILayout.EndHorizontal(); if (m_profile.m_selectedLightingProfileValuesIndex == -99) { EditorGUILayout.HelpBox("No Profile selected. Select another profile that is not 'None' to view settings to edit", MessageType.Info); } else { if (!m_profileValues.m_userCustomProfile) { m_profile.m_renamingProfile = false; EditorGUILayout.HelpBox("This is one of the default Gaia lighting profiles. To create your own please press the '+' button to create a copy from the current selected profile.", MessageType.Info); GUI.enabled = false; } if (m_profile.m_editSettings) { GUI.enabled = true; } if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition) { if (m_profile.m_enablePostProcessing) { m_editorUtils.Heading("PostProcessingSettings"); if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { #if UPPipeline m_profileValues.PostProcessProfileURP = (VolumeProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileURP, typeof(VolumeProfile), false); #endif } else { #if UNITY_POST_PROCESSING_STACK_V2 m_profileValues.PostProcessProfileBuiltIn = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileBuiltIn, typeof(PostProcessProfile), false); m_profileValues.m_directToCamera = m_editorUtils.Toggle("DirectToCamera", m_profileValues.m_directToCamera); #else EditorGUILayout.HelpBox("Post Processing is not installed. Install it from the package manager to use the post processing setup features.", MessageType.Info); #endif } GUILayout.Space(20f); } if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { //m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 90f); } if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SunSettings"); m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 360f); m_profileValues.m_sunPitch = m_editorUtils.Slider("SunPitch", m_profileValues.m_sunPitch, 0f, 360f); if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.BuiltIn) { m_profileValues.m_sunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_sunColor); m_profileValues.m_sunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_sunIntensity); } else { m_profileValues.m_lWSunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_lWSunColor); m_profileValues.m_lWSunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_lWSunIntensity); } GUILayout.Space(20f); } m_editorUtils.Heading("ShadowSettings"); m_profileValues.m_shadowCastingMode = (LightShadows)EditorGUILayout.EnumPopup("Sun Shadow Casting Mode", m_profileValues.m_shadowCastingMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_profileValues.m_shadowStrength = m_editorUtils.Slider("SunShadowStrength", m_profileValues.m_shadowStrength, 0f, 1f, helpEnabled); } m_profileValues.m_shadowDistance = m_editorUtils.Slider("ShadowDistance", m_profileValues.m_shadowDistance, 0f, 10000f, helpEnabled); m_profileValues.m_sunShadowResolution = (LightShadowResolution)EditorGUILayout.EnumPopup("Sun Shadow Resolution", m_profileValues.m_sunShadowResolution); GUILayout.Space(20f); m_editorUtils.Heading("SkyboxSettings"); #if !GAIA_PRO_PRESENT if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky && m_profileValues.m_userCustomProfile) { GUI.enabled = true; } #endif m_profileValues.m_profileType = (GaiaConstants.GaiaLightingProfileType)m_editorUtils.EnumPopup("SkyboxType", m_profileValues.m_profileType, helpEnabled); #if !GAIA_PRO_PRESENT if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { GUI.enabled = true; EditorGUILayout.HelpBox("The 'Procedural Worlds Sky' profile sky type is available in Gaia Pro only, please choose a different profile type.", MessageType.Info); GUI.enabled = false; } #endif if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.Procedural) { m_profileValues.m_sunSize = m_editorUtils.Slider("SunSize", m_profileValues.m_sunSize, 0f, 1f); m_profileValues.m_sunConvergence = m_editorUtils.Slider("SunConvergence", m_profileValues.m_sunConvergence, 0f, 10f); m_profileValues.m_atmosphereThickness = m_editorUtils.Slider("AtmosphereThickness", m_profileValues.m_atmosphereThickness, 0f, 5f); m_profileValues.m_skyboxExposure = m_editorUtils.Slider("SkyboxExposure", m_profileValues.m_skyboxExposure, 0f, 8f); m_profileValues.m_skyboxTint = m_editorUtils.ColorField("SkyboxTint", m_profileValues.m_skyboxTint); m_profileValues.m_groundColor = m_editorUtils.ColorField("GroundColor", m_profileValues.m_groundColor); } else if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.HDRI) { m_profileValues.m_skyboxHDRI = (Cubemap)m_editorUtils.ObjectField("HDRISkybox", m_profileValues.m_skyboxHDRI, typeof(Cubemap), false, GUILayout.Height(16f)); m_profileValues.m_skyboxTint = m_editorUtils.ColorField("SkyboxTint", m_profileValues.m_skyboxTint); m_profileValues.m_skyboxExposure = m_editorUtils.Slider("SkyboxExposure", m_profileValues.m_skyboxExposure, 0f, 8f); } GUILayout.Space(20f); //m_profileValues.m_ambientMode = (AmbientMode)EditorGUILayout.EnumPopup("Ambient Mode", m_profileValues.m_ambientMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("AmbientSettings"); m_profileValues.m_ambientMode = (AmbientMode)m_editorUtils.EnumPopup("AmbientMode", m_profileValues.m_ambientMode, helpEnabled); if (RenderSettings.ambientMode == AmbientMode.Skybox) { m_profileValues.m_ambientIntensity = m_editorUtils.Slider("AmbientIntensity", m_profileValues.m_ambientIntensity, 0f, 10f); } else if (RenderSettings.ambientMode == AmbientMode.Flat) { m_profileValues.m_skyAmbient = m_editorUtils.ColorField("SkyAmbient", m_profileValues.m_skyAmbient); } else if (RenderSettings.ambientMode == AmbientMode.Trilight) { m_profileValues.m_skyAmbient = m_editorUtils.ColorField("SkyAmbient", m_profileValues.m_skyAmbient); m_profileValues.m_equatorAmbient = m_editorUtils.ColorField("EquatorAmbient", m_profileValues.m_equatorAmbient); m_profileValues.m_groundAmbient = m_editorUtils.ColorField("GroundAmbient", m_profileValues.m_groundAmbient); } GUILayout.Space(20f); } if (m_profile.m_enableFog) { m_editorUtils.Heading("FogSettings"); m_profileValues.m_fogMode = (FogMode)EditorGUILayout.EnumPopup("Fog Mode", m_profileValues.m_fogMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { if (m_profileValues.m_fogMode == FogMode.Linear) { m_profileValues.m_fogColor = m_editorUtils.ColorField("FogColor", m_profileValues.m_fogColor); m_profileValues.m_fogStartDistance = m_editorUtils.FloatField("FogStartDistance", m_profileValues.m_fogStartDistance); m_profileValues.m_fogEndDistance = m_editorUtils.FloatField("FogEndDistance", m_profileValues.m_fogEndDistance); } else { m_profileValues.m_fogColor = m_editorUtils.ColorField("FogColor", m_profileValues.m_fogColor); m_profileValues.m_fogDensity = m_editorUtils.Slider("FogDensity", m_profileValues.m_fogDensity, 0f, 1f); } } } } else { m_profileValues.m_profileType = (GaiaConstants.GaiaLightingProfileType)m_editorUtils.EnumPopup("SkyboxType", m_profileValues.m_profileType, helpEnabled); if (m_profile.m_enablePostProcessing) { m_editorUtils.Heading("PostProcessingSettings"); EditorGUI.indentLevel++; #if HDPipeline m_profileValues.PostProcessProfileHDRP = (VolumeProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileHDRP, typeof(VolumeProfile), false); #endif EditorGUI.indentLevel--; GUILayout.Space(20f); } #if GAIA_PRO_PRESENT if (m_profile.m_enableAmbientAudio) { m_editorUtils.Heading("AmbientAudioSettings"); EditorGUI.indentLevel++; m_profileValues.m_ambientVolume = m_editorUtils.Slider("AmbientAudioVolume", m_profileValues.m_ambientVolume, 0f, 1f, helpEnabled); m_profileValues.m_ambientAudio = (AudioClip)m_editorUtils.ObjectField("AmbientAudioClip", m_profileValues.m_ambientAudio, typeof(AudioClip), false, helpEnabled); EditorGUI.indentLevel--; GUILayout.Space(20f); } #endif if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SunSettings"); EditorGUI.indentLevel++; m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 360f); m_profileValues.m_sunPitch = m_editorUtils.Slider("SunPitch", m_profileValues.m_sunPitch, 0f, 360f); m_profileValues.m_hDSunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_hDSunColor); m_profileValues.m_hDSunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_hDSunIntensity); EditorGUI.indentLevel--; GUILayout.Space(20f); } m_editorUtils.Heading("ShadowSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDShadowDistance = m_editorUtils.Slider("ShadowDistance", m_profileValues.m_hDShadowDistance, 0f, 10000f); m_profileValues.m_hDShadowResolution = (GaiaConstants.HDShadowResolution)m_editorUtils.EnumPopup("HDShadowResolution", m_profileValues.m_hDShadowResolution); m_profileValues.m_hDContactShadows = m_editorUtils.Toggle("ContactShadows", m_profileValues.m_hDContactShadows); if (m_profileValues.m_hDContactShadows) { EditorGUI.indentLevel++; m_profileValues.m_hDContactShadowsDistance = m_editorUtils.Slider("ContactShadowsDistance", m_profileValues.m_hDContactShadowsDistance, 1f, 2000f); m_profileValues.m_hDContactShadowQuality = (GaiaConstants.ContactShadowsQuality)m_editorUtils.EnumPopup("ContactShadowsQuality", m_profileValues.m_hDContactShadowQuality); if (m_profileValues.m_hDContactShadowQuality == GaiaConstants.ContactShadowsQuality.Custom) { EditorGUI.indentLevel++; m_profileValues.m_hDContactShadowCustomQuality = m_editorUtils.IntSlider("ContactShadowsSampleCount", m_profileValues.m_hDContactShadowCustomQuality, 4, 64); EditorGUI.indentLevel--; } m_profileValues.m_hDContactShadowOpacity = m_editorUtils.Slider("ContactShadowOpacity", m_profileValues.m_hDContactShadowOpacity, 0f, 1f); EditorGUI.indentLevel--; } m_profileValues.m_hDMicroShadows = m_editorUtils.Toggle("MicroShadows", m_profileValues.m_hDMicroShadows); if (m_profileValues.m_hDMicroShadows) { EditorGUI.indentLevel++; m_profileValues.m_hDMicroShadowOpacity = m_editorUtils.Slider("MicroShadowOpacity", m_profileValues.m_hDMicroShadowOpacity, 0f, 1f); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUILayout.Space(20f); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SkyboxSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDSkyType = (GaiaConstants.HDSkyType)EditorGUILayout.EnumPopup("Sky Type", m_profileValues.m_hDSkyType); if (m_profileValues.m_hDSkyType == GaiaConstants.HDSkyType.HDRI) { m_profileValues.m_hDHDRISkybox = (Cubemap)m_editorUtils.ObjectField("HDRISkybox", m_profileValues.m_hDHDRISkybox, typeof(Cubemap), false, GUILayout.Height(16f)); m_profileValues.m_hDHDRIExposure = m_editorUtils.FloatField("SkyboxExposure", m_profileValues.m_hDHDRIExposure); m_profileValues.m_hDHDRIMultiplier = m_editorUtils.FloatField("SkyboxMultiplier", m_profileValues.m_hDHDRIMultiplier); } else if (m_profileValues.m_hDSkyType == GaiaConstants.HDSkyType.Procedural) { EditorGUILayout.Space(); m_editorUtils.LabelField("GeometrySettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSPlanetaryRadius = m_editorUtils.FloatField("PBSPlanetaryRadius", m_profileValues.m_hDPBSPlanetaryRadius, helpEnabled); m_profileValues.m_hDPBSPlantetCenterPosition = m_editorUtils.Vector3Field("PBSPlanetCenterPosition", m_profileValues.m_hDPBSPlantetCenterPosition, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("AirSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSAirOpacity = m_editorUtils.ColorField("PBSAirOpacity", m_profileValues.m_hDPBSAirOpacity, helpEnabled); m_profileValues.m_hDPBSAirAlbedo = m_editorUtils.ColorField("PBSAirAlbedo", m_profileValues.m_hDPBSAirAlbedo, helpEnabled); m_profileValues.m_hDPBSAirMaximumAltitude = m_editorUtils.FloatField("PBSAirMaximumAltitude", m_profileValues.m_hDPBSAirMaximumAltitude, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("AerosolsSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSAerosolDensity = m_editorUtils.Slider("PBSAerosolOpacity", m_profileValues.m_hDPBSAerosolDensity, -1f, 1f, helpEnabled); m_profileValues.m_hDPBSAerosolAlbedo = m_editorUtils.ColorField("PBSAerosolAlbedo", m_profileValues.m_hDPBSAerosolAlbedo, helpEnabled); m_profileValues.m_hDPBSAerosolMaximumAltitude = m_editorUtils.FloatField("PBSAerosolMaximumAltitude", m_profileValues.m_hDPBSAerosolMaximumAltitude, helpEnabled); m_profileValues.m_hDPBSAerosolAnisotropy = m_editorUtils.Slider("PBSAerosolAnisotropy", m_profileValues.m_hDPBSAerosolAnisotropy, -1f, 1f, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("PlanetSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSPlanetRotation = m_editorUtils.Vector3Field("PBSPlanetRotation", m_profileValues.m_hDPBSPlanetRotation, helpEnabled); m_profileValues.m_hDPBSGroundTint = m_editorUtils.ColorField("PBSGroundColor", m_profileValues.m_hDPBSGroundTint); m_profileValues.m_hDPBSGroundAlbedoTexture = (Cubemap)m_editorUtils.ObjectField("PBSGroundAlbedoTexture", m_profileValues.m_hDPBSGroundAlbedoTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); m_profileValues.m_hDPBSGroundEmissionTexture = (Cubemap)m_editorUtils.ObjectField("PBSGroundEmissionTexture", m_profileValues.m_hDPBSGroundEmissionTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); EditorGUILayout.Space(); m_editorUtils.LabelField("SpaceSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSSpaceRotation = m_editorUtils.Vector3Field("PBSSpaceRotation", m_profileValues.m_hDPBSSpaceRotation, helpEnabled); m_profileValues.m_hDPBSSpaceEmissionTexture = (Cubemap)m_editorUtils.ObjectField("PBSSpaceEmissionTexture", m_profileValues.m_hDPBSSpaceEmissionTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); EditorGUILayout.Space(); m_editorUtils.LabelField("ArtisticOverrides", EditorStyles.boldLabel); m_profileValues.m_hDPBSColorSaturation = m_editorUtils.Slider("PBSColorSaturation", m_profileValues.m_hDPBSColorSaturation, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSAlphaSaturation = m_editorUtils.Slider("PBSAlphaSaturation", m_profileValues.m_hDPBSAlphaSaturation, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSAlphaMultiplier = m_editorUtils.Slider("PBSAlphaMultiplier", m_profileValues.m_hDPBSAlphaMultiplier, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSHorizonTint = m_editorUtils.ColorField("PBSHorizonTint", m_profileValues.m_hDPBSHorizonTint, helpEnabled); m_profileValues.m_hDPBSHorizonZenithShift = m_editorUtils.Slider("PBSHorizonZenithShift", m_profileValues.m_hDPBSHorizonZenithShift, -1f, 1f, helpEnabled); m_profileValues.m_hDPBSZenithTint = m_editorUtils.ColorField("PBSZenithTint", m_profileValues.m_hDPBSZenithTint, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("MiscellaneousSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSNumberOfBounces = m_editorUtils.IntSlider("PBSNumberOfBounces", m_profileValues.m_hDPBSNumberOfBounces, 1, 10, helpEnabled); m_profileValues.m_hDPBSIntensityMode = (GaiaConstants.HDIntensityMode)m_editorUtils.EnumPopup("PBSIntensityMode", m_profileValues.m_hDPBSIntensityMode, helpEnabled); if (m_profileValues.m_hDPBSIntensityMode == GaiaConstants.HDIntensityMode.Exposure) { m_profileValues.m_hDPBSExposure = m_editorUtils.FloatField("PBSExposure", m_profileValues.m_hDPBSExposure, helpEnabled); } else { m_profileValues.m_hDPBSMultiplier = m_editorUtils.FloatField("PBSMultiplier", m_profileValues.m_hDPBSMultiplier, helpEnabled); } m_profileValues.m_hDPBSIncludeSunInBaking = m_editorUtils.Toggle("PBSIncludeSunInBaking", m_profileValues.m_hDPBSIncludeSunInBaking, helpEnabled); } else { m_profileValues.m_hDGradientTopColor = m_editorUtils.ColorField("TopColor", m_profileValues.m_hDGradientTopColor); m_profileValues.m_hDGradientMiddleColor = m_editorUtils.ColorField("MiddleColor", m_profileValues.m_hDGradientMiddleColor); m_profileValues.m_hDGradientBottomColor = m_editorUtils.ColorField("BottomColor", m_profileValues.m_hDGradientBottomColor); m_profileValues.m_hDGradientDiffusion = m_editorUtils.FloatField("Diffusion", m_profileValues.m_hDGradientDiffusion); m_profileValues.m_hDGradientExposure = m_editorUtils.FloatField("Exposure", m_profileValues.m_hDGradientExposure); m_profileValues.m_hDGradientMultiplier = m_editorUtils.FloatField("Multiplier", m_profileValues.m_hDGradientMultiplier); } EditorGUI.indentLevel--; GUILayout.Space(20f); } m_editorUtils.Heading("AmbientSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDAmbientMode = (GaiaConstants.HDAmbientMode)EditorGUILayout.EnumPopup("Ambient Mode", m_profileValues.m_hDAmbientMode); #if !UNITY_2019_3_OR_NEWER m_profileValues.m_hDAmbientDiffuseIntensity = m_editorUtils.FloatField("DiffuseIntensity", m_profileValues.m_hDAmbientDiffuseIntensity); m_profileValues.m_hDAmbientSpecularIntensity = m_editorUtils.FloatField("SpecularIntensity", m_profileValues.m_hDAmbientSpecularIntensity); #else if (m_profileValues.m_hDAmbientMode == GaiaConstants.HDAmbientMode.Static) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("HDRP2019_3AmbientMode"), MessageType.Info); } #endif EditorGUI.indentLevel--; GUILayout.Space(20f); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("FogSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDFogType2019_3 = (GaiaConstants.HDFogType2019_3)EditorGUILayout.EnumPopup("Fog Mode", m_profileValues.m_hDFogType2019_3); if (m_profileValues.m_hDFogType2019_3 == GaiaConstants.HDFogType2019_3.None) { EditorGUILayout.HelpBox("No fog mode selected. If you want to use fog please select a different mode", MessageType.Info); } else { m_profileValues.m_hDVolumetricFogScatterColor = m_editorUtils.ColorField("ScatterColor", m_profileValues.m_hDVolumetricFogScatterColor); m_profileValues.m_hDVolumetricFogDistance = m_editorUtils.FloatField("FogDistance", m_profileValues.m_hDVolumetricFogDistance); if (m_profileValues.m_hDVolumetricFogDistance < 0f) { m_profileValues.m_hDVolumetricFogDistance = 0f; } m_profileValues.m_hDVolumetricFogBaseHeight = m_editorUtils.FloatField("FogBaseHeight", m_profileValues.m_hDVolumetricFogBaseHeight); if (m_profileValues.m_hDVolumetricFogBaseHeight < 0f) { m_profileValues.m_hDVolumetricFogBaseHeight = 0f; } m_profileValues.m_hDVolumetricFogMeanHeight = m_editorUtils.FloatField("FogMeanHeight", m_profileValues.m_hDVolumetricFogMeanHeight); if (m_profileValues.m_hDVolumetricFogMeanHeight < 0f) { m_profileValues.m_hDVolumetricFogMeanHeight = 0f; } m_profileValues.m_hDVolumetricFogAnisotropy = m_editorUtils.Slider("FogAnisotropy", m_profileValues.m_hDVolumetricFogAnisotropy, 0f, 1f); m_profileValues.m_hDVolumetricFogProbeDimmer = m_editorUtils.Slider("FogProbeDimmer", m_profileValues.m_hDVolumetricFogProbeDimmer, 0f, 1f); m_profileValues.m_hDVolumetricFogMaxDistance = m_editorUtils.FloatField("MaxFogDistance", m_profileValues.m_hDVolumetricFogMaxDistance); if (m_profileValues.m_hDVolumetricFogMaxDistance < 0f) { m_profileValues.m_hDVolumetricFogMaxDistance = 0f; } m_profileValues.m_hDVolumetricFogDepthExtent = m_editorUtils.FloatField("FogDepthExtent", m_profileValues.m_hDVolumetricFogDepthExtent); if (m_profileValues.m_hDVolumetricFogDepthExtent < 0f) { m_profileValues.m_hDVolumetricFogDepthExtent = 0f; } m_profileValues.m_hDVolumetricFogSliceDistribution = m_editorUtils.Slider("FogSliceDistribution", m_profileValues.m_hDVolumetricFogSliceDistribution, 0f, 1f); } EditorGUI.indentLevel--; } } GUI.enabled = true; } #if !GAIA_PRO_PRESENT GUI.enabled = currentGUIState; #endif }
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; }
/// <summary> /// Draws the data fields for each operation /// </summary> /// <param name="op"></param> public static void DrawOperationFields(GaiaOperation op, EditorUtils editorUtils, GaiaSessionManager sessionManager, bool helpEnabled, int currentIndex) { //shared default fields first //op.m_isActive = m_editorUtils.Toggle("Active", op.m_isActive, helpEnabled); bool currentGUIState = GUI.enabled; GUI.enabled = op.m_isActive; op.m_description = editorUtils.TextField("Description", op.m_description, helpEnabled); editorUtils.LabelField("DateTime", new GUIContent(op.m_operationDateTime), helpEnabled); EditorGUI.indentLevel++; op.m_terrainsFoldedOut = editorUtils.Foldout(op.m_terrainsFoldedOut, "AffectedTerrains", helpEnabled); if (op.m_terrainsFoldedOut) { foreach (string name in op.m_affectedTerrainNames) { EditorGUILayout.LabelField(name); } } EditorGUI.indentLevel--; //type specific fields, switch by op type to draw additional fields suitable for the op type switch (op.m_operationType) { case GaiaOperation.OperationType.CreateWorld: editorUtils.LabelField("xTiles", new GUIContent(op.WorldCreationSettings.m_xTiles.ToString()), helpEnabled); editorUtils.LabelField("zTiles", new GUIContent(op.WorldCreationSettings.m_zTiles.ToString()), helpEnabled); editorUtils.LabelField("TileSize", new GUIContent(op.WorldCreationSettings.m_tileSize.ToString()), helpEnabled); break; case GaiaOperation.OperationType.Spawn: editorUtils.LabelField("NumberOfSpawners", new GUIContent(op.SpawnOperationSettings.m_spawnerSettingsList.Count.ToString()), helpEnabled); float size = (float)Mathd.Max(op.SpawnOperationSettings.m_spawnArea.size.x, op.SpawnOperationSettings.m_spawnArea.size.z); editorUtils.LabelField("SpawnSize", new GUIContent(size.ToString()), helpEnabled); break; } GUI.enabled = currentGUIState; //Button controls EditorGUILayout.BeginHorizontal(); GUILayout.Space(20); if (editorUtils.Button("Delete")) { if (EditorUtility.DisplayDialog(editorUtils.GetTextValue("PopupDeleteTitle"), editorUtils.GetTextValue("PopupDeleteText"), editorUtils.GetTextValue("OK"), editorUtils.GetTextValue("Cancel"))) { 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); } sessionManager.RemoveOperation(currentIndex); EditorGUIUtility.ExitGUI(); } } GUI.enabled = op.m_isActive; if (editorUtils.Button("Play")) { if (EditorUtility.DisplayDialog(editorUtils.GetTextValue("PopupPlayTitle"), editorUtils.GetTextValue("PopupPlayText"), editorUtils.GetTextValue("OK"), editorUtils.GetTextValue("Cancel"))) { GaiaSessionManager.ExecuteOperation(op); //Destroy all temporary tools used while executing //not if it is a spawn operation since that is asynchronous if (op.m_operationType != GaiaOperation.OperationType.Spawn) { GaiaSessionManager.DestroyTempSessionTools(); } } } GUI.enabled = currentGUIState; //EditorGUILayout.EndHorizontal(); //EditorGUILayout.BeginHorizontal(); //GUILayout.Space(20); if (editorUtils.Button("ViewData")) { switch (op.m_operationType) { case GaiaOperation.OperationType.CreateWorld: Selection.activeObject = op.WorldCreationSettings; break; case GaiaOperation.OperationType.Stamp: Selection.activeObject = op.StamperSettings; break; case GaiaOperation.OperationType.Spawn: Selection.activeObject = op.SpawnOperationSettings; break; case GaiaOperation.OperationType.FlattenTerrain: Selection.activeObject = op.FlattenOperationSettings; break; case GaiaOperation.OperationType.StampUndo: Selection.activeObject = op.UndoRedoOperationSettings; break; case GaiaOperation.OperationType.StampRedo: Selection.activeObject = op.UndoRedoOperationSettings; break; case GaiaOperation.OperationType.ClearSpawns: Selection.activeObject = op.ClearOperationSettings; break; case GaiaOperation.OperationType.RemoveNonBiomeResources: Selection.activeObject = op.RemoveNonBiomeResourcesSettings; break; case GaiaOperation.OperationType.MaskMapExport: Selection.activeObject = op.ExportMaskMapOperationSettings; break; } EditorGUIUtility.PingObject(Selection.activeObject); } switch (op.m_operationType) { case GaiaOperation.OperationType.Stamp: if (editorUtils.Button("PreviewInStamper")) { Stamper stamper = GaiaSessionManager.GetOrCreateSessionStamper(); stamper.LoadSettings(op.StamperSettings); #if GAIA_PRO_PRESENT if (GaiaUtils.HasDynamicLoadedTerrains()) { //We got placeholders, activate terrain loading stamper.m_loadTerrainMode = LoadMode.EditorSelected; } #endif Selection.activeObject = stamper.gameObject; } break; case GaiaOperation.OperationType.Spawn: if (editorUtils.Button("PreviewInSpawner")) { BiomeController bmc = null; List <Spawner> spawnerList = null; Selection.activeObject = GaiaSessionManager.GetOrCreateSessionSpawners(op.SpawnOperationSettings, ref bmc, ref spawnerList); } break; case GaiaOperation.OperationType.MaskMapExport: #if GAIA_PRO_PRESENT if (editorUtils.Button("PreviewInExport")) { MaskMapExport mme = null; Selection.activeObject = GaiaSessionManager.GetOrCreateMaskMapExporter(op.ExportMaskMapOperationSettings.m_maskMapExportSettings, ref mme); } #endif break; } EditorGUILayout.EndHorizontal(); }