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);
 }
 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));
 }
		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 void DrawMeshPreview(FrameDebuggerEvent curEvent, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
		{
			if (this.m_PreviewUtility == null)
			{
				this.m_PreviewUtility = new PreviewRenderUtility();
				this.m_PreviewUtility.m_CameraFieldOfView = 30f;
			}
			if (this.m_Material == null)
			{
				this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material);
			}
			if (this.m_WireMaterial == null)
			{
				this.m_WireMaterial = new Material(ModelInspector.WireframeShaderSource);
				this.m_WireMaterial.hideFlags = HideFlags.HideAndDontSave;
				this.m_WireMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
			}
			this.m_PreviewUtility.BeginPreview(previewRect, "preBackground");
			ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
			Texture image = this.m_PreviewUtility.EndPreview();
			GUI.DrawTexture(previewRect, image, ScaleMode.StretchToFill, false);
			string text = mesh.name;
			if (string.IsNullOrEmpty(text))
			{
				text = "<no name>";
			}
			string text2 = string.Concat(new object[]
			{
				text,
				" subset ",
				meshSubset,
				"\n",
				curEvent.vertexCount,
				" verts, ",
				curEvent.indexCount,
				" indices"
			});
			EditorGUI.DropShadowLabel(meshInfoRect, text2);
		}
		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 DrawCurrentEvent(Rect rect, FrameDebuggerEvent[] descs)
 {
   int index = FrameDebuggerUtility.limit - 1;
   if (index < 0 || index >= descs.Length)
     return;
   GUILayout.BeginArea(rect);
   FrameDebuggerEvent desc = descs[index];
   FrameDebuggerEventData frameDebuggerEventData;
   bool frameEventData = FrameDebuggerUtility.GetFrameEventData(index, out frameDebuggerEventData);
   if (frameEventData)
     this.DrawRenderTargetControls(frameDebuggerEventData);
   GUILayout.Label(string.Format("Event #{0}: {1}", (object) (index + 1), (object) FrameDebuggerWindow.s_FrameEventTypeNames[(int) desc.type]), EditorStyles.boldLabel, new GUILayoutOption[0]);
   if (FrameDebuggerUtility.IsRemoteEnabled() && FrameDebuggerUtility.receivingRemoteFrameEventData)
     GUILayout.Label("Receiving frame event data...");
   else if (frameEventData && (frameDebuggerEventData.vertexCount > 0 || frameDebuggerEventData.indexCount > 0))
   {
     Shader shader = frameDebuggerEventData.shader;
     int shaderPassIndex = frameDebuggerEventData.shaderPassIndex;
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Shader: " + frameDebuggerEventData.shaderName + " pass #" + (object) shaderPassIndex, GUI.skin.label, new GUILayoutOption[1]{ GUILayout.ExpandWidth(false) }))
     {
       EditorGUIUtility.PingObject((UnityEngine.Object) shader);
       Event.current.Use();
     }
     GUILayout.Label(frameDebuggerEventData.shaderKeywords, EditorStyles.miniLabel, new GUILayoutOption[0]);
     GUILayout.EndHorizontal();
     this.DrawStates(frameDebuggerEventData);
     GUILayout.Space(15f);
     this.m_AdditionalInfo = (ShowAdditionalInfo) GUILayout.Toolbar((int) this.m_AdditionalInfo, this.m_AdditionalInfoGuiContents);
     switch (this.m_AdditionalInfo)
     {
       case ShowAdditionalInfo.Preview:
         if (frameEventData && !this.DrawEventMesh(frameDebuggerEventData))
         {
           GUILayout.Label("Vertices: " + (object) frameDebuggerEventData.vertexCount);
           GUILayout.Label("Indices: " + (object) frameDebuggerEventData.indexCount);
           break;
         }
         break;
       case ShowAdditionalInfo.ShaderProperties:
         if (frameEventData)
         {
           this.DrawShaderProperties(frameDebuggerEventData.shaderProperties);
           break;
         }
         break;
     }
   }
   GUILayout.EndArea();
 }
 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;
     }
     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 FDTreeViewDataSource(TreeView treeView, FrameDebuggerEvent[] frameEvents)
   : base(treeView)
 {
   this.m_FrameEvents = frameEvents;
   this.rootIsCollapsable = false;
   this.showRootNode = false;
 }
