Esempio n. 1
0
 public virtual void OnEnable()
 {
     this.m_Sun                         = this.serializedObject.FindProperty("m_Sun");
     this.m_AmbientMode                 = this.serializedObject.FindProperty("m_AmbientMode");
     this.m_AmbientSkyColor             = this.serializedObject.FindProperty("m_AmbientSkyColor");
     this.m_AmbientEquatorColor         = this.serializedObject.FindProperty("m_AmbientEquatorColor");
     this.m_AmbientGroundColor          = this.serializedObject.FindProperty("m_AmbientGroundColor");
     this.m_AmbientIntensity            = this.serializedObject.FindProperty("m_AmbientIntensity");
     this.m_ReflectionIntensity         = this.serializedObject.FindProperty("m_ReflectionIntensity");
     this.m_ReflectionBounces           = this.serializedObject.FindProperty("m_ReflectionBounces");
     this.m_SkyboxMaterial              = this.serializedObject.FindProperty("m_SkyboxMaterial");
     this.m_DefaultReflectionMode       = this.serializedObject.FindProperty("m_DefaultReflectionMode");
     this.m_DefaultReflectionResolution = this.serializedObject.FindProperty("m_DefaultReflectionResolution");
     this.m_CustomReflection            = this.serializedObject.FindProperty("m_CustomReflection");
     this.m_lightmapSettings            = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
     this.m_EnvironmentLightingMode     = this.m_lightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode");
     this.m_ReflectionCompression       = this.m_lightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression");
     this.m_ShowEditor                  = SessionState.GetBool("ShowLightingEditor", true);
     this.m_ShowAmbientBakeMode.target  = LightingEditor.ShowAmbientField();
 }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            this.serializedObject.Update();
            this.m_lightmapSettings.Update();
            EditorGUILayout.Space();
            this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader);
            if (!this.m_ShowEditor)
            {
                return;
            }
            ++EditorGUI.indentLevel;
            EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]);
            Material objectReferenceValue = this.m_SkyboxMaterial.objectReferenceValue as Material;

            if ((bool)((UnityEngine.Object)objectReferenceValue) && !EditorMaterialUtility.IsBackgroundMaterial(objectReferenceValue))
            {
                EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
            }
            EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.kFullAmbientModes, LightingEditor.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]);
            ++EditorGUI.indentLevel;
            switch (this.m_AmbientMode.intValue)
            {
            case 0:
                if ((UnityEngine.Object)objectReferenceValue == (UnityEngine.Object)null)
                {
                    EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]);
                    break;
                }
                break;

            case 1:
                EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambientUp, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_AmbientEquatorColor, LightingEditor.Styles.ambientMid, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_AmbientGroundColor, LightingEditor.Styles.ambientDown, new GUILayoutOption[0]);
                break;

            case 3:
                EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]);
                break;
            }
            --EditorGUI.indentLevel;
            EditorGUILayout.Slider(this.m_AmbientIntensity, 0.0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]);
            this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField();
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded))
            {
                bool flag = Lightmapping.realtimeLightmapsEnabled && Lightmapping.bakedLightmapsEnabled;
                EditorGUI.BeginDisabledGroup(!flag);
                if (flag)
                {
                    EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]);
                }
                else
                {
                    int index = !Lightmapping.bakedLightmapsEnabled ? 0 : 1;
                    EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[index]), EditorStyles.popup, new GUILayoutOption[0]);
                }
                EditorGUI.EndDisabledGroup();
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]);
            ++EditorGUI.indentLevel;
            switch ((DefaultReflectionMode)this.m_DefaultReflectionMode.intValue)
            {
            case DefaultReflectionMode.FromSkybox:
                EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[1]
                {
                    GUILayout.MinWidth(40f)
                });
                break;

            case DefaultReflectionMode.Custom:
                EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                break;
            }
            EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]);
            --EditorGUI.indentLevel;
            EditorGUILayout.Slider(this.m_ReflectionIntensity, 0.0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]);
            EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]);
            --EditorGUI.indentLevel;
            this.serializedObject.ApplyModifiedProperties();
            this.m_lightmapSettings.ApplyModifiedProperties();
        }
Esempio n. 3
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     this.m_lightmapSettings.Update();
     EditorGUILayout.Space();
     this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader);
     if (this.m_ShowEditor)
     {
         EditorGUI.indentLevel++;
         EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]);
         Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;
         if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
         {
             EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
         }
         EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]);
         EditorGUILayout.Space();
         EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.Styles.kFullAmbientModes, LightingEditor.Styles.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]);
         EditorGUI.indentLevel++;
         AmbientMode intValue = (AmbientMode)this.m_AmbientMode.intValue;
         if (intValue != AmbientMode.Trilight)
         {
             if (intValue != AmbientMode.Flat)
             {
                 if (intValue == AmbientMode.Skybox)
                 {
                     if (material == null)
                     {
                         EditorGUI.BeginChangeCheck();
                         Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                         if (EditorGUI.EndChangeCheck())
                         {
                             this.m_AmbientSkyColor.colorValue = colorValue;
                         }
                     }
                     else
                     {
                         EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]);
                     }
                 }
             }
             else
             {
                 EditorGUI.BeginChangeCheck();
                 Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck())
                 {
                     this.m_AmbientSkyColor.colorValue = colorValue2;
                 }
             }
         }
         else
         {
             EditorGUI.BeginChangeCheck();
             Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_AmbientSkyColor.colorValue     = colorValue3;
                 this.m_AmbientEquatorColor.colorValue = colorValue4;
                 this.m_AmbientGroundColor.colorValue  = colorValue5;
             }
         }
         EditorGUI.indentLevel--;
         this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField();
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded))
         {
             bool flag = Lightmapping.realtimeGI && Lightmapping.bakedGI;
             using (new EditorGUI.DisabledScope(!flag))
             {
                 if (flag)
                 {
                     EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]);
                 }
                 else
                 {
                     int num = (!Lightmapping.bakedGI) ? 0 : 1;
                     EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[num]), EditorStyles.popup, new GUILayoutOption[0]);
                 }
             }
         }
         EditorGUILayout.EndFadeGroup();
         EditorGUILayout.Space();
         EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]);
         EditorGUI.indentLevel++;
         Cubemap exists = this.m_CustomReflection.objectReferenceValue as Cubemap;
         DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
         if ((!material && intValue2 == DefaultReflectionMode.FromSkybox) || (!exists && intValue2 == DefaultReflectionMode.Custom))
         {
             EditorGUILayout.HelpBox(LightingEditor.Styles.defReflectionWarning.text, MessageType.Warning);
         }
         if (intValue2 != DefaultReflectionMode.FromSkybox)
         {
             if (intValue2 == DefaultReflectionMode.Custom)
             {
                 EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
             }
         }
         else
         {
             EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[]
             {
                 GUILayout.MinWidth(40f)
             });
         }
         EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]);
         EditorGUI.indentLevel--;
         EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]);
         EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]);
         EditorGUI.indentLevel--;
         base.serializedObject.ApplyModifiedProperties();
         this.m_lightmapSettings.ApplyModifiedProperties();
     }
 }