예제 #1
0
 public static LightModeUtil Get()
 {
     if (LightModeUtil.gs_ptr == null)
     {
         LightModeUtil.gs_ptr = new LightModeUtil();
     }
     return(LightModeUtil.gs_ptr);
 }
예제 #2
0
        private void Buttons()
        {
            bool enabled = GUI.enabled;

            GUI.enabled &= !EditorApplication.isPlayingOrWillChangePlaymode;
            bool flag = LightModeUtil.Get().IsWorkflowAuto();

            if (Lightmapping.lightingDataAsset && !Lightmapping.lightingDataAsset.isValid)
            {
                EditorGUILayout.HelpBox(Lightmapping.lightingDataAsset.validityErrorMessage, MessageType.Warning);
            }
            EditorGUILayout.Space();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            EditorGUI.BeginChangeCheck();
            flag = GUILayout.Toggle(flag, LightingWindow.Styles.ContinuousBakeLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                LightModeUtil.Get().SetWorkflow(flag);
            }
            using (new EditorGUI.DisabledScope(flag))
            {
                bool flag2 = flag || !Lightmapping.isRunning;
                if (flag2)
                {
                    if (EditorGUI.ButtonWithDropdownList(LightingWindow.Styles.BuildLabel, LightingWindow.s_BakeModeOptions, new GenericMenu.MenuFunction2(this.BakeDropDownCallback), new GUILayoutOption[]
                    {
                        GUILayout.Width(180f)
                    }))
                    {
                        this.DoBake();
                        GUIUtility.ExitGUI();
                    }
                }
                else
                {
                    if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer && LightModeUtil.Get().AreBakedLightmapsEnabled() && GUILayout.Button("Force Stop", new GUILayoutOption[]
                    {
                        GUILayout.Width(150f)
                    }))
                    {
                        Lightmapping.ForceStop();
                    }
                    if (GUILayout.Button("Cancel", new GUILayoutOption[]
                    {
                        GUILayout.Width(150f)
                    }))
                    {
                        Lightmapping.Cancel();
                        UsabilityAnalytics.Track("/LightMapper/Cancel");
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();
            GUI.enabled = enabled;
        }
예제 #3
0
 private void LightUsageGUI()
 {
     if (EditorGUILayout.BeginFadeGroup(1f - this.m_AnimShowAreaOptions.faded))
     {
         LightModeUtil.Get().DrawElement(this.m_Lightmapping, LightEditor.s_Styles.LightmappingMode);
         if (this.bakingWarningValue)
         {
             EditorGUILayout.HelpBox(LightEditor.s_Styles.BakingWarning.text, MessageType.Info);
         }
     }
     EditorGUILayout.EndFadeGroup();
 }
예제 #4
0
 private void OnGUI()
 {
     LightModeUtil.Get().Load();
     EditorGUIUtility.labelWidth = 130f;
     EditorGUILayout.Space();
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(this.toolbarPadding);
     this.ModeToggle();
     GUILayout.FlexibleSpace();
     this.DrawHelpGUI();
     if (this.m_Mode == LightingWindow.Mode.LightingSettings)
     {
         this.DrawSettingsGUI();
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.Space();
     LightingWindow.Mode mode = this.m_Mode;
     if (mode != LightingWindow.Mode.LightingSettings)
     {
         if (mode != LightingWindow.Mode.OutputMaps)
         {
             if (mode != LightingWindow.Mode.ObjectSettings)
             {
             }
         }
         else
         {
             this.m_ScrollPositionOutputMaps = EditorGUILayout.BeginScrollView(this.m_ScrollPositionOutputMaps, new GUILayoutOption[0]);
             this.m_LightmapPreviewTab.Maps();
             EditorGUILayout.EndScrollView();
             EditorGUILayout.Space();
         }
     }
     else
     {
         this.m_ScrollPositionLighting = EditorGUILayout.BeginScrollView(this.m_ScrollPositionLighting, new GUILayoutOption[0]);
         this.m_LightingTab.OnGUI();
         EditorGUILayout.EndScrollView();
         EditorGUILayout.Space();
     }
     this.Buttons();
     this.Summary();
     this.PreviewSection();
     if (LightModeUtil.Get().Flush())
     {
         InspectorWindow.RepaintAllInspectors();
     }
 }
 private void MixedLightingGUI()
 {
     this.m_ShowMixedLightsSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowMixedLightsSettings, LightingWindowBakeSettings.Styles.MixedLightsLabel, true);
     if (this.m_ShowMixedLightsSettings)
     {
         EditorGUI.indentLevel++;
         LightModeUtil.Get().DrawBakedGIElement();
         if (!LightModeUtil.Get().AreBakedLightmapsEnabled())
         {
             EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.BakedGIDisabledInfo.text, MessageType.Info);
         }
         using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled()))
         {
             int realtimeMode;
             int num;
             this.m_LightModeUtil.GetModes(out realtimeMode, out num);
             int num2 = EditorGUILayout.IntPopup(LightingWindowBakeSettings.Styles.MixedLightMode, num, LightingWindowBakeSettings.Styles.MixedModeStrings, LightingWindowBakeSettings.Styles.MixedModeValues, new GUILayoutOption[0]);
             if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer && num2 != 0)
             {
                 EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoShadowMaskInProgressive.text, MessageType.Warning);
             }
             if (LightModeUtil.Get().AreBakedLightmapsEnabled())
             {
                 EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.HelpStringsMixed[num].text, MessageType.Info);
             }
             if (num2 != num)
             {
                 this.m_LightModeUtil.Store(realtimeMode, num2);
             }
             if (this.m_LightModeUtil.IsSubtractiveModeEnabled())
             {
                 EditorGUILayout.PropertyField(this.m_SubtractiveShadowColor, LightingWindowBakeSettings.Styles.SubtractiveShadowColor, new GUILayoutOption[0]);
                 this.m_RenderSettingsSO.ApplyModifiedProperties();
                 EditorGUILayout.Space();
             }
         }
         EditorGUI.indentLevel--;
         EditorGUILayout.Space();
     }
 }
 private void GeneralLightmapSettingsGUI()
 {
     this.m_ShowGeneralLightmapSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralLightmapSettings, LightingWindowBakeSettings.Styles.GeneralLightmapLabel, true);
     if (this.m_ShowGeneralLightmapSettings)
     {
         EditorGUI.indentLevel++;
         using (new EditorGUI.DisabledScope(!LightModeUtil.Get().IsAnyGIEnabled()))
         {
             using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled()))
             {
                 EditorGUILayout.PropertyField(this.m_BakeBackend, LightingWindowBakeSettings.Styles.BakeBackend, new GUILayoutOption[0]);
                 if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer)
                 {
                     EditorGUI.indentLevel++;
                     EditorGUILayout.PropertyField(this.m_PVRCulling, LightingWindowBakeSettings.Styles.PVRCulling, new GUILayoutOption[0]);
                     if (LightmapEditorSettings.giPathTracerSampling != LightmapEditorSettings.PathTracerSampling.Auto)
                     {
                         EditorGUILayout.PropertyField(this.m_PVRDirectSampleCount, LightingWindowBakeSettings.Styles.PVRDirectSampleCount, new GUILayoutOption[0]);
                         EditorGUILayout.PropertyField(this.m_PVRSampleCount, LightingWindowBakeSettings.Styles.PVRIndirectSampleCount, new GUILayoutOption[0]);
                         if (this.m_PVRSampleCount.intValue < 10 || this.m_PVRSampleCount.intValue > 100000)
                         {
                             this.m_PVRSampleCount.intValue = Math.Max(Math.Min(this.m_PVRSampleCount.intValue, 100000), 10);
                         }
                     }
                     EditorGUILayout.IntPopup(this.m_PVRBounces, LightingWindowBakeSettings.Styles.BouncesStrings, LightingWindowBakeSettings.Styles.BouncesValues, LightingWindowBakeSettings.Styles.PVRBounces, new GUILayoutOption[0]);
                     EditorGUILayout.PropertyField(this.m_PVRFilteringMode, LightingWindowBakeSettings.Styles.PVRFilteringMode, new GUILayoutOption[0]);
                     if (this.m_PVRFilteringMode.enumValueIndex == 2)
                     {
                         EditorGUI.indentLevel++;
                         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                         EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusDirect, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusDirect, new GUILayoutOption[0]);
                         GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]);
                         GUILayout.EndHorizontal();
                         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                         EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusIndirect, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusIndirect, new GUILayoutOption[0]);
                         GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]);
                         GUILayout.EndHorizontal();
                         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                         EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusAO, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusAO, new GUILayoutOption[0]);
                         GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]);
                         GUILayout.EndHorizontal();
                         EditorGUI.indentLevel--;
                     }
                     EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoTransparencyAndLODInProgressive.text, MessageType.Warning);
                     EditorGUI.indentLevel--;
                     EditorGUILayout.Space();
                 }
             }
             using (new EditorGUI.DisabledScope(LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer && !LightModeUtil.Get().IsRealtimeGIEnabled()))
             {
                 LightingWindowBakeSettings.DrawResolutionField(this.m_Resolution, LightingWindowBakeSettings.Styles.IndirectResolution);
             }
             using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled()))
             {
                 LightingWindowBakeSettings.DrawResolutionField(this.m_BakeResolution, LightingWindowBakeSettings.Styles.LightmapResolution);
                 GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                 EditorGUILayout.PropertyField(this.m_Padding, LightingWindowBakeSettings.Styles.Padding, new GUILayoutOption[0]);
                 GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]);
                 GUILayout.EndHorizontal();
                 EditorGUILayout.IntPopup(this.m_LightmapSize, LightingWindowBakeSettings.Styles.LightmapSizeStrings, LightingWindowBakeSettings.Styles.LightmapSizeValues, LightingWindowBakeSettings.Styles.LightmapSize, new GUILayoutOption[0]);
                 EditorGUILayout.PropertyField(this.m_TextureCompression, LightingWindowBakeSettings.Styles.TextureCompression, new GUILayoutOption[0]);
                 EditorGUILayout.PropertyField(this.m_AmbientOcclusion, LightingWindowBakeSettings.Styles.AmbientOcclusion, new GUILayoutOption[0]);
                 if (this.m_AmbientOcclusion.boolValue)
                 {
                     EditorGUI.indentLevel++;
                     EditorGUILayout.PropertyField(this.m_AOMaxDistance, LightingWindowBakeSettings.Styles.AOMaxDistance, new GUILayoutOption[0]);
                     if (this.m_AOMaxDistance.floatValue < 0f)
                     {
                         this.m_AOMaxDistance.floatValue = 0f;
                     }
                     EditorGUILayout.Slider(this.m_CompAOExponent, 0f, 10f, LightingWindowBakeSettings.Styles.AmbientOcclusionContribution, new GUILayoutOption[0]);
                     EditorGUILayout.Slider(this.m_CompAOExponentDirect, 0f, 10f, LightingWindowBakeSettings.Styles.AmbientOcclusionContributionDirect, new GUILayoutOption[0]);
                     EditorGUI.indentLevel--;
                 }
                 if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.Radiosity)
                 {
                     EditorGUILayout.PropertyField(this.m_FinalGather, LightingWindowBakeSettings.Styles.FinalGather, new GUILayoutOption[0]);
                     if (this.m_FinalGather.boolValue)
                     {
                         EditorGUI.indentLevel++;
                         EditorGUILayout.PropertyField(this.m_FinalGatherRayCount, LightingWindowBakeSettings.Styles.FinalGatherRayCount, new GUILayoutOption[0]);
                         EditorGUILayout.PropertyField(this.m_FinalGatherFiltering, LightingWindowBakeSettings.Styles.FinalGatherFiltering, new GUILayoutOption[0]);
                         EditorGUI.indentLevel--;
                     }
                 }
             }
             EditorGUILayout.IntPopup(this.m_LightmapDirectionalMode, LightingWindowBakeSettings.Styles.LightmapDirectionalModeStrings, LightingWindowBakeSettings.Styles.LightmapDirectionalModeValues, LightingWindowBakeSettings.Styles.LightmapDirectionalMode, new GUILayoutOption[0]);
             if (this.m_LightmapDirectionalMode.intValue == 1)
             {
                 EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoDirectionalInSM2AndGLES2.text, MessageType.Warning);
             }
             EditorGUILayout.Slider(this.m_IndirectOutputScale, 0f, 5f, LightingWindowBakeSettings.Styles.IndirectOutputScale, new GUILayoutOption[0]);
             EditorGUILayout.Slider(this.m_AlbedoBoost, 1f, 10f, LightingWindowBakeSettings.Styles.AlbedoBoost, new GUILayoutOption[0]);
             if (LightingWindowBakeSettings.LightmapParametersGUI(this.m_LightmapParameters, LightingWindowBakeSettings.Styles.DefaultLightmapParameters))
             {
                 EditorWindow.FocusWindowIfItsOpen <InspectorWindow>();
             }
             EditorGUI.indentLevel--;
             EditorGUILayout.Space();
         }
     }
 }
 public LightingWindowBakeSettings()
 {
     this.m_LightModeUtil = LightModeUtil.Get();
 }
