LightmapParametersGUI() public static method

public static LightmapParametersGUI ( UnityEditor.SerializedProperty prop, GUIContent content, bool advancedParameters ) : bool
prop UnityEditor.SerializedProperty
content UnityEngine.GUIContent
advancedParameters bool
return bool
        private void GeneralSettingsGUI(SerializedObject so, SerializedProperty enableRealtimeGI, SerializedProperty enableBakedGI)
        {
            this.m_ShowGeneralSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralSettings, LightingWindow.styles.GeneralGILabel);
            if (!this.m_ShowGeneralSettings)
            {
                return;
            }
            SerializedProperty property           = so.FindProperty("m_GISettings.m_AlbedoBoost");
            SerializedProperty property2          = so.FindProperty("m_GISettings.m_IndirectOutputScale");
            SerializedProperty property3          = so.FindProperty("m_LightmapEditorSettings.m_TextureWidth");
            SerializedProperty prop               = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters");
            SerializedProperty serializedProperty = so.FindProperty("m_LightmapsMode");
            bool flag = enableBakedGI.boolValue || enableRealtimeGI.boolValue;

            EditorGUI.BeginDisabledGroup(!flag);
            EditorGUI.indentLevel++;
            EditorGUILayout.IntPopup(serializedProperty, this.kModeStrings, this.kModeValues, LightingWindow.s_Styles.DirectionalMode, new GUILayoutOption[0]);
            if (serializedProperty.intValue == 2)
            {
                EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalSpecularInSM2AndGLES2.text, MessageType.Warning);
            }
            EditorGUILayout.Slider(property2, 0f, 5f, LightingWindow.styles.IndirectOutputScale, new GUILayoutOption[0]);
            EditorGUILayout.Slider(property, 1f, 10f, LightingWindow.styles.AlbedoBoost, new GUILayoutOption[0]);
            if (LightingWindowObjectTab.LightmapParametersGUI(prop, LightingWindow.styles.DefaultLightmapParameters))
            {
                this.m_Mode = LightingWindow.Mode.ObjectSettings;
            }
            EditorGUILayout.IntPopup(property3, this.kMaxAtlasSizeStrings, this.kMaxAtlasSizeValues, LightingWindow.styles.MaxAtlasSize, new GUILayoutOption[0]);
            this.DeveloperBuildEnlightenSettings(so);
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
        }
Beispiel #2
0
        public bool EditRenderers()
        {
            GameObject[] array;
            Renderer[]   selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out array, new Type[]
            {
                typeof(MeshRenderer),
                typeof(SkinnedMeshRenderer)
            });
            if (array.Length == 0)
            {
                return(false);
            }
            EditorGUILayout.InspectorTitlebar(selectedObjectsOfType);
            SerializedObject serializedObject = new SerializedObject(array);

            EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1));
            SerializedObject serializedObject2 = new SerializedObject(selectedObjectsOfType);
            float            num = LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]);

            for (int i = 1; i < selectedObjectsOfType.Length; i++)
            {
                if (!Mathf.Approximately(num, LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[i])))
                {
                    num = 1f;
                }
            }
            float lightmapScale     = this.LightmapScaleGUI(serializedObject2, num) * LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]);
            float cachedSurfaceArea = (!(selectedObjectsOfType[0] is MeshRenderer)) ? InternalMeshUtil.GetCachedSkinnedMeshSurfaceArea(selectedObjectsOfType[0] as SkinnedMeshRenderer) : InternalMeshUtil.GetCachedMeshSurfaceArea(selectedObjectsOfType[0] as MeshRenderer);

            this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
            this.RendererUVSettings(serializedObject2);
            LightingWindowObjectTab.LightmapParametersGUI(serializedObject2.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters);
            this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas);
            if (this.m_ShowBakedLM)
            {
                this.ShowAtlasGUI(serializedObject2);
            }
            this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM);
            if (this.m_ShowRealtimeLM)
            {
                this.ShowRealtimeLMGUI(serializedObject2, selectedObjectsOfType[0]);
            }
            if (LightmapEditorSettings.HasZeroAreaMesh(selectedObjectsOfType[0]))
            {
                EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning);
            }
            if (LightmapEditorSettings.HasClampedResolution(selectedObjectsOfType[0]))
            {
                EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ClampedPackingResolution.text, MessageType.Warning);
            }
            if (!LightingWindowObjectTab.HasNormals(selectedObjectsOfType[0]))
            {
                EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning);
            }
            serializedObject.ApplyModifiedProperties();
            serializedObject2.ApplyModifiedProperties();
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            return(true);
        }
