상속: EditorWindow
예제 #1
0
 private void DrawCPUOrRenderingToolbar(ProfilerProperty property)
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
     string[] displayedOptions = new string[]
     {
         "Hierarchy",
         "Timeline",
         "Raw Hierarchy"
     };
     int[] optionValues = new int[]
     {
         0,
         1,
         2
     };
     this.m_ViewType = (ProfilerViewType)EditorGUILayout.IntPopup((int)this.m_ViewType, displayedOptions, optionValues, EditorStyles.toolbarDropDown, new GUILayoutOption[]
     {
         GUILayout.Width(100f)
     });
     GUILayout.FlexibleSpace();
     GUILayout.Label(string.Format("CPU:{0}ms   GPU:{1}ms", property.frameTime, property.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]);
     GUI.enabled = (ProfilerDriver.GetNextFrameIndex(this.m_CurrentFrame) == -1);
     if (GUILayout.Button((!GUI.enabled) ? ProfilerWindow.ms_Styles.noFrameDebugger : ProfilerWindow.ms_Styles.frameDebugger, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         FrameDebuggerWindow frameDebuggerWindow = FrameDebuggerWindow.ShowFrameDebuggerWindow();
         frameDebuggerWindow.EnableIfNeeded();
     }
     GUI.enabled = true;
     GUILayout.FlexibleSpace();
     this.SearchFieldGUI();
     EditorGUILayout.EndHorizontal();
     this.HandleCommandEvents();
 }
        private void DrawPrevNextButtons(FrameDebuggerWindow frameDebugger, ref int newLimit)
        {
            bool wasEnabled = GUI.enabled;

            GUI.enabled = newLimit > 1;
            if (GUILayout.Button(FrameDebuggerStyles.TopToolbar.prevFrame, EditorStyles.toolbarButton))
            {
                frameDebugger.ChangeFrameEventLimit(newLimit - 1);
            }

            GUI.enabled = newLimit < FrameDebuggerUtility.count;
            if (GUILayout.Button(FrameDebuggerStyles.TopToolbar.nextFrame, EditorStyles.toolbarButtonRight))
            {
                frameDebugger.ChangeFrameEventLimit(newLimit + 1);
            }

            // If we had last event selected, and something changed in the scene so that
            // number of events is different - then try to keep the last event selected.
            if (m_PrevEventsLimit == m_PrevEventsCount)
            {
                if (FrameDebuggerUtility.count != m_PrevEventsCount && FrameDebuggerUtility.limit == m_PrevEventsLimit)
                {
                    frameDebugger.ChangeFrameEventLimit(FrameDebuggerUtility.count);
                }
            }

            m_PrevEventsLimit = FrameDebuggerUtility.limit;
            m_PrevEventsCount = FrameDebuggerUtility.count;

            GUI.enabled = wasEnabled;
        }
        // Returns true if repaint is needed
        public bool DrawToolbar(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState)
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            Profiler.BeginSample("DrawEnableDisableButton");
            DrawEnableDisableButton(frameDebugger, m_AttachToPlayerState, out bool needsRepaint);
            Profiler.EndSample();

            Profiler.BeginSample("DrawConnectionDropdown");
            DrawConnectionDropdown(frameDebugger, m_AttachToPlayerState, out bool isEnabled);
            Profiler.EndSample();

            GUI.enabled = isEnabled;

            Profiler.BeginSample("DrawEventLimitSlider");
            DrawEventLimitSlider(frameDebugger, out int newLimit);
            Profiler.EndSample();

            Profiler.BeginSample("DrawPrevNextButtons");
            DrawPrevNextButtons(frameDebugger, ref newLimit);
            Profiler.EndSample();

            GUILayout.EndHorizontal();

            return(needsRepaint);
        }