示例#10
0
 public void SetEvents(FrameDebuggerEvent[] frameEvents)
 {
     bool flag = (this.m_FrameEvents == null) || (this.m_FrameEvents.Length < 1);
     this.m_FrameEvents = frameEvents;
     base.m_NeedRefreshVisibleFolders = true;
     this.ReloadData();
     if (flag)
     {
         this.SetExpandedWithChildren(base.m_RootItem, true);
     }
 }
示例#11
0
 private bool DrawToolbar(FrameDebuggerEvent[] descs)
 {
     bool flag = false;
     GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
     EditorGUI.BeginChangeCheck();
     EditorGUI.BeginDisabledGroup(!GraphicsSupportsFrameDebugger());
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(80f) };
     GUILayout.Toggle(FrameDebuggerUtility.enabled, styles.recordButton, EditorStyles.toolbarButton, options);
     EditorGUI.EndDisabledGroup();
     if (EditorGUI.EndChangeCheck())
     {
         this.ClickEnableFrameDebugger();
         flag = true;
     }
     GUI.enabled = FrameDebuggerUtility.enabled;
     EditorGUI.BeginChangeCheck();
     EditorGUI.BeginDisabledGroup(FrameDebuggerUtility.count <= 1);
     int newLimit = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, new GUILayoutOption[0]);
     EditorGUI.EndDisabledGroup();
     if (EditorGUI.EndChangeCheck())
     {
         this.ChangeFrameEventLimit(newLimit);
     }
     GUILayout.Label(" of " + FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]);
     EditorGUI.BeginDisabledGroup(newLimit <= 1);
     if (GUILayout.Button(styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         this.ChangeFrameEventLimit(newLimit - 1);
     }
     EditorGUI.EndDisabledGroup();
     EditorGUI.BeginDisabledGroup(newLimit >= FrameDebuggerUtility.count);
     if (GUILayout.Button(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 flag;
 }
示例#12
0
 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);
         }
     }
 }
示例#13
0
 private void DrawMeshPreview(FrameDebuggerEvent curEvent, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
 {
     if (this.m_PreviewUtility == null)
     {
         this.m_PreviewUtility = new PreviewRenderUtility();
         this.m_PreviewUtility.m_CameraFieldOfView = 30f;
     }
     if (this.m_Material == null)
     {
         this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material;
     }
     if (this.m_WireMaterial == null)
     {
         this.m_WireMaterial = ModelInspector.CreateWireframeMaterial();
     }
     this.m_PreviewUtility.BeginPreview(previewRect, "preBackground");
     ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
     this.m_PreviewUtility.EndAndDrawPreview(previewRect);
     string name = mesh.name;
     if (string.IsNullOrEmpty(name))
     {
         name = "<no name>";
     }
     object[] objArray1 = new object[] { name, " subset ", meshSubset, "\n", curEvent.vertexCount, " verts, ", curEvent.indexCount, " indices" };
     string text = string.Concat(objArray1);
     EditorGUI.DropShadowLabel(meshInfoRect, text);
 }
		private void DrawRenderTargetControls(FrameDebuggerEvent cur)
		{
			if (cur.rtWidth <= 0 || cur.rtHeight <= 0)
			{
				return;
			}
			bool disabled = cur.rtFormat == 1 || cur.rtFormat == 3;
			bool flag = cur.rtHasDepthTexture != 0;
			short num = cur.rtCount;
			if (flag)
			{
				num += 1;
			}
			GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]);
			GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
			EditorGUI.BeginChangeCheck();
			EditorGUI.BeginDisabledGroup(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));
			bool 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)
			});
			EditorGUI.EndDisabledGroup();
			GUILayout.Space(10f);
			EditorGUI.BeginDisabledGroup(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]);
			EditorGUI.EndDisabledGroup();
			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);
			}
		}
 public void SetEvents(FrameDebuggerEvent[] frameEvents)
 {
   bool flag = this.m_FrameEvents == null || this.m_FrameEvents.Length < 1;
   this.m_FrameEvents = frameEvents;
   this.m_NeedRefreshVisibleFolders = true;
   this.ReloadData();
   if (!flag)
     return;
   this.SetExpandedWithChildren(this.m_RootItem, 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();
		}
示例#17
0
 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();
     }
 }