예제 #8
0
        public static SerializedPropertyTreeView.Column[] CreateLightColumns(out string[] propNames)
        {
            SerializedPropertyTreeView.Column[] expr_07 = new SerializedPropertyTreeView.Column[8];
            expr_07[0] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Name,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 200f,
                minWidth              = 100f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = null,
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
                filter                = new SerializedPropertyFilters.Name()
            };
            expr_07[1] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.On,
                headerTextAlignment   = TextAlignment.Center,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 25f,
                minWidth              = 25f,
                maxWidth              = 25f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Enabled",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
            };
            expr_07[2] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Type,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 120f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            int arg_21C_1 = 3;

            SerializedPropertyTreeView.Column column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Mode;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 70f;
            column.minWidth              = 40f;
            column.maxWidth              = 70f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_Lightmapping";
            column.dependencyIndices     = new int[]
            {
                2
            };
            column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum;
            column.drawDelegate    = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                LightModeUtil.Get().DrawElement(r, prop, dep[0]);
            };
            expr_07[arg_21C_1] = column;
            expr_07[4]         = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Color,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 70f,
                minWidth              = 40f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Color",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareColor,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[5] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Intensity,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 60f,
                minWidth              = 30f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Intensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[6] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.IndirectMultiplier,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 110f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_BounceIntensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[7] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.ShadowType,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 100f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Shadows.m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            SerializedPropertyTreeView.Column[] columns = expr_07;
            return(LightTableColumns.FinalizeColumns(columns, out propNames));
        }