Beispiel #3
0
        public bool EditTerrains()
        {
            GameObject[] array;
            Terrain[]    selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Terrain>(out array, new Type[0]);
            bool         result;

            if (array.Length == 0)
            {
                result = false;
            }
            else
            {
                EditorGUILayout.InspectorTitlebar(selectedObjectsOfType);
                SerializedObject serializedObject = new SerializedObject(array);
                using (new EditorGUI.DisabledScope(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1)))
                {
                    if (GUI.enabled)
                    {
                        this.ShowTerrainChunks(selectedObjectsOfType);
                    }
                    SerializedObject serializedObject2 = new SerializedObject(selectedObjectsOfType.ToArray <Terrain>());
                    float            lightmapScale     = this.LightmapScaleGUI(serializedObject2, 1f);
                    TerrainData      terrainData       = selectedObjectsOfType[0].terrainData;
                    float            cachedSurfaceArea = (!(terrainData != null)) ? 0f : (terrainData.size.x * terrainData.size.z);
                    this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
                    LightingWindowObjectTab.LightmapParametersGUI(serializedObject2.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters, true);
                    if (GUI.enabled && selectedObjectsOfType.Length == 1 && selectedObjectsOfType[0].terrainData != null)
                    {
                        this.ShowBakePerformanceWarning(serializedObject2, selectedObjectsOfType[0]);
                    }
                    this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas);
                    if (this.m_ShowBakedLM)
                    {
                        this.ShowAtlasGUI(serializedObject2);
                    }
                    this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM);
                    if (this.m_ShowRealtimeLM)
                    {
                        this.ShowRealtimeLMGUI(selectedObjectsOfType[0]);
                    }
                    serializedObject.ApplyModifiedProperties();
                    serializedObject2.ApplyModifiedProperties();
                }
                GUILayout.Space(10f);
                result = true;
            }
            return(result);
        }
        public bool EditTerrains()
        {
            GameObject[] gameObjects;
            Terrain[]    selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Terrain>(out gameObjects);
            if (gameObjects.Length == 0)
            {
                return(false);
            }
            EditorGUILayout.InspectorTitlebar((UnityEngine.Object[])selectedObjectsOfType);
            SerializedObject serializedObject = new SerializedObject((UnityEngine.Object[])gameObjects);

            EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1));
            if (GUI.enabled)
            {
                this.ShowTerrainChunks(selectedObjectsOfType);
            }
            SerializedObject so                = new SerializedObject((UnityEngine.Object[])((IEnumerable <Terrain>)selectedObjectsOfType).ToArray <Terrain>());
            float            lightmapScale     = this.LightmapScaleGUI(so, 1f);
            TerrainData      terrainData       = selectedObjectsOfType[0].terrainData;
            float            cachedSurfaceArea = !((UnityEngine.Object)terrainData != (UnityEngine.Object)null) ? 0.0f : terrainData.size.x * terrainData.size.z;

            this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
            LightingWindowObjectTab.LightmapParametersGUI(so.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters);
            if (GUI.enabled && selectedObjectsOfType.Length == 1 && (UnityEngine.Object)selectedObjectsOfType[0].terrainData != (UnityEngine.Object)null)
            {
                this.ShowBakePerformanceWarning(so, selectedObjectsOfType[0]);
            }
            this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas);
            if (this.m_ShowBakedLM)
            {
                this.ShowAtlasGUI(so);
            }
            this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM);
            if (this.m_ShowRealtimeLM)
            {
                this.ShowRealtimeLMGUI(selectedObjectsOfType[0]);
            }
            serializedObject.ApplyModifiedProperties();
            so.ApplyModifiedProperties();
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            return(true);
        }
Beispiel #5
0
 private void GeneralSettingsGUI(SerializedObject so, bool enableRealtimeGI, bool enableBakedGI)
 {
     this.m_ShowGeneralSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralSettings, LightingWindow.styles.GeneralGILabel);
     if (this.m_ShowGeneralSettings)
     {
         SerializedProperty serializedProperty = so.FindProperty("m_GISettings.m_AlbedoBoost");
         SerializedProperty property           = so.FindProperty("m_GISettings.m_IndirectOutputScale");
         SerializedProperty prop = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters");
         SerializedProperty serializedProperty2 = so.FindProperty("m_LightmapEditorSettings.m_LightmapsBakeMode");
         bool flag = enableBakedGI || enableRealtimeGI;
         EditorGUI.indentLevel++;
         using (new EditorGUI.DisabledScope(!flag))
         {
             EditorGUILayout.IntPopup(serializedProperty2, this.kModeStrings, this.kModeValues, LightingWindow.s_Styles.DirectionalMode, new GUILayoutOption[0]);
             if (serializedProperty2.intValue == 1)
             {
                 EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalInSM2AndGLES2.text, MessageType.Warning);
             }
             if (serializedProperty2.intValue == 2)
             {
                 EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalSpecularInSM2AndGLES2.text, MessageType.Warning);
             }
             EditorGUILayout.Slider(property, 0f, 5f, LightingWindow.styles.IndirectOutputScale, new GUILayoutOption[0]);
             EditorGUI.BeginChangeCheck();
             EditorGUILayout.Slider(serializedProperty, 1f, 10f, LightingWindow.styles.AlbedoBoost, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 Lightmapping.bounceBoost = serializedProperty.floatValue;
             }
             if (LightingWindowObjectTab.LightmapParametersGUI(prop, LightingWindow.styles.DefaultLightmapParameters, false))
             {
                 this.m_Mode = LightingWindow.Mode.ObjectSettings;
             }
             this.DeveloperBuildEnlightenSettings(so);
         }
         EditorGUI.indentLevel--;
     }
 }