private void ShowGICache() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(PreferencesWindow.Styles.maxCacheSize, EditorStyles.popup); this.m_GICacheSettings.m_MaximumSize = EditorGUILayout.IntSlider(this.m_GICacheSettings.m_MaximumSize, 5, 100, new GUILayoutOption[0]); this.WritePreferences(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (Lightmapping.isRunning) { GUIContent gUIContent = EditorGUIUtility.TextContent(PreferencesWindow.Styles.cantChangeCacheSettings.text); EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true); } GUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(Lightmapping.isRunning); this.m_GICacheSettings.m_EnableCustomPath = EditorGUILayout.Toggle(PreferencesWindow.Styles.customCacheLocation, this.m_GICacheSettings.m_EnableCustomPath, new GUILayoutOption[0]); if (this.m_GICacheSettings.m_EnableCustomPath) { GUIStyle popup = EditorStyles.popup; GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(PreferencesWindow.Styles.cacheFolderLocation, popup); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, popup); GUIContent content = (!string.IsNullOrEmpty(this.m_GICacheSettings.m_CachePath)) ? new GUIContent(this.m_GICacheSettings.m_CachePath) : PreferencesWindow.Styles.browse; if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Native, popup)) { string cachePath = this.m_GICacheSettings.m_CachePath; string text = EditorUtility.OpenFolderPanel(PreferencesWindow.Styles.browseGICacheLocation.text, cachePath, string.Empty); if (!string.IsNullOrEmpty(text)) { this.m_GICacheSettings.m_CachePath = text; this.WritePreferences(); } } GUILayout.EndHorizontal(); } else { this.m_GICacheSettings.m_CachePath = string.Empty; } this.m_GICacheSettings.m_CompressionLevel = ((!EditorGUILayout.Toggle(PreferencesWindow.Styles.cacheCompression, this.m_GICacheSettings.m_CompressionLevel == 1, new GUILayoutOption[0])) ? 0 : 1); if (GUILayout.Button(PreferencesWindow.Styles.cleanCache, new GUILayoutOption[] { GUILayout.Width(120f) })) { Lightmapping.Clear(); Lightmapping.ClearDiskCache(); } if (Lightmapping.diskCacheSize >= 0L) { GUILayout.Label(PreferencesWindow.Styles.cacheSizeIs.text + " " + EditorUtility.FormatBytes(Lightmapping.diskCacheSize), new GUILayoutOption[0]); } else { GUILayout.Label(PreferencesWindow.Styles.cacheSizeIs.text + " is being calculated...", new GUILayoutOption[0]); } GUILayout.Label(PreferencesWindow.Styles.cacheFolderLocation.text + ":", new GUILayoutOption[0]); GUILayout.Label(Lightmapping.diskCachePath, PreferencesWindow.constants.cacheFolderLocation, new GUILayoutOption[0]); EditorGUI.EndDisabledGroup(); }
private void DeveloperBuildEnlightenSettings(SerializedObject so) { if (!Unsupported.IsDeveloperBuild()) { return; } this.m_ShowDevOptions = EditorGUILayout.Foldout(this.m_ShowDevOptions, "Debug [internal]"); if (this.m_ShowDevOptions) { SerializedProperty property = so.FindProperty("m_GISettings.m_BounceScale"); SerializedProperty property2 = so.FindProperty("m_GISettings.m_TemporalCoherenceThreshold"); EditorGUI.indentLevel++; Lightmapping.concurrentJobsType = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(LightingWindow.styles.ConcurrentJobs, (int)Lightmapping.concurrentJobsType, this.kConcurrentJobsTypeStrings, this.kConcurrentJobsTypeValues, new GUILayoutOption[0]); Lightmapping.enlightenForceUpdates = EditorGUILayout.Toggle(LightingWindow.styles.ForceUpdates, Lightmapping.enlightenForceUpdates, new GUILayoutOption[0]); Lightmapping.enlightenForceWhiteAlbedo = EditorGUILayout.Toggle(LightingWindow.styles.ForceWhiteAlbedo, Lightmapping.enlightenForceWhiteAlbedo, new GUILayoutOption[0]); Lightmapping.filterMode = (FilterMode)EditorGUILayout.EnumPopup(EditorGUIUtility.TempContent("Filter Mode"), Lightmapping.filterMode, new GUILayoutOption[0]); EditorGUILayout.Slider(property, 0f, 10f, LightingWindow.styles.BounceScale, new GUILayoutOption[0]); EditorGUILayout.Slider(property2, 0f, 1f, LightingWindow.styles.UpdateThreshold, new GUILayoutOption[0]); if (GUILayout.Button("Clear disk cache", new GUILayoutOption[] { GUILayout.Width(this.kButtonWidth) })) { Lightmapping.Clear(); Lightmapping.ClearDiskCache(); } if (GUILayout.Button("Print state to console", new GUILayoutOption[] { GUILayout.Width(this.kButtonWidth) })) { Lightmapping.PrintStateToConsole(); } if (GUILayout.Button("Reset albedo/emissive", new GUILayoutOption[] { GUILayout.Width(this.kButtonWidth) })) { GIDebugVisualisation.ResetRuntimeInputTextures(); } if (GUILayout.Button("Reset environment", new GUILayoutOption[] { GUILayout.Width(this.kButtonWidth) })) { DynamicGI.UpdateEnvironment(); } EditorGUI.indentLevel--; } }
public void DeveloperBuildSettingsGUI() { if (Unsupported.IsDeveloperBuild()) { Lightmapping.concurrentJobsType = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(LightingWindowBakeSettings.Styles.ConcurrentJobs, (int)Lightmapping.concurrentJobsType, LightingWindowBakeSettings.Styles.ConcurrentJobsTypeStrings, LightingWindowBakeSettings.Styles.ConcurrentJobsTypeValues, new GUILayoutOption[0]); Lightmapping.enlightenForceUpdates = EditorGUILayout.Toggle(LightingWindowBakeSettings.Styles.ForceUpdates, Lightmapping.enlightenForceUpdates, new GUILayoutOption[0]); Lightmapping.enlightenForceWhiteAlbedo = EditorGUILayout.Toggle(LightingWindowBakeSettings.Styles.ForceWhiteAlbedo, Lightmapping.enlightenForceWhiteAlbedo, new GUILayoutOption[0]); Lightmapping.filterMode = (FilterMode)EditorGUILayout.EnumPopup(EditorGUIUtility.TempContent("Filter Mode"), Lightmapping.filterMode, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_BounceScale, 0f, 10f, LightingWindowBakeSettings.Styles.BounceScale, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_UpdateThreshold, 0f, 1f, LightingWindowBakeSettings.Styles.UpdateThreshold, new GUILayoutOption[0]); if (GUILayout.Button("Clear disk cache", new GUILayoutOption[] { GUILayout.Width(150f) })) { Lightmapping.Clear(); Lightmapping.ClearDiskCache(); } if (GUILayout.Button("Print state to console", new GUILayoutOption[] { GUILayout.Width(150f) })) { Lightmapping.PrintStateToConsole(); } if (GUILayout.Button("Reset albedo/emissive", new GUILayoutOption[] { GUILayout.Width(150f) })) { GIDebugVisualisation.ResetRuntimeInputTextures(); } if (GUILayout.Button("Reset environment", new GUILayoutOption[] { GUILayout.Width(150f) })) { DynamicGI.UpdateEnvironment(); } } }
private void DoClear() { Lightmapping.Clear(); Analytics.Track("/LightMapper/Clear"); }
private void DoClear() { Lightmapping.ClearLightingDataAsset(); Lightmapping.Clear(); Analytics.Track("/LightMapper/Clear"); }
private void DoClear() { Lightmapping.ClearLightingDataAsset(); Lightmapping.Clear(); }
void WorkflowSettingsGUI() { m_ShowWorkflowSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowWorkflowSettings.value, Styles.workflowSettings, true); if (m_ShowWorkflowSettings.value) { EditorGUI.indentLevel++; // GPU lightmapper device selection. if (Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper == LightingSettings.Lightmapper.ProgressiveGPU) { DeviceAndPlatform[] devicesAndPlatforms = Lightmapping.GetLightmappingGpuDevices(); if (devicesAndPlatforms.Length > 0) { int[] lightmappingDeviceIndices = Enumerable.Range(0, devicesAndPlatforms.Length).ToArray(); GUIContent[] lightmappingDeviceStrings = devicesAndPlatforms.Select(x => new GUIContent(x.name)).ToArray(); int bakingDeviceAndPlatform = -1; string configDeviceAndPlatform = EditorUserSettings.GetConfigValue(m_LightmappingDeviceIndex); if (configDeviceAndPlatform != null) { bakingDeviceAndPlatform = Int32.Parse(configDeviceAndPlatform); bakingDeviceAndPlatform = Mathf.Clamp(bakingDeviceAndPlatform, 0, devicesAndPlatforms.Length - 1); // Removing a GPU and rebooting invalidates the saved value. } else { bakingDeviceAndPlatform = Lightmapping.GetLightmapBakeGPUDeviceIndex(); } Debug.Assert(bakingDeviceAndPlatform != -1); EditorGUI.BeginChangeCheck(); using (new EditorGUI.DisabledScope(devicesAndPlatforms.Length < 2)) { bakingDeviceAndPlatform = EditorGUILayout.IntPopup(Styles.progressiveGPUBakingDevice, bakingDeviceAndPlatform, lightmappingDeviceStrings, lightmappingDeviceIndices); } if (EditorGUI.EndChangeCheck()) { if (EditorUtility.DisplayDialog("Warning", Styles.progressiveGPUChangeWarning.text, "OK", "Cancel")) { EditorUserSettings.SetConfigValue(m_LightmappingDeviceIndex, bakingDeviceAndPlatform.ToString()); DeviceAndPlatform selectedDeviceAndPlatform = devicesAndPlatforms[bakingDeviceAndPlatform]; EditorApplication.CloseAndRelaunch(new string[] { "-OpenCL-PlatformAndDeviceIndices", selectedDeviceAndPlatform.platformId.ToString(), selectedDeviceAndPlatform.deviceId.ToString() }); } } } else { // To show when we are still fetching info, so that the UI doesn't pop around too much for no reason using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.IntPopup(Styles.progressiveGPUBakingDevice, 0, Styles.progressiveGPUUnknownDeviceStrings, Styles.progressiveGPUUnknownDeviceValues); } EditorGUILayout.HelpBox(Styles.progressiveGPUUnknownDeviceInfo.text, MessageType.Info); } } m_ShowProbeDebugSettings.value = EditorGUILayout.Foldout(m_ShowProbeDebugSettings.value, Styles.lightProbeVisualization, true); if (m_ShowProbeDebugSettings.value) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; LightProbeVisualization.lightProbeVisualizationMode = (LightProbeVisualization.LightProbeVisualizationMode)EditorGUILayout.EnumPopup(LightProbeVisualization.lightProbeVisualizationMode); LightProbeVisualization.showInterpolationWeights = EditorGUILayout.Toggle(Styles.displayWeights, LightProbeVisualization.showInterpolationWeights); LightProbeVisualization.showOcclusions = EditorGUILayout.Toggle(Styles.displayOcclusion, LightProbeVisualization.showOcclusions); LightProbeVisualization.highlightInvalidCells = EditorGUILayout.Toggle(Styles.highlightInvalidCells, LightProbeVisualization.highlightInvalidCells); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorApplication.SetSceneRepaintDirty(); } } if (Unsupported.IsDeveloperMode()) { Lightmapping.concurrentJobsType = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(Styles.concurrentJobs, (int)Lightmapping.concurrentJobsType, Styles.concurrentJobsTypeStrings, Styles.concurrentJobsTypeValues); if (GUILayout.Button("Clear disk cache", GUILayout.Width(Styles.buttonWidth))) { Lightmapping.Clear(); Lightmapping.ClearDiskCache(); } if (GUILayout.Button("Print state to console", GUILayout.Width(Styles.buttonWidth))) { Lightmapping.PrintStateToConsole(); } if (GUILayout.Button("Reset albedo/emissive", GUILayout.Width(Styles.buttonWidth))) { GIDebugVisualisation.ResetRuntimeInputTextures(); } if (GUILayout.Button("Reset environment", GUILayout.Width(Styles.buttonWidth))) { DynamicGI.UpdateEnvironment(); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void ShowGICache(string searchContext) { { // Show Gigabytes to the user. const int kMinSizeInGigabytes = 5; const int kMaxSizeInGigabytes = 200; // Write size in GigaBytes. m_GICacheSettings.m_MaximumSize = EditorGUILayout.IntSlider(GICacheProperties.maxCacheSize, m_GICacheSettings.m_MaximumSize, kMinSizeInGigabytes, kMaxSizeInGigabytes); WritePreferences(); } GUILayout.BeginHorizontal(); { if (Lightmapping.isRunning) { GUIContent warning = EditorGUIUtility.TextContent(GICacheProperties.cantChangeCacheSettings.text); EditorGUILayout.HelpBox(warning.text, MessageType.Warning, true); } } GUILayout.EndHorizontal(); using (new EditorGUI.DisabledScope(Lightmapping.isRunning)) { m_GICacheSettings.m_EnableCustomPath = EditorGUILayout.Toggle(GICacheProperties.customCacheLocation, m_GICacheSettings.m_EnableCustomPath); // browse for cache folder if not per project if (m_GICacheSettings.m_EnableCustomPath) { GUIStyle style = EditorStyles.miniButton; GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(GICacheProperties.cacheFolderLocation, style); Rect r = GUILayoutUtility.GetRect(GUIContent.none, style); GUIContent guiText = string.IsNullOrEmpty(m_GICacheSettings.m_CachePath) ? Styles.browse : new GUIContent(m_GICacheSettings.m_CachePath); if (EditorGUI.DropdownButton(r, guiText, FocusType.Passive, style)) { string pathToOpen = m_GICacheSettings.m_CachePath; string path = EditorUtility.OpenFolderPanel(GICacheProperties.browseGICacheLocation.text, pathToOpen, ""); if (!string.IsNullOrEmpty(path)) { m_GICacheSettings.m_CachePath = path; WritePreferences(); } } GUILayout.EndHorizontal(); } else { m_GICacheSettings.m_CachePath = ""; } // We use toggle for now, 0 means kCompressionLevelNone, 1 - kCompressionLevelFastest. m_GICacheSettings.m_CompressionLevel = EditorGUILayout.Toggle(GICacheProperties.cacheCompression, m_GICacheSettings.m_CompressionLevel == 1) ? 1 : 0; if (GUILayout.Button(GICacheProperties.cleanCache, GUILayout.Width(120))) { EditorUtility.DisplayProgressBar(GICacheProperties.cleanCache.text, GICacheProperties.pleaseWait.text, 0.0F); Lightmapping.Clear(); EditorUtility.DisplayProgressBar(GICacheProperties.cleanCache.text, GICacheProperties.pleaseWait.text, 0.5F); UnityEditor.Lightmapping.ClearDiskCache(); EditorUtility.ClearProgressBar(); } if (UnityEditor.Lightmapping.diskCacheSize >= 0) { GUILayout.Label(GICacheProperties.cacheSizeIs.text + " " + EditorUtility.FormatBytes(UnityEditor.Lightmapping.diskCacheSize)); } else { GUILayout.Label(GICacheProperties.cacheSizeIs.text + " is being calculated..."); } GUILayout.Label(GICacheProperties.cacheFolderLocation.text + ":"); GUILayout.Label(UnityEditor.Lightmapping.diskCachePath, Constants.cacheFolderLocation); } }