예제 #9
0
        public void StatisticsPreview(Rect r)
        {
            GUI.Box(r, "", "PreBackground");
            LightingWindowLightingTab.Styles.StatsTableHeader.alignment = TextAnchor.MiddleLeft;
            EditorGUILayout.BeginScrollView(Vector2.zero, new GUILayoutOption[]
            {
                GUILayout.Height(r.height)
            });
            bool flag = this.m_ShouldUpdateStatistics || !EditorApplication.isPlayingOrWillChangePlaymode;

            if (flag)
            {
                LightModeUtil.Get().AnalyzeScene(ref this.m_Stats);
            }
            else
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.HelpBox(LightingWindowLightingTab.Styles.StatisticsWarning, MessageType.Info);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Space();
            bool flag2 = LightModeUtil.Get().AreBakedLightmapsEnabled() && this.m_Stats.receiverMask == LightModeValidator.Receivers.None;

            using (new EditorGUI.DisabledScope(!flag))
            {
                GUILayoutOption[] opts_icon = new GUILayoutOption[]
                {
                    GUILayout.MinWidth(16f),
                    GUILayout.MaxWidth(16f)
                };
                GUILayoutOption[] opts_name = new GUILayoutOption[]
                {
                    GUILayout.MinWidth(175f),
                    GUILayout.MaxWidth(200f)
                };
                GUILayoutOption[] opts = new GUILayoutOption[]
                {
                    GUILayout.MinWidth(10f),
                    GUILayout.MaxWidth(65f)
                };
                using (new EditorGUILayout.HorizontalScope(new GUILayoutOption[0]))
                {
                    EditorGUILayout.LabelField(GUIContent.none, LightingWindowLightingTab.Styles.StatsTableHeader, opts_icon);
                    EditorGUILayout.LabelField(LightingWindowLightingTab.Styles.StatisticsCategory, LightingWindowLightingTab.Styles.StatsTableHeader, opts_name);
                    EditorGUILayout.LabelField(LightingWindowLightingTab.Styles.StatisticsEnabled, LightingWindowLightingTab.Styles.StatsTableHeader, opts);
                    EditorGUILayout.LabelField(LightingWindowLightingTab.Styles.StatisticsDisabled, LightingWindowLightingTab.Styles.StatsTableHeader, opts);
                    EditorGUILayout.LabelField(LightingWindowLightingTab.Styles.StatisticsInactive, LightingWindowLightingTab.Styles.StatsTableHeader, opts);
                }
                LightingWindowLightingTab.DrawStats drawStats = delegate(GUIContent icon, GUIContent label, int enabled, int active, int inactive)
                {
                    using (new EditorGUILayout.HorizontalScope(new GUILayoutOption[0]))
                    {
                        EditorGUILayout.LabelField(icon, LightingWindowLightingTab.Styles.StatsTableContent, opts_icon);
                        EditorGUILayout.LabelField(label, LightingWindowLightingTab.Styles.StatsTableContent, opts_name);
                        Rect lastRect = GUILayoutUtility.GetLastRect();
                        EditorGUILayout.LabelField(enabled.ToString(), LightingWindowLightingTab.Styles.StatsTableContent, opts);
                        lastRect.xMax = GUILayoutUtility.GetLastRect().xMax;
                        EditorGUILayout.LabelField(active.ToString(), LightingWindowLightingTab.Styles.StatsTableContent, opts);
                        EditorGUILayout.LabelField(inactive.ToString(), LightingWindowLightingTab.Styles.StatsTableContent, opts);
                    }
                };
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.RealtimeLights, (int)this.m_Stats.enabled.realtimeLightsCount, (int)this.m_Stats.active.realtimeLightsCount, (int)this.m_Stats.inactive.realtimeLightsCount);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.MixedLights, (int)this.m_Stats.enabled.mixedLightsCount, (int)this.m_Stats.active.mixedLightsCount, (int)this.m_Stats.inactive.mixedLightsCount);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.BakedLights, (int)this.m_Stats.enabled.bakedLightsCount, (int)this.m_Stats.active.bakedLightsCount, (int)this.m_Stats.inactive.bakedLightsCount);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.DynamicMeshes, (int)this.m_Stats.enabled.dynamicMeshesCount, (int)this.m_Stats.active.dynamicMeshesCount, (int)this.m_Stats.inactive.dynamicMeshesCount);
                drawStats((!flag2) ? GUIContent.none : LightingWindowLightingTab.Styles.StaticMeshesIconWarning, LightingWindowLightingTab.Styles.StaticMeshes, (int)this.m_Stats.enabled.staticMeshesCount, (int)this.m_Stats.active.staticMeshesCount, (int)this.m_Stats.inactive.staticMeshesCount);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.RealtimeEmissiveMaterials, (int)this.m_Stats.enabled.staticMeshesRealtimeEmissive, (int)this.m_Stats.active.staticMeshesRealtimeEmissive, (int)this.m_Stats.inactive.staticMeshesRealtimeEmissive);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.BakedEmissiveMaterials, (int)this.m_Stats.enabled.staticMeshesBakedEmissive, (int)this.m_Stats.active.staticMeshesBakedEmissive, (int)this.m_Stats.inactive.staticMeshesBakedEmissive);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.LightProbeGroups, (int)this.m_Stats.enabled.lightProbeGroupsCount, (int)this.m_Stats.active.lightProbeGroupsCount, (int)this.m_Stats.inactive.lightProbeGroupsCount);
                drawStats(GUIContent.none, LightingWindowLightingTab.Styles.ReflectionProbes, (int)this.m_Stats.enabled.reflectionProbesCount, (int)this.m_Stats.active.reflectionProbesCount, (int)this.m_Stats.inactive.reflectionProbesCount);
            }
            EditorGUILayout.Space();
            EditorGUILayout.EndScrollView();
        }
