private static GraphicsSupportsFrameDebugger ( ) : bool | ||
return | bool |
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--; } }
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); }
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; }