private void ClickEnableFrameDebugger() { bool flag = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled(); bool flag2 = !flag && this.m_AttachProfilerUI.IsEditor(); if (!flag2 || FrameDebuggerUtility.locallySupported) { if (flag2) { if (EditorApplication.isPlaying && !EditorApplication.isPaused) { EditorApplication.isPaused = true; } } if (!flag) { FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler); } else { FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); } if (FrameDebuggerUtility.IsLocalEnabled()) { GameView gameView = (GameView)WindowLayout.FindEditorWindowOfType(typeof(GameView)); if (gameView) { gameView.ShowTab(); } } this.m_PrevEventsLimit = FrameDebuggerUtility.limit; this.m_PrevEventsCount = FrameDebuggerUtility.count; } }
private void DrawStates() { FrameDebuggerBlendState frameBlendState = FrameDebuggerUtility.GetFrameBlendState(); FrameDebuggerRasterState frameRasterState = FrameDebuggerUtility.GetFrameRasterState(); FrameDebuggerDepthState frameDepthState = FrameDebuggerUtility.GetFrameDepthState(); string str = string.Empty; if (frameBlendState.renderTargetWriteMask == 0) { str = "0"; } else { if ((frameBlendState.renderTargetWriteMask & 2) != 0) { str = str + "R"; } if ((frameBlendState.renderTargetWriteMask & 4) != 0) { str = str + "G"; } if ((frameBlendState.renderTargetWriteMask & 8) != 0) { str = str + "B"; } if ((frameBlendState.renderTargetWriteMask & 1) != 0) { str = str + "A"; } } object[] args = new object[] { frameBlendState.srcBlend, frameBlendState.dstBlend, frameBlendState.srcBlendAlpha, frameBlendState.dstBlendAlpha, str }; GUILayout.Label(string.Format("Blend {0} {1}, {2} {3} ColorMask {4}", args), EditorStyles.miniLabel, new GUILayoutOption[0]); object[] objArray2 = new object[] { frameDepthState.depthFunc, (frameDepthState.depthWrite != 0) ? "On" : "Off", frameRasterState.cullMode, frameRasterState.slopeScaledDepthBias, frameRasterState.depthBias }; GUILayout.Label(string.Format("ZTest {0} ZWrite {1} Cull {2} Offset {3}, {4}", objArray2), EditorStyles.miniLabel, new GUILayoutOption[0]); }
private void DrawCurrentEvent(Rect rect, FrameDebuggerEvent[] descs) { int num = FrameDebuggerUtility.limit - 1; if (num >= 0 && num < descs.Length) { GUILayout.BeginArea(rect); FrameDebuggerEvent frameDebuggerEvent = descs[num]; FrameDebuggerEventData frameDebuggerEventData; bool frameEventData = FrameDebuggerUtility.GetFrameEventData(num, out frameDebuggerEventData); if (frameEventData) { this.DrawRenderTargetControls(frameDebuggerEventData); } GUILayout.Label(string.Format("Event #{0}: {1}", num + 1, FrameDebuggerWindow.s_FrameEventTypeNames[(int)frameDebuggerEvent.type]), EditorStyles.boldLabel, new GUILayoutOption[0]); if (FrameDebuggerUtility.IsRemoteEnabled() && FrameDebuggerUtility.receivingRemoteFrameEventData) { GUILayout.Label("Receiving frame event data...", new GUILayoutOption[0]); } else if (frameEventData) { if (frameDebuggerEventData.vertexCount > 0 || frameDebuggerEventData.indexCount > 0) { this.DrawEventDrawCallInfo(frameDebuggerEventData); } else if (frameDebuggerEvent.type == FrameEventType.ComputeDispatch) { this.DrawEventComputeDispatchInfo(frameDebuggerEventData); } } GUILayout.EndArea(); } }
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(); }
private static void DisableFrameDebugger() { if (FrameDebuggerUtility.IsLocalEnabled()) { EditorApplication.SetSceneRepaintDirty(); } FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); }
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 flag1 = false; bool flag2 = !this.m_AttachProfilerUI.IsEditor() || FrameDebuggerUtility.locallySupported; GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(!flag2); GUILayout.Toggle((FrameDebuggerUtility.IsLocalEnabled() ? 1 : (FrameDebuggerUtility.IsRemoteEnabled() ? 1 : 0)) != 0, FrameDebuggerWindow.styles.recordButton, EditorStyles.toolbarButton, new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); EditorGUI.EndDisabledGroup(); if (EditorGUI.EndChangeCheck()) { this.ClickEnableFrameDebugger(); flag1 = true; } this.m_AttachProfilerUI.OnGUILayout((EditorWindow)this); bool flag3 = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled(); if (flag3 && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID()) { FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler); } GUI.enabled = flag3; EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(FrameDebuggerUtility.count <= 1); int newLimit = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count); EditorGUI.EndDisabledGroup(); if (EditorGUI.EndChangeCheck()) { this.ChangeFrameEventLimit(newLimit); } GUILayout.Label(" of " + (object)FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]); EditorGUI.BeginDisabledGroup(newLimit <= 1); if (GUILayout.Button(FrameDebuggerWindow.styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.ChangeFrameEventLimit(newLimit - 1); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(newLimit >= FrameDebuggerUtility.count); if (GUILayout.Button(FrameDebuggerWindow.styles.nextFrame, EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.ChangeFrameEventLimit(newLimit + 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(flag1); }
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); }
private static void DisableFrameDebugger() { // if it was true before, we disabled and ask the game scene to repaint if (FrameDebugger.IsLocalEnabled()) { EditorApplication.SetSceneRepaintDirty(); } FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); }
private bool DrawEventMesh(FrameDebuggerEventData curEventData) { Mesh mesh = curEventData.mesh; bool result; if (mesh == null) { result = false; } else { Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); if (rect.width < 64f || rect.height < 64f) { result = true; } else { GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(curEventData.frameEventIndex); 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(mesh); Event.current.Use(); } if (frameEventGameObject != null && position.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(frameEventGameObject.GetInstanceID()); Event.current.Use(); } } this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect); if (Event.current.type == EventType.Repaint) { int meshSubset = curEventData.meshSubset; this.DrawMeshPreview(curEventData, rect, rect2, mesh, meshSubset); if (frameEventGameObject != null) { EditorGUI.DropShadowLabel(position, frameEventGameObject.name); } } result = true; } } return(result); }
internal static GameObject GetGameObjectForEvent(int eventIndex) { GameObject gameObject = null; Component component = EditorUtility.InstanceIDToObject(FrameDebuggerUtility.GetFrameEventRendererID(eventIndex)) as Component; if (component != null) { gameObject = component.gameObject; } return(gameObject); }
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); } }
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; }
public void EnableIfNeeded() { if (!FrameDebuggerUtility.IsLocalEnabled() && !FrameDebuggerUtility.IsRemoteEnabled()) { this.m_RTChannel = 0; this.m_RTIndex = 0; this.m_RTBlackLevel = 0f; this.m_RTWhiteLevel = 1f; this.ClickEnableFrameDebugger(); this.RepaintOnLimitChange(); } }
internal static GameObject GetGameObjectForEvent(int eventIndex) { GameObject result = null; int frameEventRendererID = FrameDebuggerUtility.GetFrameEventRendererID(eventIndex); Component component = EditorUtility.InstanceIDToObject(frameEventRendererID) as Component; if (component != null) { result = component.gameObject; } return(result); }
private bool DrawEventMesh(int curEventIndex, FrameDebuggerEvent curEvent) { int frameEventMeshID = FrameDebuggerUtility.GetFrameEventMeshID(curEventIndex); if (frameEventMeshID == 0) { return(false); } Mesh mesh = EditorUtility.InstanceIDToObject(frameEventMeshID) as Mesh; if (mesh == null) { return(false); } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandHeight(true) }; Rect position = GUILayoutUtility.GetRect((float)10f, (float)10f, options); if ((position.width >= 64f) && (position.height >= 64f)) { GameObject gameObjectForEvent = GetGameObjectForEvent(curEventIndex); Rect meshInfoRect = position; meshInfoRect.yMin = meshInfoRect.yMax - (EditorGUIUtility.singleLineHeight * 2f); Rect rect3 = meshInfoRect; meshInfoRect.xMin = meshInfoRect.center.x; rect3.xMax = rect3.center.x; if (Event.current.type == EventType.MouseDown) { if (meshInfoRect.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(frameEventMeshID); Event.current.Use(); } if ((gameObjectForEvent != null) && rect3.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(gameObjectForEvent.GetInstanceID()); Event.current.Use(); } } this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, position); if (Event.current.type == EventType.Repaint) { int frameEventMeshSubset = FrameDebuggerUtility.GetFrameEventMeshSubset(curEventIndex); this.DrawMeshPreview(curEvent, position, meshInfoRect, mesh, frameEventMeshSubset); if (gameObjectForEvent != null) { EditorGUI.DropShadowLabel(rect3, gameObjectForEvent.name); } } } return(true); }
public Styles() { this.rowTextRight.alignment = TextAnchor.MiddleRight; this.recordButton.text = "Enable"; this.recordButton.tooltip = "Enable Frame Debugging"; this.prevFrame.tooltip = "Previous event"; this.nextFrame.tooltip = "Next event"; this.headerContent = new GUIContent[FrameDebuggerWindow.Styles.s_ColumnNames.Length]; for (int i = 0; i < this.headerContent.Length; i++) { this.headerContent[i] = EditorGUIUtility.TextContent(FrameDebuggerWindow.Styles.s_ColumnNames[i]); } this.batchBreakCauses = FrameDebuggerUtility.GetBatchBreakCauseStrings(); }
private bool DrawEventMesh(FrameDebuggerEventData curEventData) { Mesh mesh = curEventData.mesh; if ((UnityEngine.Object)mesh == (UnityEngine.Object)null) { return(false); } Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[1] { GUILayout.ExpandHeight(true) }); if ((double)rect.width < 64.0 || (double)rect.height < 64.0) { return(true); } GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(curEventData.frameEventIndex); Rect meshInfoRect = rect; meshInfoRect.yMin = meshInfoRect.yMax - EditorGUIUtility.singleLineHeight * 2f; Rect position = meshInfoRect; meshInfoRect.xMin = meshInfoRect.center.x; position.xMax = position.center.x; if (Event.current.type == EventType.MouseDown) { if (meshInfoRect.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject((UnityEngine.Object)mesh); Event.current.Use(); } if ((UnityEngine.Object)frameEventGameObject != (UnityEngine.Object)null && position.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(frameEventGameObject.GetInstanceID()); Event.current.Use(); } } this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect); if (Event.current.type == EventType.Repaint) { int meshSubset = curEventData.meshSubset; this.DrawMeshPreview(curEventData, rect, meshInfoRect, mesh, meshSubset); if ((UnityEngine.Object)frameEventGameObject != (UnityEngine.Object)null) { EditorGUI.DropShadowLabel(position, frameEventGameObject.name); } } return(true); }
private void DrawCurrentEvent(Rect rect, FrameDebuggerEvent[] descs) { int num = FrameDebuggerUtility.limit - 1; if (num < 0 || num >= descs.Length) { return; } GUILayout.BeginArea(rect); FrameDebuggerEvent frameDebuggerEvent = descs[num]; this.DrawRenderTargetControls(frameDebuggerEvent); GUILayout.Label(string.Format("Event #{0}: {1}", num + 1, FrameDebuggerWindow.s_FrameEventTypeNames[(int)frameDebuggerEvent.type]), EditorStyles.boldLabel, new GUILayoutOption[0]); if (frameDebuggerEvent.vertexCount > 0 || frameDebuggerEvent.indexCount > 0) { int frameEventShaderID = FrameDebuggerUtility.GetFrameEventShaderID(num); if (frameEventShaderID != 0) { Shader shader = EditorUtility.InstanceIDToObject(frameEventShaderID) as Shader; if (shader != null) { int frameEventShaderPassIndex = FrameDebuggerUtility.GetFrameEventShaderPassIndex(num); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button(string.Concat(new object[] { "Shader: ", shader.name, " pass #", frameEventShaderPassIndex }), GUI.skin.label, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { EditorGUIUtility.PingObject(shader); Event.current.Use(); } GUILayout.Label(FrameDebuggerUtility.GetFrameEventShaderKeywords(num), EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.EndHorizontal(); } } if (!this.DrawEventMesh(num, frameDebuggerEvent)) { GUILayout.Label("Vertices: " + frameDebuggerEvent.vertexCount, new GUILayoutOption[0]); GUILayout.Label("Indices: " + frameDebuggerEvent.indexCount, new GUILayoutOption[0]); } } GUILayout.EndArea(); }
internal void ChangeFrameEventLimit(int newLimit) { if (newLimit > 0 && newLimit <= FrameDebuggerUtility.count) { if (newLimit != FrameDebuggerUtility.limit && newLimit > 0) { GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(newLimit - 1); if (frameEventGameObject != null) { EditorGUIUtility.PingObject(frameEventGameObject); } } FrameDebuggerUtility.limit = newLimit; if (this.m_Tree != null) { this.m_Tree.SelectFrameEventIndex(newLimit); } } }
private void DrawCurrentEvent(Rect rect, FrameDebuggerEvent[] descs) { int index = FrameDebuggerUtility.limit - 1; if ((index >= 0) && (index < descs.Length)) { GUILayout.BeginArea(rect); FrameDebuggerEvent cur = descs[index]; this.DrawRenderTargetControls(cur); GUILayout.Label(string.Format("Event #{0}: {1}", index + 1, s_FrameEventTypeNames[(int)cur.type]), EditorStyles.boldLabel, new GUILayoutOption[0]); if ((cur.vertexCount > 0) || (cur.indexCount > 0)) { int frameEventShaderID = FrameDebuggerUtility.GetFrameEventShaderID(index); if (frameEventShaderID != 0) { Shader shader = EditorUtility.InstanceIDToObject(frameEventShaderID) as Shader; if (shader != null) { int frameEventShaderPassIndex = FrameDebuggerUtility.GetFrameEventShaderPassIndex(index); GUILayout.BeginHorizontal(new GUILayoutOption[0]); object[] objArray1 = new object[] { "Shader: ", shader.name, " pass #", frameEventShaderPassIndex }; GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) }; if (GUILayout.Button(string.Concat(objArray1), GUI.skin.label, options)) { EditorGUIUtility.PingObject(shader); Event.current.Use(); } GUILayout.Label(FrameDebuggerUtility.GetFrameEventShaderKeywords(index), EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.EndHorizontal(); this.DrawStates(); } } if (!this.DrawEventMesh(index, cur)) { GUILayout.Label("Vertices: " + cur.vertexCount, new GUILayoutOption[0]); GUILayout.Label("Indices: " + cur.indexCount, new GUILayoutOption[0]); } } GUILayout.EndArea(); } }
internal void ChangeFrameEventLimit(int newLimit) { if (newLimit <= 0 || newLimit > FrameDebuggerUtility.count) { return; } if (newLimit != FrameDebuggerUtility.limit && newLimit > 0) { GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(newLimit - 1); if ((UnityEngine.Object)frameEventGameObject != (UnityEngine.Object)null) { EditorGUIUtility.PingObject((UnityEngine.Object)frameEventGameObject); } } FrameDebuggerUtility.limit = newLimit; if (this.m_Tree == null) { return; } this.m_Tree.SelectFrameEventIndex(newLimit); }
internal void ClickEnableFrameDebugger() { bool isEnabled = FrameDebugger.enabled; bool enablingLocally = !isEnabled && m_AttachToPlayerState.connectedToTarget == ConnectionTarget.Editor; if (enablingLocally && !FrameDebuggerUtility.locallySupported) { return; } // pause play mode if needed if (enablingLocally) { if (EditorApplication.isPlaying && !EditorApplication.isPaused) { EditorApplication.isPaused = true; } } if (!isEnabled) { FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler); } else { FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); } // Make sure game view is visible when enabling frame debugger locally if (FrameDebugger.IsLocalEnabled()) { PlayModeView playModeView = PlayModeView.GetMainPlayModeView(); if (playModeView) { playModeView.ShowTab(); } } }
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(); }
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(); }
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(); }
private void OnGUI() { FrameDebuggerEvent[] descs = FrameDebuggerUtility.GetFrameEvents(); Initialize(descs); int oldLimit = FrameDebuggerUtility.limit; Profiler.BeginSample("DrawToolbar"); bool repaint = m_Toolbar.DrawToolbar(this, m_AttachToPlayerState); Profiler.EndSample(); if (IsDisabledInEditor) { GUI.enabled = true; if (!FrameDebuggerUtility.locallySupported) { string warningMessage = (FrameDebuggerHelper.IsOnLinuxOpenGL) ? FrameDebuggerStyles.EventDetails.warningLinuxOpenGLMsg : FrameDebuggerStyles.EventDetails.warningMultiThreadedMsg; EditorGUILayout.HelpBox(warningMessage, MessageType.Warning, true); } EditorGUILayout.HelpBox(FrameDebuggerStyles.EventDetails.descriptionString, MessageType.Info, true); } else { if (FrameDebugger.IsLocalEnabled()) { PlayModeView playModeView = PlayModeView.GetMainPlayModeView(); if (playModeView) { playModeView.ShowTab(); } } // captured frame event contents have changed, rebuild the tree data if (HasEventHashChanged) { m_TreeView.m_DataSource.SetEvents(descs); m_FrameEventsHash = FrameDebuggerUtility.eventsHash; } float toolbarHeight = EditorStyles.toolbar.fixedHeight; Rect dragRect = new Rect(m_TreeWidth, toolbarHeight, FrameDebuggerStyles.Window.k_ResizerWidth, position.height - toolbarHeight); dragRect = EditorGUIUtility.HandleHorizontalSplitter(dragRect, position.width, FrameDebuggerStyles.Window.k_MinTreeWidth, FrameDebuggerStyles.Window.k_MinDetailsWidth); m_TreeWidth = dragRect.x; // Search area m_SearchRect = EditorGUILayout.GetControlRect(); m_SearchRect.width = m_TreeWidth - 5; DrawSearchField(m_SearchString); Rect listRect = new Rect( 0, toolbarHeight + m_SearchRect.y, m_TreeWidth, position.height - toolbarHeight - m_SearchRect.height - 5 ); Rect currentEventRect = new Rect( m_TreeWidth, toolbarHeight, position.width - m_TreeWidth, position.height - toolbarHeight ); Profiler.BeginSample("DrawTree"); m_TreeView.m_TreeView.searchString = m_SearchString; m_TreeView.DrawTree(listRect); Profiler.EndSample(); EditorGUIUtility.DrawHorizontalSplitter(dragRect); Profiler.BeginSample("DrawEvent"); m_EventDetailsView.DrawEvent(currentEventRect, descs, m_AttachToPlayerState.connectedToTarget == ConnectionTarget.Editor); Profiler.EndSample(); } if (repaint || oldLimit != FrameDebuggerUtility.limit) { RepaintOnLimitChange(); } if (m_RepaintFrames > 0) { m_TreeView.SelectFrameEventIndex(FrameDebuggerUtility.limit); RepaintAllNeededThings(); --m_RepaintFrames; } }
private void DrawRenderTargetControls(FrameDebuggerEvent cur) { if ((cur.rtWidth > 0) && (cur.rtHeight > 0)) { bool disabled = (cur.rtFormat == 1) || (cur.rtFormat == 3); bool flag2 = cur.rtHasDepthTexture != 0; short rtCount = cur.rtCount; if (flag2) { rtCount = (short)(rtCount + 1); } GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(rtCount <= 1); GUIContent[] displayedOptions = new GUIContent[rtCount]; for (int i = 0; i < cur.rtCount; i++) { displayedOptions[i] = Styles.mrtLabels[i]; } if (flag2) { displayedOptions[cur.rtCount] = Styles.depthLabel; } int num3 = Mathf.Clamp(this.m_RTIndex, 0, rtCount - 1); bool flag3 = num3 != this.m_RTIndex; this.m_RTIndex = num3; GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(70f) }; this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, displayedOptions, EditorStyles.toolbarPopup, options); EditorGUI.EndDisabledGroup(); GUILayout.Space(10f); EditorGUI.BeginDisabledGroup(disabled); GUILayout.Label(Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]); EditorGUI.EndDisabledGroup(); GUILayout.Space(10f); GUILayout.Label(Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MaxWidth(200f) }; EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0f, 1f, optionArray2); if (EditorGUI.EndChangeCheck() || flag3) { Vector4 zero = Vector4.zero; if (this.m_RTChannel == 1) { zero.x = 1f; } else if (this.m_RTChannel == 2) { zero.y = 1f; } else if (this.m_RTChannel == 3) { zero.z = 1f; } else if (this.m_RTChannel == 4) { zero.w = 1f; } else { zero = Vector4.one; } int rTIndex = this.m_RTIndex; if (rTIndex >= cur.rtCount) { rTIndex = -1; } FrameDebuggerUtility.SetRenderTargetDisplayOptions(rTIndex, zero, this.m_RTBlackLevel, this.m_RTWhiteLevel); this.RepaintAllNeededThings(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label(string.Format("{0}x{1} {2}", cur.rtWidth, cur.rtHeight, (RenderTextureFormat)cur.rtFormat), new GUILayoutOption[0]); if (cur.rtDim == 4) { GUILayout.Label("Rendering into cubemap", new GUILayoutOption[0]); } if ((cur.rtFormat == 3) && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9")) { EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true); } } }
private bool DrawToolbar(FrameDebuggerEvent[] descs) { bool result = false; bool flag = !this.m_AttachProfilerUI.IsEditor() || FrameDebuggerUtility.locallySupported; GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); using (new EditorGUI.DisabledScope(!flag)) { GUILayout.Toggle(FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled(), FrameDebuggerWindow.styles.recordButton, EditorStyles.toolbarButton, new GUILayoutOption[] { GUILayout.MinWidth(80f) }); } if (EditorGUI.EndChangeCheck()) { this.ClickEnableFrameDebugger(); result = true; } this.m_AttachProfilerUI.OnGUILayout(this); bool flag2 = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled(); if (flag2 && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID()) { FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler); } GUI.enabled = flag2; EditorGUI.BeginChangeCheck(); int num; using (new EditorGUI.DisabledScope(FrameDebuggerUtility.count <= 1)) { num = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, new GUILayoutOption[0]); } if (EditorGUI.EndChangeCheck()) { this.ChangeFrameEventLimit(num); } GUILayout.Label(" of " + FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(num <= 1)) { if (GUILayout.Button(FrameDebuggerWindow.styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.ChangeFrameEventLimit(num - 1); } } using (new EditorGUI.DisabledScope(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) { if (FrameDebuggerUtility.count != this.m_PrevEventsCount && FrameDebuggerUtility.limit == this.m_PrevEventsLimit) { this.ChangeFrameEventLimit(FrameDebuggerUtility.count); } } this.m_PrevEventsLimit = FrameDebuggerUtility.limit; this.m_PrevEventsCount = FrameDebuggerUtility.count; } GUILayout.EndHorizontal(); return(result); }
private void DrawRenderTargetControls(FrameDebuggerEventData cur) { if (cur.rtWidth > 0 && cur.rtHeight > 0) { bool disabled = cur.rtFormat == 1 || cur.rtFormat == 3; bool flag = cur.rtHasDepthTexture != 0; short num = cur.rtCount; if (flag) { num += 1; } EditorGUILayout.LabelField("RenderTarget", cur.rtName, new GUILayoutOption[0]); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); bool flag2; using (new EditorGUI.DisabledScope(num <= 1)) { GUIContent[] array = new GUIContent[(int)num]; for (int i = 0; i < (int)cur.rtCount; i++) { array[i] = FrameDebuggerWindow.Styles.mrtLabels[i]; } if (flag) { array[(int)cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel; } int num2 = Mathf.Clamp(this.m_RTIndex, 0, (int)(num - 1)); flag2 = (num2 != this.m_RTIndex); this.m_RTIndex = num2; this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, array, EditorStyles.toolbarPopup, new GUILayoutOption[] { GUILayout.Width(70f) }); } GUILayout.Space(10f); using (new EditorGUI.DisabledScope(disabled)) { GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]); } GUILayout.Space(10f); GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0f, 1f, new GUILayoutOption[] { GUILayout.MaxWidth(200f) }); if (EditorGUI.EndChangeCheck() || flag2) { Vector4 channels = Vector4.zero; if (this.m_RTChannel == 1) { channels.x = 1f; } else if (this.m_RTChannel == 2) { channels.y = 1f; } else if (this.m_RTChannel == 3) { channels.z = 1f; } else if (this.m_RTChannel == 4) { channels.w = 1f; } else { channels = Vector4.one; } int num3 = this.m_RTIndex; if (num3 >= (int)cur.rtCount) { num3 = -1; } FrameDebuggerUtility.SetRenderTargetDisplayOptions(num3, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel); this.RepaintAllNeededThings(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label(string.Format("{0}x{1} {2}", cur.rtWidth, cur.rtHeight, (RenderTextureFormat)cur.rtFormat), new GUILayoutOption[0]); if (cur.rtDim == 4) { GUILayout.Label("Rendering into cubemap", new GUILayoutOption[0]); } if (cur.rtFormat == 3 && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9")) { EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true); } } }