예제 #10
0
        private void DrawGUI()
        {
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true);
            if (this.m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]);
                if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
                {
                    EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
                }
                EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]);
                AmbientMode intValue = (AmbientMode)this.m_AmbientSource.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.env_amb_int, 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;
                    }
                }
                if (LightModeUtil.Get().IsAnyGIEnabled())
                {
                    int  selectedValue;
                    bool ambientLightingMode = LightModeUtil.Get().GetAmbientLightingMode(out selectedValue);
                    using (new EditorGUI.DisabledScope(!ambientLightingMode))
                    {
                        int[] optionValues = new int[]
                        {
                            0,
                            1
                        };
                        if (ambientLightingMode)
                        {
                            this.m_AmbientLightingMode.intValue = EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, this.m_AmbientLightingMode.intValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                        else
                        {
                            EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, selectedValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]);
                DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
                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.env_refl_res, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(40f)
                    });
                }
                EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]);
                EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
예제 #11
0
 public void RenderTerrainSettings()
 {
     if (LightingSettingsInspector.s_Styles == null)
     {
         LightingSettingsInspector.s_Styles = new LightingSettingsInspector.Styles();
     }
     if (this.m_SerializedObject != null && this.m_GameObjectsSerializedObject != null && this.m_GameObjectsSerializedObject.targetObjects.Length != 0)
     {
         this.m_GameObjectsSerializedObject.Update();
         this.LightmapStaticSettings();
         if (!LightModeUtil.Get().IsAnyGIEnabled() && !this.isPrefabAsset)
         {
             EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.GINotEnabledInfo.text, MessageType.Info);
         }
         else
         {
             bool flag = (this.m_StaticEditorFlags.intValue & 1) != 0;
             if (flag)
             {
                 this.m_ShowLightmapSettings = EditorGUILayout.Foldout(this.m_ShowLightmapSettings, LightingSettingsInspector.s_Styles.LightmapSettings);
                 if (this.m_ShowLightmapSettings)
                 {
                     EditorGUI.indentLevel++;
                     using (new EditorGUI.DisabledScope(!flag))
                     {
                         if (GUI.enabled)
                         {
                             this.ShowTerrainChunks(this.m_Terrains);
                         }
                         float       lightmapScale     = this.LightmapScaleGUI(1f);
                         TerrainData terrainData       = this.m_Terrains[0].terrainData;
                         float       cachedSurfaceArea = (!(terrainData != null)) ? 0f : (terrainData.size.x * terrainData.size.z);
                         this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
                         LightingSettingsInspector.LightmapParametersGUI(this.m_LightmapParameters, LightingSettingsInspector.s_Styles.LightmapParameters);
                         if (GUI.enabled && this.m_Terrains.Length == 1 && this.m_Terrains[0].terrainData != null)
                         {
                             this.ShowBakePerformanceWarning(this.m_Terrains[0]);
                         }
                         this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingSettingsInspector.s_Styles.Atlas);
                         if (this.m_ShowBakedLM)
                         {
                             this.ShowAtlasGUI(this.m_Terrains[0].GetInstanceID());
                         }
                         this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingSettingsInspector.s_Styles.RealtimeLM);
                         if (this.m_ShowRealtimeLM)
                         {
                             this.ShowRealtimeLMGUI(this.m_Terrains[0]);
                         }
                         this.m_SerializedObject.ApplyModifiedProperties();
                     }
                     EditorGUI.indentLevel--;
                 }
                 GUILayout.Space(10f);
             }
             else
             {
                 EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.TerrainLightmapInfoBox.text, MessageType.Info);
             }
         }
     }
 }
