Inheritance: EditorWindow
Esempio n. 1
0
        internal static void CreateLightingWindow()
        {
            LightingWindow window = EditorWindow.GetWindow <LightingWindow>();

            window.minSize = new Vector2(390, 390);
            window.Show();
        }
Esempio n. 2
0
        private static void CreateLightingWindow()
        {
            LightingWindow window = EditorWindow.GetWindow <LightingWindow>();

            window.minSize = new Vector2(300f, 360f);
            window.Show();
        }
Esempio n. 3
0
        private static void CreateLightingWindow()
        {
            LightingWindow window = EditorWindow.GetWindow <LightingWindow>();

            window.title   = EditorGUIUtility.TextContent("LightmapEditor.WindowTitle").text;
            window.minSize = new Vector2(300f, 360f);
            window.Show();
        }
Esempio n. 4
0
 private void OnBecameVisible()
 {
     if (!LightingWindow.s_IsVisible)
     {
         LightingWindow.s_IsVisible = true;
         LightingWindow.RepaintSceneAndGameViews();
     }
 }
Esempio n. 5
0
 private void OnBecameVisible()
 {
     if (!LightingWindow.s_IsVisible)
     {
         LightingWindow.s_IsVisible    = true;
         LightmapVisualization.enabled = true;
         LightingWindow.RepaintSceneAndGameViews();
     }
 }