예제 #4
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndWebplayerDefaultSizes();

            if (ScriptableSingleton <GameViewSizes> .instance.GetChangeID() != this.m_SizeChangeID)
            {
                this.EnsureSelectedSizeAreValid();
                this.m_SizeChangeID = ScriptableSingleton <GameViewSizes> .instance.GetChangeID();
            }
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (this.ShouldShowMultiDisplayOption())
            {
                GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.Width(80f) };
                int num = EditorGUILayout.Popup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, optionArray1);
                EditorGUILayout.Space();
                if (num != this.m_TargetDisplay)
                {
                    this.m_TargetDisplay = num;
                    this.GameViewAspectWasChanged();
                }
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(160f) };
            EditorGUILayout.GameViewSizePopup(currentSizeGroupType, this.selectedSizeIndex, new Action <int, object>(this.SelectionCallback), EditorStyles.toolbarDropDown, options);
            if (FrameDebuggerUtility.IsLocalEnabled())
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.animatedPropertyColor;
                GUILayout.Label("Frame Debugger on", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            if (RenderDoc.IsLoaded())
            {
                EditorGUI.BeginDisabledGroup(!RenderDoc.IsSupported());
                if (GUILayout.Button(this.renderdocContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                {
                    base.m_Parent.CaptureRenderDoc();
                    GUIUtility.ExitGUI();
                }
                EditorGUI.EndDisabledGroup();
            }
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, "Maximize on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, "Mute audio", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect position = GUILayoutUtility.GetRect(this.gizmosContent, s_GizmoButtonStyle);
            Rect rect2    = new Rect(position.xMax - s_GizmoButtonStyle.border.right, position.y, (float)s_GizmoButtonStyle.border.right, position.height);

            if (EditorGUI.ButtonMouseDown(rect2, GUIContent.none, FocusType.Passive, GUIStyle.none) && AnnotationWindow.ShowAtPosition(GUILayoutUtility.topLevel.GetLast(), true))
            {
                GUIUtility.ExitGUI();
            }
            this.m_Gizmos = GUI.Toggle(position, this.m_Gizmos, this.gizmosContent, s_GizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
예제 #5
0
        internal void OnGUI()
        {
            if (!FrameDebuggerWindow.ShowFrameDebuggerWindowValidate())
            {
                EditorGUILayout.HelpBox("Frame Debugger requires a Pro license", MessageType.Warning, true);
                return;
            }
            FrameDebuggerEvent[] frameEvents = FrameDebuggerUtility.GetFrameEvents();
            if (this.m_TreeViewState == null)
            {
                this.m_TreeViewState = new TreeViewState();
            }
            if (this.m_Tree == null)
            {
                this.m_Tree            = new FrameDebuggerTreeView(frameEvents, this.m_TreeViewState, this, default(Rect));
                this.m_FrameEventsHash = FrameDebuggerUtility.eventsHash;
                this.m_Tree.m_DataSource.SetExpandedWithChildren(this.m_Tree.m_DataSource.root, true);
            }
            if (FrameDebuggerUtility.eventsHash != this.m_FrameEventsHash)
            {
                this.m_Tree.m_DataSource.SetEvents(frameEvents);
                this.m_FrameEventsHash = FrameDebuggerUtility.eventsHash;
            }
            int  limit = FrameDebuggerUtility.limit;
            bool flag  = this.DrawToolbar(frameEvents);

            if (!FrameDebuggerUtility.enabled)
            {
                GUI.enabled = true;
                if (!FrameDebuggerWindow.GraphicsSupportsFrameDebugger())
                {
                    EditorGUILayout.HelpBox("Frame Debugger requires multi-threaded renderer. Usually Unity uses that; if it does not try starting with -force-gfx-mt command line argument.", MessageType.Warning, true);
                }
                EditorGUILayout.HelpBox("Frame Debugger lets you step through draw calls and see how exactly frame is rendered. Click Enable!", MessageType.Info, true);
            }
            else
            {
                float fixedHeight = EditorStyles.toolbar.fixedHeight;
                Rect  dragRect    = new Rect(this.m_ListWidth, fixedHeight, 5f, base.position.height - fixedHeight);
                dragRect         = EditorGUIUtility.HandleHorizontalSplitter(dragRect, base.position.width, 200f, 200f);
                this.m_ListWidth = dragRect.x;
                Rect rect  = new Rect(0f, fixedHeight, this.m_ListWidth, base.position.height - fixedHeight);
                Rect rect2 = new Rect(this.m_ListWidth + 4f, fixedHeight + 4f, base.position.width - this.m_ListWidth - 8f, base.position.height - fixedHeight - 8f);
                this.DrawEventsTree(rect);
                EditorGUIUtility.DrawHorizontalSplitter(dragRect);
                this.DrawCurrentEvent(rect2, frameEvents);
            }
            if (flag || limit != FrameDebuggerUtility.limit)
            {
                this.RepaintOnLimitChange();
            }
            if (this.m_RepaintFrames > 0)
            {
                this.m_Tree.SelectFrameEventIndex(FrameDebuggerUtility.limit);
                this.RepaintAllNeededThings();
                this.m_RepaintFrames--;
            }
        }
예제 #6
0
        private bool DrawEventMesh(int curEventIndex, FrameDebuggerEvent curEvent)
        {
            int frameEventMeshID = FrameDebuggerUtility.GetFrameEventMeshID(curEventIndex);

            if (frameEventMeshID == 0)
            {
                return(false);
            }
            UnityEngine.Object @object = EditorUtility.InstanceIDToObject(frameEventMeshID);
            Mesh mesh = @object as Mesh;

            if (mesh == null)
            {
                return(false);
            }
            Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[]
            {
                GUILayout.ExpandHeight(true)
            });

            if (rect.width < 64f || rect.height < 64f)
            {
                return(true);
            }
            GameObject gameObjectForEvent = FrameDebuggerWindow.GetGameObjectForEvent(curEventIndex);
            Rect       rect2 = rect;

            rect2.yMin = rect2.yMax - EditorGUIUtility.singleLineHeight * 2f;
            Rect position = rect2;

            rect2.xMin    = rect2.center.x;
            position.xMax = position.center.x;
            if (Event.current.type == EventType.MouseDown)
            {
                if (rect2.Contains(Event.current.mousePosition))
                {
                    EditorGUIUtility.PingObject(frameEventMeshID);
                    Event.current.Use();
                }
                if (gameObjectForEvent != null && position.Contains(Event.current.mousePosition))
                {
                    EditorGUIUtility.PingObject(gameObjectForEvent.GetInstanceID());
                    Event.current.Use();
                }
            }
            this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect);
            if (Event.current.type == EventType.Repaint)
            {
                int frameEventMeshSubset = FrameDebuggerUtility.GetFrameEventMeshSubset(curEventIndex);
                this.DrawMeshPreview(curEvent, rect, rect2, mesh, frameEventMeshSubset);
                if (gameObjectForEvent != null)
                {
                    EditorGUI.DropShadowLabel(position, gameObjectForEvent.name);
                }
            }
            return(true);
        }
예제 #7
0
        public static FrameDebuggerWindow ShowFrameDebuggerWindow()
        {
            FrameDebuggerWindow window = EditorWindow.GetWindow(typeof(FrameDebuggerWindow)) as FrameDebuggerWindow;

            if ((UnityEngine.Object)window != (UnityEngine.Object)null)
            {
                window.titleContent = EditorGUIUtility.TextContent("Frame Debug");
            }
            return(window);
        }
예제 #8
0
 public FrameDebuggerTreeView(FrameDebuggerEvent[] frameEvents, TreeViewState treeViewState, FrameDebuggerWindow window, Rect startRect)
 {
     this.m_FrameDebugger = window;
     this.m_TreeView = new TreeView(window, treeViewState);
     this.m_DataSource = new FDTreeViewDataSource(this.m_TreeView, frameEvents);
     FDTreeViewGUI gui = new FDTreeViewGUI(this.m_TreeView);
     this.m_TreeView.Init(startRect, this.m_DataSource, gui, null);
     this.m_TreeView.ReloadData();
     this.m_TreeView.selectionChangedCallback = (Action<int[]>) Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action<int[]>(this.SelectionChanged));
 }
예제 #9
0
        public static FrameDebuggerWindow ShowFrameDebuggerWindow()
        {
            FrameDebuggerWindow frameDebuggerWindow = EditorWindow.GetWindow(typeof(FrameDebuggerWindow)) as FrameDebuggerWindow;

            if (frameDebuggerWindow != null)
            {
                frameDebuggerWindow.titleContent = EditorGUIUtility.TextContent("Frame Debug");
            }
            return(frameDebuggerWindow);
        }
 public FrameDebuggerTreeView(FrameDebuggerEvent[] frameEvents, TreeViewState treeViewState, FrameDebuggerWindow window, Rect startRect)
 {
   this.m_FrameDebugger = window;
   this.m_TreeView = new TreeView((EditorWindow) window, treeViewState);
   this.m_DataSource = new FrameDebuggerTreeView.FDTreeViewDataSource(this.m_TreeView, frameEvents);
   FrameDebuggerTreeView.FDTreeViewGUI fdTreeViewGui = new FrameDebuggerTreeView.FDTreeViewGUI(this.m_TreeView);
   this.m_TreeView.Init(startRect, (ITreeViewDataSource) this.m_DataSource, (ITreeViewGUI) fdTreeViewGui, (ITreeViewDragging) null);
   this.m_TreeView.ReloadData();
   this.m_TreeView.selectionChangedCallback += new System.Action<int[]>(this.SelectionChanged);
 }
예제 #11
0
        public static FrameDebuggerWindow ShowFrameDebuggerWindow()
        {
            FrameDebuggerWindow window = EditorWindow.GetWindow(typeof(FrameDebuggerWindow)) as FrameDebuggerWindow;

            if (window != null)
            {
                window.titleContent = EditorGUIUtility.TextContent("Frame Debug");
                window.EnableIfNeeded();
            }
            return(window);
        }
 private void DrawConnectionDropdown(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState, out bool isEnabled)
 {
     PlayerConnectionGUILayout.ConnectionTargetSelectionDropdown(m_AttachToPlayerState, EditorStyles.toolbarDropDown);
     isEnabled = FrameDebugger.enabled;
     if (isEnabled && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID())
     {
         // Switch from local to remote debugger or vice versa
         FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
         FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
     }
 }
예제 #13
0
        public static FrameDebuggerWindow ShowFrameDebuggerWindow()
        {
            FrameDebuggerWindow frameDebuggerWindow = EditorWindow.GetWindow(typeof(FrameDebuggerWindow)) as FrameDebuggerWindow;

            if (frameDebuggerWindow != null)
            {
                frameDebuggerWindow.title = "Frame Debug";
                frameDebuggerWindow.EnableIfNeeded();
            }
            return(frameDebuggerWindow);
        }
예제 #14
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndWebplayerDefaultSizes();

            if (ScriptableSingleton <GameViewSizes> .instance.GetChangeID() != this.m_SizeChangeID)
            {
                this.EnsureSelectedSizeAreValid();
                this.m_SizeChangeID = ScriptableSingleton <GameViewSizes> .instance.GetChangeID();
            }
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (Display.MultiDisplayLicense())
            {
                this.m_TargetDisplay = EditorGUILayout.Popup(this.m_TargetDisplay, GameView.s_GameDisplays, EditorStyles.toolbarPopup, new GUILayoutOption[]
                {
                    GUILayout.Width(80f)
                });
            }
            EditorGUILayout.GameViewSizePopup(GameView.currentSizeGroupType, this.selectedSizeIndex, new Action <int, object>(this.SelectionCallback), EditorStyles.toolbarDropDown, new GUILayoutOption[]
            {
                GUILayout.Width(160f)
            });
            if (FrameDebuggerUtility.enabled)
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.animatedPropertyColor;
                GUILayout.Label("Frame Debugger on", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, "Maximize on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, "Mute audio", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect rect     = GUILayoutUtility.GetRect(this.gizmosContent, GameView.s_GizmoButtonStyle);
            Rect position = new Rect(rect.xMax - (float)GameView.s_GizmoButtonStyle.border.right, rect.y, (float)GameView.s_GizmoButtonStyle.border.right, rect.height);

            if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
            {
                Rect last = GUILayoutUtility.topLevel.GetLast();
                if (AnnotationWindow.ShowAtPosition(last, true))
                {
                    GUIUtility.ExitGUI();
                }
            }
            this.m_Gizmos = GUI.Toggle(rect, this.m_Gizmos, this.gizmosContent, GameView.s_GizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
예제 #15
0
        private bool DrawToolbar(FrameDebuggerEvent[] descs)
        {
            bool result = false;

            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup(!FrameDebuggerWindow.GraphicsSupportsFrameDebugger());
            GUILayout.Toggle(FrameDebuggerUtility.enabled, FrameDebuggerWindow.styles.recordButton, EditorStyles.toolbarButton, new GUILayoutOption[]
            {
                GUILayout.MinWidth(80f)
            });
            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                this.ClickEnableFrameDebugger();
                result = true;
            }
            GUI.enabled = FrameDebuggerUtility.enabled;
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup(FrameDebuggerUtility.count <= 1);
            int num = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, new GUILayoutOption[0]);

            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                this.ChangeFrameEventLimit(num);
            }
            GUILayout.Label(" of " + FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(num <= 1);
            if (GUILayout.Button(FrameDebuggerWindow.styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.ChangeFrameEventLimit(num - 1);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(num >= FrameDebuggerUtility.count);
            if (GUILayout.Button(FrameDebuggerWindow.styles.nextFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.ChangeFrameEventLimit(num + 1);
            }
            if (this.m_PrevEventsLimit == this.m_PrevEventsCount && FrameDebuggerUtility.count != this.m_PrevEventsCount && FrameDebuggerUtility.limit == this.m_PrevEventsLimit)
            {
                this.ChangeFrameEventLimit(FrameDebuggerUtility.count);
            }
            this.m_PrevEventsLimit = FrameDebuggerUtility.limit;
            this.m_PrevEventsCount = FrameDebuggerUtility.count;
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            return(result);
        }
예제 #16
0
 internal void OnDisable()
 {
     if (this.m_WireMaterial != null)
     {
         UnityEngine.Object.DestroyImmediate(this.m_WireMaterial, true);
     }
     if (this.m_PreviewUtility != null)
     {
         this.m_PreviewUtility.Cleanup();
         this.m_PreviewUtility = null;
     }
     FrameDebuggerWindow.s_FrameDebuggers.Remove(this);
     EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlayModeStateChanged));
     FrameDebuggerWindow.DisableFrameDebugger();
 }
        private void DrawEventLimitSlider(FrameDebuggerWindow frameDebugger, out int newLimit)
        {
            newLimit = 0;

            EditorGUI.BeginChangeCheck();

            bool wasEnabled = GUI.enabled;

            GUI.enabled = FrameDebuggerUtility.count > 1;
            newLimit    = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, 1, EditorStyles.toolbarSlider);
            GUI.enabled = wasEnabled;

            if (EditorGUI.EndChangeCheck())
            {
                frameDebugger.ChangeFrameEventLimit(newLimit);
            }
        }
        private void DrawEnableDisableButton(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState, out bool needsRepaint)
        {
            needsRepaint = false;

            EditorGUI.BeginChangeCheck();

            bool wasEnabled = GUI.enabled;

            GUI.enabled = m_AttachToPlayerState.connectedToTarget != ConnectionTarget.Editor || FrameDebuggerUtility.locallySupported;
            GUIContent button = (FrameDebugger.enabled) ? FrameDebuggerStyles.TopToolbar.recordButtonDisable : FrameDebuggerStyles.TopToolbar.recordButtonEnable;

            GUILayout.Toggle(FrameDebugger.enabled, button, EditorStyles.toolbarButtonLeft, GUILayout.MinWidth(80));
            GUI.enabled = wasEnabled;

            if (EditorGUI.EndChangeCheck())
            {
                frameDebugger.ClickEnableFrameDebugger();
                needsRepaint = true;
            }
        }
예제 #19
0
 internal void ChangeFrameEventLimit(int newLimit)
 {
     if (newLimit <= 0 || newLimit > FrameDebuggerUtility.count)
     {
         return;
     }
     if (newLimit != FrameDebuggerUtility.limit && newLimit > 0)
     {
         GameObject gameObjectForEvent = FrameDebuggerWindow.GetGameObjectForEvent(newLimit - 1);
         if (gameObjectForEvent != null)
         {
             EditorGUIUtility.PingObject(gameObjectForEvent);
         }
     }
     FrameDebuggerUtility.limit = newLimit;
     if (this.m_Tree != null)
     {
         this.m_Tree.SelectFrameEventIndex(newLimit);
     }
 }
예제 #20
0
 private void ClickEnableFrameDebugger()
 {
     if (!FrameDebuggerWindow.GraphicsSupportsFrameDebugger())
     {
         return;
     }
     if (!FrameDebuggerUtility.enabled && EditorApplication.isPlaying && !EditorApplication.isPaused)
     {
         EditorApplication.isPaused = true;
     }
     FrameDebuggerUtility.enabled = !FrameDebuggerUtility.enabled;
     if (FrameDebuggerUtility.enabled)
     {
         GameView gameView = (GameView)WindowLayout.FindEditorWindowOfType(typeof(GameView));
         if (gameView)
         {
             gameView.ShowTab();
         }
     }
     this.m_PrevEventsLimit = FrameDebuggerUtility.limit;
     this.m_PrevEventsCount = FrameDebuggerUtility.count;
 }
예제 #21
0
        private void DoToolbarGUI()
        {
            GameViewSizes.instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                var availableTypes = GetAvailableWindowTypes();
                if (availableTypes.Count > 1)
                {
                    var typeNames = availableTypes.Values.ToList();
                    var types     = availableTypes.Keys.ToList();
                    int viewIndex = EditorGUILayout.Popup(typeNames.IndexOf(titleContent.text), typeNames.ToArray(),
                                                          EditorStyles.toolbarPopup,
                                                          GUILayout.Width(90));
                    EditorGUILayout.Space();
                    if (types[viewIndex] != typeof(GameView))
                    {
                        SwapMainWindow(types[viewIndex]);
                    }
                }

                if (ModuleManager.ShouldShowMultiDisplayOption())
                {
                    int display = EditorGUILayout.Popup(targetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopupLeft, GUILayout.Width(80));
                    if (display != targetDisplay)
                    {
                        targetDisplay = display;
                        UpdateZoomAreaAndParent();
                    }
                }
                EditorGUILayout.GameViewSizePopup(currentSizeGroupType, selectedSizeIndex, this, EditorStyles.toolbarPopup, GUILayout.Width(160f));

                DoZoomSlider();
                // If the previous platform and current does not match, update the scale
                if ((int)currentSizeGroupType != prevSizeGroupType)
                {
                    UpdateZoomAreaAndParent();
                    // Update the platform to the recent one
                    prevSizeGroupType = (int)currentSizeGroupType;
                }

                if (FrameDebuggerUtility.IsLocalEnabled())
                {
                    GUILayout.FlexibleSpace();
                    Color oldCol = GUI.color;
                    // This has nothing to do with animation recording.  Can we replace this color with something else?
                    GUI.color *= AnimationMode.recordedPropertyColor;
                    GUILayout.Label(Styles.frameDebuggerOnContent, EditorStyles.toolbarLabel);
                    GUI.color = oldCol;
                    // Make frame debugger windows repaint after each time game view repaints.
                    // We want them to always display the latest & greatest game view
                    // rendering state.
                    if (Event.current.type == EventType.Repaint)
                    {
                        FrameDebuggerWindow.RepaintAll();
                    }
                }

                GUILayout.FlexibleSpace();

                if (RenderDoc.IsLoaded())
                {
                    using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                    {
                        if (GUILayout.Button(Styles.renderdocContent, EditorStyles.toolbarButton))
                        {
                            m_Parent.CaptureRenderDocScene();
                            GUIUtility.ExitGUI();
                        }
                    }
                }

                // Allow the user to select how the XR device will be rendered during "Play In Editor"
                if (PlayerSettings.virtualRealitySupported)
                {
                    int selectedRenderMode = EditorGUILayout.Popup(m_XRRenderMode, Styles.xrRenderingModes, EditorStyles.toolbarPopup, GUILayout.Width(80));
                    SetXRRenderMode(selectedRenderMode);
                }

                maximizeOnPlay = GUILayout.Toggle(maximizeOnPlay, Styles.maximizeOnPlayContent, EditorStyles.toolbarButton);

                EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, Styles.muteContent, EditorStyles.toolbarButton);

                m_Stats = GUILayout.Toggle(m_Stats, Styles.statsContent, EditorStyles.toolbarButton);

                if (EditorGUILayout.DropDownToggle(ref m_Gizmos, Styles.gizmosContent, EditorStyles.toolbarDropDownToggleRight))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    if (AnnotationWindow.ShowAtPosition(rect, true))
                    {
                        GUIUtility.ExitGUI();
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
예제 #22
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (ModuleManager.ShouldShowMultiDisplayOption())
            {
                int num = EditorGUILayout.Popup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, new GUILayoutOption[]
                {
                    GUILayout.Width(80f)
                });
                EditorGUILayout.Space();
                if (num != this.m_TargetDisplay)
                {
                    this.m_TargetDisplay = num;
                    this.UpdateZoomAreaAndParent();
                }
            }
            EditorGUILayout.GameViewSizePopup(GameView.currentSizeGroupType, this.selectedSizeIndex, this, EditorStyles.toolbarPopup, new GUILayoutOption[]
            {
                GUILayout.Width(160f)
            });
            this.DoZoomSlider();
            if (FrameDebuggerUtility.IsLocalEnabled())
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.recordedPropertyColor;
                GUILayout.Label(GameView.Styles.frameDebuggerOnContent, EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            if (RenderDoc.IsLoaded())
            {
                using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                {
                    if (GUILayout.Button(GameView.Styles.renderdocContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                    {
                        this.m_Parent.CaptureRenderDoc();
                        GUIUtility.ExitGUI();
                    }
                }
            }
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, GameView.Styles.maximizeOnPlayContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, GameView.Styles.muteContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, GameView.Styles.statsContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect rect     = GUILayoutUtility.GetRect(GameView.Styles.gizmosContent, GameView.Styles.gizmoButtonStyle);
            Rect position = new Rect(rect.xMax - (float)GameView.Styles.gizmoButtonStyle.border.right, rect.y, (float)GameView.Styles.gizmoButtonStyle.border.right, rect.height);

            if (EditorGUI.DropdownButton(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
            {
                Rect last = GUILayoutUtility.topLevel.GetLast();
                if (AnnotationWindow.ShowAtPosition(last, true))
                {
                    GUIUtility.ExitGUI();
                }
            }
            this.m_Gizmos = GUI.Toggle(rect, this.m_Gizmos, GameView.Styles.gizmosContent, GameView.Styles.gizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
예제 #23
0
        private void DoToolbarGUI()
        {
            GameViewSizes.instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                if (ModuleManager.ShouldShowMultiDisplayOption())
                {
                    int display = EditorGUILayout.Popup(m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, GUILayout.Width(80));
                    EditorGUILayout.Space();
                    if (display != m_TargetDisplay)
                    {
                        m_TargetDisplay = display;
                        UpdateZoomAreaAndParent();
                    }
                }
                EditorGUILayout.GameViewSizePopup(currentSizeGroupType, selectedSizeIndex, this, EditorStyles.toolbarPopup, GUILayout.Width(160f));

                DoZoomSlider();

                if (FrameDebuggerUtility.IsLocalEnabled())
                {
                    GUILayout.FlexibleSpace();
                    Color oldCol = GUI.color;
                    // This has nothing to do with animation recording.  Can we replace this color with something else?
                    GUI.color *= AnimationMode.recordedPropertyColor;
                    GUILayout.Label(Styles.frameDebuggerOnContent, EditorStyles.miniLabel);
                    GUI.color = oldCol;
                    // Make frame debugger windows repaint after each time game view repaints.
                    // We want them to always display the latest & greatest game view
                    // rendering state.
                    if (Event.current.type == EventType.Repaint)
                    {
                        FrameDebuggerWindow.RepaintAll();
                    }
                }

                GUILayout.FlexibleSpace();

                if (RenderDoc.IsLoaded())
                {
                    using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                    {
                        if (GUILayout.Button(Styles.renderdocContent, EditorStyles.toolbarButton))
                        {
                            m_Parent.CaptureRenderDoc();
                            GUIUtility.ExitGUI();
                        }
                    }
                }

                m_MaximizeOnPlay = GUILayout.Toggle(m_MaximizeOnPlay, Styles.maximizeOnPlayContent, EditorStyles.toolbarButton);
                EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, Styles.muteContent, EditorStyles.toolbarButton);
                m_Stats = GUILayout.Toggle(m_Stats, Styles.statsContent, EditorStyles.toolbarButton);

                Rect r         = GUILayoutUtility.GetRect(Styles.gizmosContent, Styles.gizmoButtonStyle);
                Rect rightRect = new Rect(r.xMax - Styles.gizmoButtonStyle.border.right, r.y, Styles.gizmoButtonStyle.border.right, r.height);
                if (EditorGUI.DropdownButton(rightRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    if (AnnotationWindow.ShowAtPosition(rect, true))
                    {
                        GUIUtility.ExitGUI();
                    }
                }
                m_Gizmos = GUI.Toggle(r, m_Gizmos, Styles.gizmosContent, Styles.gizmoButtonStyle);
            }
            GUILayout.EndHorizontal();
        }
예제 #24
0
 internal void OnDidOpenScene()
 {
     FrameDebuggerWindow.DisableFrameDebugger();
 }