예제 #12
0
 public void RenderMeshSettings(bool showLightmapSettings)
 {
     if (LightingSettingsInspector.s_Styles == null)
     {
         LightingSettingsInspector.s_Styles = new LightingSettingsInspector.Styles();
     }
     if (this.m_SerializedObject != null && this.m_GameObjectsSerializedObject != null && this.m_GameObjectsSerializedObject.targetObjects.Length != 0)
     {
         this.m_GameObjectsSerializedObject.Update();
         EditorGUILayout.PropertyField(this.m_CastShadows, LightingSettingsInspector.s_Styles.CastShadows, true, new GUILayoutOption[0]);
         bool disabled = SceneView.IsUsingDeferredRenderingPath();
         using (new EditorGUI.DisabledScope(disabled))
         {
             EditorGUILayout.PropertyField(this.m_ReceiveShadows, LightingSettingsInspector.s_Styles.ReceiveShadows, true, new GUILayoutOption[0]);
         }
         EditorGUILayout.PropertyField(this.m_MotionVectors, LightingSettingsInspector.s_Styles.MotionVectors, true, new GUILayoutOption[0]);
         if (showLightmapSettings)
         {
             this.LightmapStaticSettings();
             if (!LightModeUtil.Get().IsAnyGIEnabled() && !this.isPrefabAsset)
             {
                 EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.GINotEnabledInfo.text, MessageType.Info);
             }
             else
             {
                 bool flag = (this.m_StaticEditorFlags.intValue & 1) != 0;
                 if (flag)
                 {
                     this.m_ShowChartingSettings = EditorGUILayout.Foldout(this.m_ShowChartingSettings, LightingSettingsInspector.s_Styles.UVCharting);
                     if (this.m_ShowChartingSettings)
                     {
                         this.RendererUVSettings();
                     }
                     this.m_ShowLightmapSettings = EditorGUILayout.Foldout(this.m_ShowLightmapSettings, LightingSettingsInspector.s_Styles.LightmapSettings);
                     if (this.m_ShowLightmapSettings)
                     {
                         EditorGUI.indentLevel++;
                         float num = LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[0]);
                         for (int i = 1; i < this.m_Renderers.Length; i++)
                         {
                             if (!Mathf.Approximately(num, LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[i])))
                             {
                                 num = 1f;
                             }
                         }
                         float lightmapScale         = this.LightmapScaleGUI(num) * LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[0]);
                         float cachedMeshSurfaceArea = InternalMeshUtil.GetCachedMeshSurfaceArea((MeshRenderer)this.m_Renderers[0]);
                         this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedMeshSurfaceArea);
                         EditorGUILayout.PropertyField(this.m_ImportantGI, LightingSettingsInspector.s_Styles.ImportantGI, new GUILayoutOption[0]);
                         LightingSettingsInspector.LightmapParametersGUI(this.m_LightmapParameters, LightingSettingsInspector.s_Styles.LightmapParameters);
                         this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingSettingsInspector.s_Styles.Atlas);
                         if (this.m_ShowBakedLM)
                         {
                             this.ShowAtlasGUI(this.m_Renderers[0].GetInstanceID());
                         }
                         this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingSettingsInspector.s_Styles.RealtimeLM);
                         if (this.m_ShowRealtimeLM)
                         {
                             this.ShowRealtimeLMGUI(this.m_Renderers[0]);
                         }
                         EditorGUI.indentLevel--;
                     }
                     if (LightmapEditorSettings.HasZeroAreaMesh(this.m_Renderers[0]))
                     {
                         EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning);
                     }
                     if (LightmapEditorSettings.HasClampedResolution(this.m_Renderers[0]))
                     {
                         EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.ClampedPackingResolution.text, MessageType.Warning);
                     }
                     if (!LightingSettingsInspector.HasNormals(this.m_Renderers[0]))
                     {
                         EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning);
                     }
                     this.m_SerializedObject.ApplyModifiedProperties();
                 }
                 else
                 {
                     EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.LightmapInfoBox.text, MessageType.Info);
                 }
             }
         }
     }
 }