예제 #1
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--;
            }
        }
예제 #2
0
        internal void OnGUI()
        {
            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, new 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.IsLocalEnabled() && !FrameDebuggerUtility.IsRemoteEnabled() && this.m_AttachProfilerUI.IsEditor())
            {
                GUI.enabled = true;
                if (!FrameDebuggerUtility.locallySupported)
                {
                    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    = EditorGUIUtility.HandleHorizontalSplitter(new Rect(this.m_ListWidth, fixedHeight, 5f, this.position.height - fixedHeight), this.position.width, 200f, 200f);
                this.m_ListWidth = dragRect.x;
                Rect rect1 = new Rect(0.0f, fixedHeight, this.m_ListWidth, this.position.height - fixedHeight);
                Rect rect2 = new Rect(this.m_ListWidth + 4f, fixedHeight + 4f, (float)((double)this.position.width - (double)this.m_ListWidth - 8.0), (float)((double)this.position.height - (double)fixedHeight - 8.0));
                this.DrawEventsTree(rect1);
                EditorGUIUtility.DrawHorizontalSplitter(dragRect);
                this.DrawCurrentEvent(rect2, frameEvents);
            }
            if (flag || limit != FrameDebuggerUtility.limit)
            {
                this.RepaintOnLimitChange();
            }
            if (this.m_RepaintFrames <= 0)
            {
                return;
            }
            this.m_Tree.SelectFrameEventIndex(FrameDebuggerUtility.limit);
            this.RepaintAllNeededThings();
            --this.m_RepaintFrames;
        }
예제 #3
0
        private void Initialize(FrameDebuggerEvent[] descs)
        {
            if (m_Toolbar == null)
            {
                m_Toolbar = new FrameDebuggerToolbarView();
            }

            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            if (m_TreeView == null)
            {
                m_TreeView = new FrameDebuggerTreeView(descs, m_TreeViewState, this, new Rect(
                                                           50,
                                                           50,
                                                           500, 100
                                                           ));
                m_FrameEventsHash = FrameDebuggerUtility.eventsHash;
                m_TreeView.m_DataSource.SetExpanded(m_TreeView.m_DataSource.root, true);

                // Expand root's children only
                foreach (var treeViewItem in m_TreeView.m_DataSource.root.children)
                {
                    if (treeViewItem != null)
                    {
                        m_TreeView.m_DataSource.SetExpanded(treeViewItem, true);
                    }
                }
            }

            if (m_EventDetailsView == null)
            {
                m_EventDetailsView = new FrameDebuggerEventDetailsView(this);
            }
        }