Esempio n. 6
0
        private void BakedGUI(SerializedObject so, SerializedProperty enableRealtimeGI, SerializedProperty enableBakedGI)
        {
            this.m_ShowBakeSettings = EditorGUILayout.ToggleTitlebar(this.m_ShowBakeSettings, LightingWindow.styles.BakedGILabel, enableBakedGI);
            if (!this.m_ShowBakeSettings)
            {
                return;
            }
            SerializedProperty property1 = so.FindProperty("m_LightmapEditorSettings.m_Resolution");
            SerializedProperty property2 = so.FindProperty("m_LightmapEditorSettings.m_BakeResolution");
            SerializedProperty property3 = so.FindProperty("m_LightmapEditorSettings.m_Padding");
            SerializedProperty property4 = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponent");
            SerializedProperty property5 = so.FindProperty("m_LightmapEditorSettings.m_AOMaxDistance");
            SerializedProperty property6 = so.FindProperty("m_LightmapEditorSettings.m_TextureCompression");
            SerializedProperty property7 = so.FindProperty("m_LightmapEditorSettings.m_FinalGather");
            SerializedProperty property8 = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherRayCount");
            SerializedProperty property9 = so.FindProperty("m_LightmapEditorSettings.m_TextureWidth");

            ++EditorGUI.indentLevel;
            EditorGUI.BeginDisabledGroup(!enableBakedGI.boolValue);
            LightingWindow.DrawLightmapResolutionField(property2, LightingWindow.styles.BakeResolution);
            GUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(property3, LightingWindow.styles.Padding, new GUILayoutOption[0]);
            GUILayout.Label(" texels", LightingWindow.styles.labelStyle, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(property6, LightingWindow.s_Styles.TextureCompression, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            this.m_ShowIndirectResolution.target = !enableRealtimeGI.boolValue;
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowIndirectResolution.faded))
            {
                LightingWindow.DrawLightmapResolutionField(property1, LightingWindow.styles.IndirectResolution);
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Slider(property4, 0.0f, 10f, LightingWindow.styles.AmbientOcclusion, new GUILayoutOption[0]);
            if ((double)property4.floatValue > 0.0)
            {
                ++EditorGUI.indentLevel;
                EditorGUILayout.PropertyField(property5, LightingWindow.styles.AOMaxDistance, new GUILayoutOption[0]);
                if ((double)property5.floatValue < 0.0)
                {
                    property5.floatValue = 0.0f;
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.PropertyField(property7, LightingWindow.s_Styles.FinalGather, new GUILayoutOption[0]);
            if (property7.boolValue)
            {
                ++EditorGUI.indentLevel;
                EditorGUILayout.PropertyField(property8, LightingWindow.styles.FinalGatherRayCount, new GUILayoutOption[0]);
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.IntPopup(property9, this.kMaxAtlasSizeStrings, this.kMaxAtlasSizeValues, LightingWindow.styles.MaxAtlasSize, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            --EditorGUI.indentLevel;
        }
Esempio n. 7
0
        private void BakedGUI(SerializedObject so, SerializedProperty enableRealtimeGI, SerializedProperty enableBakedGI)
        {
            this.m_ShowBakeSettings = EditorGUILayout.ToggleTitlebar(this.m_ShowBakeSettings, LightingWindow.styles.BakedGILabel, enableBakedGI);
            if (!this.m_ShowBakeSettings)
            {
                return;
            }
            SerializedProperty resolution          = so.FindProperty("m_LightmapEditorSettings.m_Resolution");
            SerializedProperty resolution2         = so.FindProperty("m_LightmapEditorSettings.m_BakeResolution");
            SerializedProperty property            = so.FindProperty("m_LightmapEditorSettings.m_Padding");
            SerializedProperty serializedProperty  = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponent");
            SerializedProperty serializedProperty2 = so.FindProperty("m_LightmapEditorSettings.m_AOMaxDistance");
            SerializedProperty property2           = so.FindProperty("m_LightmapEditorSettings.m_TextureCompression");
            SerializedProperty serializedProperty3 = so.FindProperty("m_LightmapEditorSettings.m_FinalGather");
            SerializedProperty property3           = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherRayCount");

            EditorGUI.indentLevel++;
            EditorGUI.BeginDisabledGroup(!enableBakedGI.boolValue);
            LightingWindow.DrawLightmapResolutionField(resolution2, LightingWindow.styles.BakeResolution);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property, LightingWindow.styles.Padding, new GUILayoutOption[0]);
            GUILayout.Label(" texels", LightingWindow.styles.labelStyle, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(property2, LightingWindow.s_Styles.TextureCompression, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            this.m_ShowIndirectResolution.target = !enableRealtimeGI.boolValue;
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowIndirectResolution.faded))
            {
                LightingWindow.DrawLightmapResolutionField(resolution, LightingWindow.styles.IndirectResolution);
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Slider(serializedProperty, 0f, 1f, LightingWindow.styles.AmbientOcclusion, new GUILayoutOption[0]);
            if (serializedProperty.floatValue > 0f)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(serializedProperty2, LightingWindow.styles.AOMaxDistance, new GUILayoutOption[0]);
                if (serializedProperty2.floatValue < 0f)
                {
                    serializedProperty2.floatValue = 0f;
                }
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.PropertyField(serializedProperty3, LightingWindow.s_Styles.FinalGather, new GUILayoutOption[0]);
            if (serializedProperty3.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(property3, LightingWindow.styles.FinalGatherRayCount, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
        }
Esempio n. 8
0
 private void RealtimeGUI(SerializedObject so, SerializedProperty enableRealtimeGI)
 {
     this.m_ShowRealtimeSettings = EditorGUILayout.ToggleTitlebar(this.m_ShowRealtimeSettings, LightingWindow.styles.RealtimeGILabel, enableRealtimeGI);
     if (this.m_ShowRealtimeSettings)
     {
         SerializedProperty property   = so.FindProperty("m_RuntimeCPUUsage");
         SerializedProperty resolution = so.FindProperty("m_LightmapEditorSettings.m_Resolution");
         EditorGUI.indentLevel++;
         using (new EditorGUI.DisabledScope(!enableRealtimeGI.boolValue))
         {
             LightingWindow.DrawLightmapResolutionField(resolution, LightingWindow.styles.Resolution);
             EditorGUILayout.IntPopup(property, LightingWindow.styles.RuntimeCPUUsageStrings, LightingWindow.styles.RuntimeCPUUsageValues, LightingWindow.styles.RuntimeCPUUsage, new GUILayoutOption[0]);
         }
         EditorGUI.indentLevel--;
     }
 }
Esempio n. 9
0
        private void RealtimeGUI(SerializedObject so, SerializedProperty enableRealtimeGI, SerializedProperty enableBakedGI)
        {
            this.m_ShowRealtimeSettings = EditorGUILayout.ToggleTitlebar(this.m_ShowRealtimeSettings, LightingWindow.styles.RealtimeGILabel, enableRealtimeGI);
            if (!this.m_ShowRealtimeSettings)
            {
                return;
            }
            SerializedProperty property1 = so.FindProperty("m_RuntimeCPUUsage");
            SerializedProperty property2 = so.FindProperty("m_LightmapEditorSettings.m_Resolution");

            ++EditorGUI.indentLevel;
            EditorGUI.BeginDisabledGroup(!enableRealtimeGI.boolValue);
            LightingWindow.DrawLightmapResolutionField(property2, LightingWindow.styles.Resolution);
            EditorGUILayout.IntPopup(property1, LightingWindow.styles.RuntimeCPUUsageStrings, LightingWindow.styles.RuntimeCPUUsageValues, LightingWindow.styles.RuntimeCPUUsage, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            --EditorGUI.indentLevel;
        }
Esempio n. 10
0
        private void DrawBakeMode()
        {
            if (!showBakeMode)
            {
                return;
            }

            if (GUILayout.Button(GetBakeModeIcon(m_autoLightBakingOn), Styles.statusIcon))
            {
                Event.current.Use();
                LightingWindow.CreateLightingWindow();
            }

            var buttonRect = GUILayoutUtility.GetLastRect();

            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
        }
Esempio n. 11
0
 private void OnBecameInvisible()
 {
     LightingWindow.s_IsVisible    = false;
     LightmapVisualization.enabled = false;
     LightingWindow.RepaintSceneAndGameViews();
 }
Esempio n. 12
0
        protected override void OldOnGUI()
        {
            const int spacing                  = 4;
            const int statusWheelWidth         = 24;
            const int progressBarWidth         = 185;
            float     lightingBakeModeBarWidth = EditorStyles.progressBarText.CalcSize(EditorGUIUtility.TempContent(m_BakeModeString)).x;
            const int barHeight                = 19;

            ConsoleWindow.LoadIcons();

            if (background == null)
            {
                background = "AppToolbar";
            }

            GUI.color = EditorApplication.isPlayingOrWillChangePlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            bool compiling        = EditorApplication.isCompiling;
            bool assembliesLocked = !EditorApplication.CanReloadAssemblies();

            GUILayout.BeginHorizontal();
            GUILayout.Space(2);

            float statusBarItemsWidth = statusWheelWidth + (AsyncProgressBar.isShowing ? (progressBarWidth + spacing) : 0) + (showBakeMode ? (lightingBakeModeBarWidth + spacing) : 0);

            if (Event.current.type == EventType.MouseDown)
            {
                Rect rect = new Rect(position.width - statusBarItemsWidth - m_ManagedDebuggerToggle.GetWidth(), 0, lightingBakeModeBarWidth, barHeight);

                if (rect.Contains(Event.current.mousePosition))
                {
                    Event.current.Use();
                    LightingWindow.CreateLightingWindow();
                }
            }

            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                // Render
                int      mask       = LogEntries.GetStatusMask();
                GUIStyle errorStyle = ConsoleWindow.GetStatusStyleForErrorMode(mask);

                Texture2D icon = ConsoleWindow.GetIconForErrorMode(mask, false);
                GUILayout.Label(icon, errorStyle);

                GUILayout.Space(2);
                GUILayout.BeginVertical();
                GUILayout.Space(1);

                float statusTextWidth = GUIView.current.position.width - statusBarItemsWidth - m_ManagedDebuggerToggle.GetWidth() - (icon != null ? icon.width : 0);
                GUILayout.Label(statusText, errorStyle, GUILayout.MaxWidth(statusTextWidth));

                GUILayout.FlexibleSpace();

                GUILayout.EndVertical();

                // Handle status bar click
                if (Event.current.type == EventType.MouseDown)
                {
                    Rect rect = new Rect(0, 0, statusTextWidth, barHeight);
                    if (rect.Contains(Event.current.mousePosition))
                    {
                        Event.current.Use();
                        LogEntries.ClickStatusBar(Event.current.clickCount);
                        GUIUtility.ExitGUI();
                    }
                }
            }

            float managedDebuggerTogglePosX = position.width - statusWheelWidth - m_ManagedDebuggerToggle.GetWidth();

            m_ManagedDebuggerToggle.OnGUI(managedDebuggerTogglePosX, 0);

            GUILayout.EndHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                float progressBarHorizontalPosition = position.width - statusWheelWidth - m_ManagedDebuggerToggle.GetWidth();

                if (AsyncProgressBar.isShowing)
                {
                    progressBarHorizontalPosition -= progressBarWidth + spacing;
                    EditorGUI.ProgressBar(new Rect(progressBarHorizontalPosition, 0, progressBarWidth, barHeight), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }

                if (showBakeMode)
                {
                    GUI.Label(new Rect(progressBarHorizontalPosition - lightingBakeModeBarWidth - spacing, 0, lightingBakeModeBarWidth, barHeight), m_BakeModeString, EditorStyles.progressBarText);
                    progressBarHorizontalPosition -= lightingBakeModeBarWidth + spacing;
                }

                if (compiling)
                {
                    if (assembliesLocked)
                    {
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_AssemblyLock.image.width, s_AssemblyLock.image.height), s_AssemblyLock, GUIStyle.none);
                    }
                    else
                    {
                        int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_StatusWheel[frame].image.width, s_StatusWheel[frame].image.height), s_StatusWheel[frame], GUIStyle.none);
                    }
                }

                if (Unsupported.IsBleedingEdgeBuild())
                {
                    var backup = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(progressBarHorizontalPosition - 310 - spacing, 0, 310, barHeight), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = backup;
                }
                else if (Unsupported.IsDeveloperMode())
                {
                    GUI.Label(new Rect(progressBarHorizontalPosition - 300 - spacing, 0, 300, barHeight), m_MiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(m_MiniMemoryOverview);
                }
            }

            DoWindowDecorationEnd();

            EditorGUI.ShowRepaints();
        }
Esempio n. 13
0
 private void BakedGUI(SerializedObject so, bool enableRealtimeGI, SerializedProperty enableBakedGI)
 {
     this.m_ShowBakeSettings = EditorGUILayout.ToggleTitlebar(this.m_ShowBakeSettings, LightingWindow.styles.BakedGILabel, enableBakedGI);
     if (this.m_ShowBakeSettings)
     {
         SerializedProperty resolution          = so.FindProperty("m_LightmapEditorSettings.m_Resolution");
         SerializedProperty resolution2         = so.FindProperty("m_LightmapEditorSettings.m_BakeResolution");
         SerializedProperty property            = so.FindProperty("m_LightmapEditorSettings.m_Padding");
         SerializedProperty serializedProperty  = so.FindProperty("m_LightmapEditorSettings.m_AO");
         SerializedProperty serializedProperty2 = so.FindProperty("m_LightmapEditorSettings.m_AOMaxDistance");
         SerializedProperty property2           = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponent");
         SerializedProperty property3           = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponentDirect");
         SerializedProperty property4           = so.FindProperty("m_LightmapEditorSettings.m_TextureCompression");
         SerializedProperty property5           = so.FindProperty("m_LightmapEditorSettings.m_DirectLightInLightProbes");
         SerializedProperty serializedProperty3 = so.FindProperty("m_LightmapEditorSettings.m_FinalGather");
         SerializedProperty property6           = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherRayCount");
         SerializedProperty property7           = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherFiltering");
         SerializedProperty property8           = so.FindProperty("m_LightmapEditorSettings.m_TextureWidth");
         EditorGUI.indentLevel++;
         using (new EditorGUI.DisabledScope(!enableBakedGI.boolValue))
         {
             LightingWindow.DrawLightmapResolutionField(resolution2, LightingWindow.styles.BakeResolution);
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(property, LightingWindow.styles.Padding, new GUILayoutOption[0]);
             GUILayout.Label(" texels", LightingWindow.styles.labelStyle, new GUILayoutOption[0]);
             GUILayout.EndHorizontal();
             EditorGUILayout.PropertyField(property4, LightingWindow.s_Styles.TextureCompression, new GUILayoutOption[0]);
             this.m_ShowIndirectResolution.target = !enableRealtimeGI;
             if (EditorGUILayout.BeginFadeGroup(this.m_ShowIndirectResolution.faded))
             {
                 EditorGUILayout.Space();
                 LightingWindow.DrawLightmapResolutionField(resolution, LightingWindow.styles.IndirectResolution);
                 EditorGUILayout.Space();
             }
             EditorGUILayout.EndFadeGroup();
             EditorGUILayout.PropertyField(serializedProperty, LightingWindow.s_Styles.AO, new GUILayoutOption[0]);
             if (serializedProperty.boolValue)
             {
                 EditorGUI.indentLevel++;
                 EditorGUILayout.PropertyField(serializedProperty2, LightingWindow.styles.AOMaxDistance, new GUILayoutOption[0]);
                 if (serializedProperty2.floatValue < 0f)
                 {
                     serializedProperty2.floatValue = 0f;
                 }
                 EditorGUILayout.Slider(property2, 0f, 10f, LightingWindow.styles.AmbientOcclusion, new GUILayoutOption[0]);
                 EditorGUILayout.Slider(property3, 0f, 10f, LightingWindow.styles.AmbientOcclusionDirect, new GUILayoutOption[0]);
                 EditorGUI.indentLevel--;
             }
             EditorGUILayout.PropertyField(serializedProperty3, LightingWindow.s_Styles.FinalGather, new GUILayoutOption[0]);
             if (serializedProperty3.boolValue)
             {
                 EditorGUI.indentLevel++;
                 EditorGUILayout.PropertyField(property6, LightingWindow.styles.FinalGatherRayCount, new GUILayoutOption[0]);
                 EditorGUILayout.PropertyField(property7, LightingWindow.styles.FinalGatherFiltering, new GUILayoutOption[0]);
                 EditorGUI.indentLevel--;
             }
             EditorGUILayout.IntPopup(property8, this.kMaxAtlasSizeStrings, this.kMaxAtlasSizeValues, LightingWindow.styles.MaxAtlasSize, new GUILayoutOption[0]);
             EditorGUILayout.Space();
             EditorGUILayout.LabelField(LightingWindow.styles.LightProbesTitle, new GUILayoutOption[0]);
             EditorGUI.indentLevel++;
             EditorGUILayout.PropertyField(property5, LightingWindow.s_Styles.DirectLightInLightProbes, new GUILayoutOption[0]);
             EditorGUI.indentLevel--;
             EditorGUILayout.Space();
         }
         EditorGUI.indentLevel--;
     }
 }
Esempio n. 14
0
 private void OnBecameInvisible()
 {
     LightingWindow.s_IsVisible = false;
     LightingWindow.RepaintSceneAndGameViews();
 }