예제 #1
0
        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();
            }
        }