public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } var selectedId = selection[0]; InitIfNeeded(); UpdateIfNeeded(frameDataView, selectedId); GUILayout.Label(m_TotalSelectedPropertyTimeLabel, EditorStyles.label); SplitterGUILayout.BeginVerticalSplit(m_VertSplit, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); // Callees var rect = EditorGUILayout.BeginHorizontal(); m_CalleesTreeView.OnGUI(rect); EditorGUILayout.EndHorizontal(); // Callers rect = EditorGUILayout.BeginHorizontal(); m_CallersTreeView.OnGUI(rect); EditorGUILayout.EndHorizontal(); SplitterGUILayout.EndVerticalSplit(); }
public void DoGUI(GUIStyle headerStyle, int frameIndex, ProfilerViewType viewType) { string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; if (string.IsNullOrEmpty(selectedPropertyPath)) { base.DrawEmptyPane(headerStyle); } else { this.InitIfNeeded(); this.UpdateIfNeeded(frameIndex, viewType, selectedPropertyPath); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label(this.m_TotalSelectedPropertyTimeLabel, EditorStyles.label, new GUILayoutOption[0]); SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); Rect r = EditorGUILayout.BeginVertical(new GUILayoutOption[0]); this.m_CalleesTreeView.OnGUI(r); EditorGUILayout.EndVertical(); r = EditorGUILayout.BeginVertical(new GUILayoutOption[0]); this.m_CallersTreeView.OnGUI(r); EditorGUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); GUILayout.EndVertical(); } }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { base.DrawEmptyPane(headerStyle); } else { int selectedId = selection[0]; this.InitIfNeeded(); this.UpdateIfNeeded(frameDataView, selectedId); GUILayout.Label(this.m_TotalSelectedPropertyTimeLabel, EditorStyles.label, new GUILayoutOption[0]); SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); Rect r = EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_CalleesTreeView.OnGUI(r); EditorGUILayout.EndHorizontal(); r = EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_CallersTreeView.OnGUI(r); EditorGUILayout.EndHorizontal(); SplitterGUILayout.EndVerticalSplit(); } }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } InitIfNeeded(); UpdateIfNeeded(frameDataView, selection[0]); string callstack = null; var selectedSampleId = m_TreeView.GetSelectedFrameDataViewId(); if (selectedSampleId != -1) { callstack = frameDataView.ResolveItemCallstack(selectedSampleId, m_TreeView.state.selectedIDs[0]); } var showCallstack = !string.IsNullOrEmpty(callstack); if (showCallstack) { SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea); } // Detailed list var rect = EditorGUILayout.BeginVertical(Styles.expandedArea); m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); if (showCallstack) { // Callstack area EditorGUILayout.BeginVertical(Styles.expandedArea); m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll); var text = kCallstackText + '\n' + callstack; EditorGUILayout.TextArea(text, Styles.callstackTextArea); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); } }
void IIncomingChangesTab.OnGUI() { DoActionsToolbar( mIsProcessMergesButtonVisible, mIsCancelMergesButtonVisible, mIsProcessMergesButtonEnabled, mIsCancelMergesButtonEnabled, mProcessMergesButtonText, mIncomingChangesViewLogic, mIncomingChangesTreeView, mProgressControls); bool splitterNeeded = mIsErrorsListVisible; if (splitterNeeded) { SplitterGUILayout.BeginVerticalSplit(mErrorsSplitterState); } DoIncomingChangesArea( mPlasticClient, mIncomingChangesTreeView, mPendingConflictsLabelData, mChangesToApplySummaryLabelText, mMessageLabelText, mIsMessageLabelVisible, mProgressControls.IsOperationRunning()); DoErrorsArea( mErrorsListView, mErrorDetailsSplitterState, mErrorMessageLabelText, mIsErrorsListVisible, mIsErrorMessageLabelVisible); if (splitterNeeded) { SplitterGUILayout.EndVerticalSplit(); } if (mProgressControls.HasNotification()) { DrawProgressForViews.ForNotificationArea( mProgressControls.ProgressData); } }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { base.DrawEmptyPane(headerStyle); } else { this.InitIfNeeded(); this.UpdateIfNeeded(frameDataView, selection[0]); string text = null; int selectedFrameDataViewId = this.m_TreeView.GetSelectedFrameDataViewId(); if (selectedFrameDataViewId != -1) { text = frameDataView.ResolveItemCallstack(selectedFrameDataViewId, this.m_TreeView.state.selectedIDs[0]); } bool flag = !string.IsNullOrEmpty(text); if (flag) { SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); } Rect rect = EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); this.m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); if (flag) { EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); this.m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(this.m_CallstackScrollViewPos, ProfilerDetailedView.Styles.callstackScroll, new GUILayoutOption[0]); string text2 = ProfilerDetailedObjectsView.kCallstackText + '\n' + text; EditorGUILayout.TextArea(text2, ProfilerDetailedView.Styles.callstackTextArea, new GUILayoutOption[0]); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); } } }
internal void OnGUI() { InitializeShowChangesButtonWidth(); bool wasChangesPanelVisible = mIsChangesPanelVisible; DoActionsToolbar( this, mProgressControls, mSearchField, mChangesetsListView, mDateFilter, mChangesetsLabelText, mShowChangesButtonWidth, wasChangesPanelVisible); if (mIsChangesPanelVisible) { SplitterGUILayout.BeginVerticalSplit(mSplitterState); } DoChangesetsArea( mChangesetsListView, mProgressControls.IsOperationRunning()); if (mIsChangesPanelVisible) { if (!wasChangesPanelVisible) { mShouldScrollToSelection = true; } DoChangesArea(mDiffPanel); SplitterGUILayout.EndVerticalSplit(); } }
public void OnGUI() { if (!m_Enabled) { Enable(); } if (BuildPipeline.isBuildingPlayer) { m_IsBuilding = true; } else if (m_IsBuilding) { m_IsBuilding = false; Repaint(); } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); var selectedIndex = m_TestTypeToolbarIndex; m_TestTypeToolbarIndex = GUILayout.Toolbar(m_TestTypeToolbarIndex, Enum.GetNames(typeof(TestRunnerMenuLabels)), "LargeButton", UnityEngine.GUI.ToolbarButtonSize.FitToContents); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); if (selectedIndex != m_TestTypeToolbarIndex) { SelectTestListGUI(m_TestTypeToolbarIndex); StartRetrieveTestList(); } EditorGUILayout.BeginVertical(); using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode)) { m_SelectedTestTypes.PrintHeadPanel(); } EditorGUILayout.EndVertical(); if (m_Settings.verticalSplit) { SplitterGUILayout.BeginVerticalSplit(m_Spl); } else { SplitterGUILayout.BeginHorizontalSplit(m_Spl); } EditorGUILayout.BeginVertical(); EditorGUILayout.BeginVertical(Styles.testList); m_SelectedTestTypes.RenderTestList(); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); m_SelectedTestTypes.RenderDetails(); if (m_Settings.verticalSplit) { SplitterGUILayout.EndVerticalSplit(); } else { SplitterGUILayout.EndHorizontalSplit(); } }
public void DoGUI(GUIStyle headerStyle, HierarchyFrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.valid || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } InitIfNeeded(); UpdateIfNeeded(frameDataView, selection[0]); var selectedSampleId = m_TreeView.GetSelectedFrameDataViewId(); var selectedMergedSampleIndex = m_TreeView.GetSelectedFrameDataViewMergedSampleIndex(); var selectedSampleMetadataCount = 0; if (selectedSampleId != -1) { frameDataView.GetItemMergedSampleCallstack(selectedSampleId, selectedMergedSampleIndex, m_CachedCallstack); selectedSampleMetadataCount = frameDataView.GetItemMergedSamplesMetadataCount(selectedSampleId, selectedMergedSampleIndex); } var showCallstack = m_CachedCallstack.Count > 0; var showMetadata = selectedSampleMetadataCount != 0; SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea); // Detailed list var rect = EditorGUILayout.BeginVertical(Styles.expandedArea); m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); // Callstack area EditorGUILayout.BeginVertical(Styles.expandedArea); // Display active text (We want word wrapped text with a vertical scrollbar) m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll); var sb = new StringBuilder(); if (showMetadata || showCallstack) { if (showMetadata) { var metadataInfo = frameDataView.GetMarkerMetadataInfo(frameDataView.GetItemMarkerID(selectedSampleId)); sb.Append(kMetadataText); sb.Append('\n'); for (var i = 0; i < selectedSampleMetadataCount; ++i) { if (metadataInfo != null && i < metadataInfo.Length) { sb.Append(metadataInfo[i].name); } else { sb.Append(i); } sb.Append(": "); sb.Append(frameDataView.GetItemMergedSamplesMetadata(selectedSampleId, selectedMergedSampleIndex, i)); sb.Append('\n'); } sb.Append('\n'); } if (showCallstack) { sb.Append(kCallstackText); sb.Append('\n'); foreach (var addr in m_CachedCallstack) { var methodInfo = frameDataView.ResolveMethodInfo(addr); if (string.IsNullOrEmpty(methodInfo.methodName)) { sb.AppendFormat("0x{0:X}\n", addr); } else if (string.IsNullOrEmpty(methodInfo.sourceFileName)) { sb.AppendFormat("0x{0:X}\t\t{1}\n", addr, methodInfo.methodName); } else { var normalizedPath = methodInfo.sourceFileName.Replace('\\', '/'); if (methodInfo.sourceFileLine == 0) { sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"1\">{2}</a>\n", addr, methodInfo.methodName, normalizedPath); } else { sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"{3}\">{2}:{3}</a>\n", addr, methodInfo.methodName, normalizedPath, methodInfo.sourceFileLine); } } } } } else { sb.Append(kNoMetadataOrCallstackText); } var metadataText = sb.ToString(); Styles.callstackTextArea.CalcMinMaxWidth(GUIContent.Temp(metadataText), out _, out var maxWidth); float minHeight = Styles.callstackTextArea.CalcHeight(GUIContent.Temp(metadataText), maxWidth); EditorGUILayout.SelectableLabel(metadataText, Styles.callstackTextArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.MinWidth(maxWidth + 10), GUILayout.MinHeight(minHeight + 10)); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); }
public void DoGUI(GUIStyle headerStyle, HierarchyFrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.valid || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } InitIfNeeded(); UpdateIfNeeded(frameDataView, selection[0]); var selectedSampleId = m_TreeView.GetSelectedFrameDataViewId(); if (selectedSampleId != -1) { frameDataView.GetItemMergedSampleCallstack(selectedSampleId, m_TreeView.state.selectedIDs[0], m_CachedCallstack); } var showCallstack = m_CachedCallstack.Count > 0; if (showCallstack) { SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea); } // Detailed list var rect = EditorGUILayout.BeginVertical(Styles.expandedArea); m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); if (showCallstack) { // Callstack area EditorGUILayout.BeginVertical(Styles.expandedArea); m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll); var sb = new StringBuilder(kCallstackText + '\n'); foreach (var addr in m_CachedCallstack) { var methodInfo = frameDataView.ResolveMethodInfo(addr); if (string.IsNullOrEmpty(methodInfo.methodName)) { sb.AppendFormat("0x{0:X}\n", addr); } else if (string.IsNullOrEmpty(methodInfo.sourceFileName)) { sb.AppendFormat("0x{0:X}\t{1}\n", addr, methodInfo.methodName); } else if (methodInfo.sourceFileLine == 0) { sb.AppendFormat("0x{0:X}\t{1}\t{2}\n", addr, methodInfo.methodName, methodInfo.sourceFileName); } else { sb.AppendFormat("0x{0:X}\t{1}\t{2}:{3}\n", addr, methodInfo.methodName, methodInfo.sourceFileName, methodInfo.sourceFileLine); } } EditorGUILayout.TextArea(sb.ToString(), Styles.callstackTextArea); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); } }
void OnGUI() { Event e = Event.current; LoadIcons(); LogEntries.wrapped.UpdateEntries(); if (!m_HasUpdatedGuiStyles) { m_LineHeight = Mathf.RoundToInt(Constants.ErrorStyle.lineHeight); m_BorderHeight = Constants.ErrorStyle.border.top + Constants.ErrorStyle.border.bottom; UpdateListView(); } GUILayout.BeginHorizontal(Constants.Toolbar); if (GUILayout.Button(Constants.ClearLabel, Constants.MiniButton)) { LogEntries.Clear(); GUIUtility.keyboardControl = 0; } int currCount = LogEntries.wrapped.GetCount(); if (m_ListView.totalRows != currCount && m_ListView.totalRows > 0) { // scroll bar was at the bottom? if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight) { m_ListView.scrollPos.y = currCount * RowHeight - ms_LVHeight; } } if (LogEntries.wrapped.searchFrame) { LogEntries.wrapped.searchFrame = false; int selectedIndex = LogEntries.wrapped.GetSelectedEntryIndex(); if (selectedIndex != -1) { int showIndex = selectedIndex + 1; if (currCount > showIndex) { int showCount = ms_LVHeight / RowHeight; showIndex = showIndex + showCount / 2; } m_ListView.scrollPos.y = showIndex * RowHeight - ms_LVHeight; } } EditorGUILayout.Space(); bool wasCollapsed = LogEntries.wrapped.collapse; LogEntries.wrapped.collapse = GUILayout.Toggle(wasCollapsed, Constants.CollapseLabel, Constants.MiniButton); bool collapsedChanged = (wasCollapsed != LogEntries.wrapped.collapse); if (collapsedChanged) { // unselect if collapsed flag changed m_ListView.row = -1; // scroll to bottom m_ListView.scrollPos.y = LogEntries.wrapped.GetCount() * RowHeight; } SetFlag(ConsoleFlags.ClearOnPlay, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnPlay), Constants.ClearOnPlayLabel, Constants.MiniButton)); #if UNITY_2019_1_OR_NEWER SetFlag(ConsoleFlags.ClearOnBuild, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnBuild), Constants.ClearOnBuildLabel, Constants.MiniButton)); #endif SetFlag(ConsoleFlags.ErrorPause, GUILayout.Toggle(HasFlag(ConsoleFlags.ErrorPause), Constants.ErrorPauseLabel, Constants.MiniButton)); #if UNITY_2018_3_OR_NEWER ConnectionGUILayout.AttachToPlayerDropdown(m_ConsoleAttachToPlayerState, EditorStyles.toolbarDropDown); #endif EditorGUILayout.Space(); if (m_DevBuild) { GUILayout.FlexibleSpace(); SetFlag(ConsoleFlags.StopForAssert, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForAssert), Constants.StopForAssertLabel, Constants.MiniButton)); SetFlag(ConsoleFlags.StopForError, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForError), Constants.StopForErrorLabel, Constants.MiniButton)); } GUILayout.FlexibleSpace(); // Search bar GUILayout.Space(4f); SearchField(e); int errorCount = 0, warningCount = 0, logCount = 0; LogEntries.wrapped.GetCountsByType(ref errorCount, ref warningCount, ref logCount); EditorGUI.BeginChangeCheck(); bool setLogFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelLog), new GUIContent((logCount <= 999 ? logCount.ToString() : "999+"), logCount > 0 ? iconInfoSmall : iconInfoMono), Constants.MiniButton); bool setWarningFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelWarning), new GUIContent((warningCount <= 999 ? warningCount.ToString() : "999+"), warningCount > 0 ? iconWarnSmall : iconWarnMono), Constants.MiniButton); bool setErrorFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelError), new GUIContent((errorCount <= 999 ? errorCount.ToString() : "999+"), errorCount > 0 ? iconErrorSmall : iconErrorMono), Constants.MiniButton); // Active entry index may no longer be valid if (EditorGUI.EndChangeCheck()) { } LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelLog, setLogFlag); LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelWarning, setWarningFlag); LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelError, setErrorFlag); if (GUILayout.Button(new GUIContent(errorCount > 0 ? iconFirstErrorSmall : iconFirstErrorMono, Constants.FirstErrorLabel), Constants.MiniButton)) { int firstErrorIndex = LogEntries.wrapped.GetFirstErrorEntryIndex(); if (firstErrorIndex != -1) { SetActiveEntry(firstErrorIndex); LogEntries.wrapped.searchFrame = true; } } GUILayout.EndHorizontal(); SplitterGUILayout.BeginVerticalSplit(spl); int rowHeight = RowHeight; EditorGUIUtility.SetIconSize(new Vector2(rowHeight, rowHeight)); GUIContent tempContent = new GUIContent(); int id = GUIUtility.GetControlID(0); int rowDoubleClicked = -1; /////@TODO: Make Frame selected work with ListViewState using (new GettingLogEntriesScope(m_ListView)) { int selectedRow = -1; bool openSelectedItem = false; bool collapsed = LogEntries.wrapped.collapse; foreach (ListViewElement el in ListViewGUI.ListView(m_ListView, Constants.Box)) { if (e.type == EventType.MouseDown && e.button == 0 && el.position.Contains(e.mousePosition)) { m_ListView.row = el.row; selectedRow = el.row; if (e.clickCount == 2) { openSelectedItem = true; } } else if (e.type == EventType.Repaint) { int mode = 0; int entryCount = 0; int searchIndex = 0; int searchEndIndex = 0; string text = LogEntries.wrapped.GetEntryLinesAndFlagAndCount(el.row, ref mode, ref entryCount, ref searchIndex, ref searchEndIndex); ConsoleFlags flag = (ConsoleFlags)mode; bool isSelected = LogEntries.wrapped.IsEntrySelected(el.row); // Draw the background GUIStyle s = el.row % 2 == 0 ? Constants.OddBackground : Constants.EvenBackground; s.Draw(el.position, false, false, isSelected, false); // Draw the icon #if !UNITY_2017_3_OR_NEWER if (Constants.LogStyleLineCount == 1) { Rect rt = el.position; rt.x += 6f; rt.y += 2f; rt.width = 16f; rt.height = 16f; GUI.DrawTexture(rt, GetIconForErrorMode(flag, false)); } else #endif { GUIStyle iconStyle = GetStyleForErrorMode(flag, true, Constants.LogStyleLineCount == 1); iconStyle.Draw(el.position, false, false, isSelected, false); } // Draw the text tempContent.text = text; GUIStyle errorModeStyle = GetStyleForErrorMode(flag, false, Constants.LogStyleLineCount == 1); if (string.IsNullOrEmpty(LogEntries.wrapped.searchString) || searchIndex == -1 || searchIndex >= text.Length) { errorModeStyle.Draw(el.position, tempContent, id, isSelected); } else { errorModeStyle.DrawWithTextSelection(el.position, tempContent, GUIUtility.keyboardControl, searchIndex, searchEndIndex); } if (collapsed) { Rect badgeRect = el.position; tempContent.text = entryCount.ToString(CultureInfo.InvariantCulture); Vector2 badgeSize = Constants.CountBadge.CalcSize(tempContent); badgeRect.xMin = badgeRect.xMax - badgeSize.x; badgeRect.yMin += ((badgeRect.yMax - badgeRect.yMin) - badgeSize.y) * 0.5f; badgeRect.x -= 5f; GUI.Label(badgeRect, tempContent, Constants.CountBadge); } } } if (selectedRow != -1) { if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight) { m_ListView.scrollPos.y = m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight - 1; } } // Make sure the selected entry is up to date if (m_ListView.totalRows == 0 || m_ListView.row >= m_ListView.totalRows || m_ListView.row < 0) { } else { if (m_ListView.selectionChanged) { SetActiveEntry(m_ListView.row); } } // Open entry using return key if ((GUIUtility.keyboardControl == m_ListView.ID) && (e.type == EventType.KeyDown) && (e.keyCode == KeyCode.Return) && (m_ListView.row != 0)) { selectedRow = m_ListView.row; openSelectedItem = true; } if (e.type != EventType.Layout && ListViewGUI.ilvState.rectHeight != 1) { ms_LVHeight = ListViewGUI.ilvState.rectHeight; } if (openSelectedItem) { rowDoubleClicked = selectedRow; e.Use(); } if (selectedRow != -1) { SetActiveEntry(selectedRow); } } // Prevent dead locking in EditorMonoConsole by delaying callbacks (which can log to the console) until after LogEntries.EndGettingEntries() has been // called (this releases the mutex in EditorMonoConsole so logging again is allowed). Fix for case 1081060. if (rowDoubleClicked != -1) { LogEntries.wrapped.StacktraceListView_RowGotDoubleClicked(); } EditorGUIUtility.SetIconSize(Vector2.zero); StacktraceListView(e, tempContent); SplitterGUILayout.EndVerticalSplit(); // Copy & Paste selected item if ((e.type == EventType.ValidateCommand || e.type == EventType.ExecuteCommand) && e.commandName == "Copy") { if (e.type == EventType.ExecuteCommand) { LogEntries.wrapped.StacktraceListView_CopyAll(); } e.Use(); } }
private void OnGUI() { if (m_assets == null) { if (GUILayout.Button("Load Data")) { EditorUtility.DisplayProgressBar("Loading", "Please Wait", 0f); CalculateAssetsAndBundles(); LoadAssetSizes(); CalculateReferencedBundles(); UpdateAssetSizeRecursive(); m_mainPaneMode = HierarchyMode.Recurse; UpdateAssetsOrdered(m_mainPaneMode); CalculateBundleSize(); CalculateTotalBundleSize(); CalculateTotalAssetSize(); BuildGroupSizes(); EditorUtility.ClearProgressBar(); m_columnHeaderStyle = new GUIStyle("dockArea"); m_columnHeaderStyle.alignment = TextAnchor.MiddleLeft; m_columnHeaderStyle.padding = new RectOffset(10, 0, 0, 0); m_columnHeaderStyle.fontStyle = FontStyle.Bold; m_foldoutStyle = new GUIStyle("IN Foldout"); } } else { Toolbar(); SplitterGUILayout.BeginVerticalSplit(m_mainVerticalSplit); { SplitterGUILayout.BeginHorizontalSplit(m_upperHorizontalSplit); { EditorGUILayout.BeginVertical("box"); { GroupPane(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); { AssetListPane(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginHorizontal(); { if (!m_selected.Any()) { EditorGUILayout.BeginVertical("box"); { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); } EditorGUILayout.EndVertical(); } else { SplitterGUILayout.BeginVerticalSplit(m_depVerticalSplit); { EditorGUILayout.BeginVertical("box"); { ReverseDepTree(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); { SelectedDeps(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); { SelectedReferencedBundles(); } EditorGUILayout.EndVertical(); } SplitterGUILayout.EndVerticalSplit(); } } EditorGUILayout.EndHorizontal(); } SplitterGUILayout.EndHorizontalSplit(); SplitterGUILayout.BeginHorizontalSplit(m_lowerHorizontalSplit); { EditorGUILayout.BeginVertical("box"); { BundlePane(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); { AssetPane(); } EditorGUILayout.EndVertical(); } SplitterGUILayout.EndHorizontalSplit(); } SplitterGUILayout.EndVerticalSplit(); DisplayBottomBar(); } }
public static void BeginVerticalSplit(SplitterState state, GUIStyle style, params GUILayoutOption[] options) => SplitterGUILayout.BeginVerticalSplit(state.state, style, options);
public void DoGUI(GUIStyle headerStyle, HierarchyFrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.valid || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } InitIfNeeded(); UpdateIfNeeded(frameDataView, selection[0]); var selectedSampleId = m_TreeView.GetSelectedFrameDataViewId(); var selectedMergedSampleIndex = m_TreeView.GetSelectedFrameDataViewMergedSampleIndex(); var selectedSampleMetadataCount = 0; if (selectedSampleId != -1) { frameDataView.GetItemMergedSampleCallstack(selectedSampleId, selectedMergedSampleIndex, m_CachedCallstack); selectedSampleMetadataCount = frameDataView.GetItemMergedSamplesMetadataCount(selectedSampleId, selectedMergedSampleIndex); } GUILayout.Label(m_InstancesLabel, EditorStyles.label); var showCallstack = m_CachedCallstack.Count > 0; var showMetadata = selectedSampleMetadataCount != 0; SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea); // Detailed list var rect = EditorGUILayout.BeginVertical(Styles.expandedArea); m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); // Metadata area EditorGUILayout.BeginVertical(Styles.expandedArea); if (showCallstack) { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); ProfilerFrameDataViewBase.showFullDetailsForCallStacks = GUILayout.Toggle(ProfilerFrameDataViewBase.showFullDetailsForCallStacks, ProfilerFrameDataViewBase.showFullDetailsForCallStacksContent, EditorStyles.toolbarButton); EditorGUILayout.EndHorizontal(); } // Display active text (We want word wrapped text with a vertical scrollbar) m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll); var sb = new StringBuilder(); if (showMetadata || showCallstack) { if (showMetadata) { var metadataInfo = frameDataView.GetMarkerMetadataInfo(frameDataView.GetItemMarkerID(selectedSampleId)); sb.Append(kMetadataText); sb.Append('\n'); for (var i = 0; i < selectedSampleMetadataCount; ++i) { if (metadataInfo != null && i < metadataInfo.Length) { sb.Append(metadataInfo[i].name); } else { sb.Append(i); } sb.Append(": "); sb.Append(frameDataView.GetItemMergedSamplesMetadata(selectedSampleId, selectedMergedSampleIndex, i)); sb.Append('\n'); } sb.Append('\n'); } if (showCallstack) { m_ProfilerFrameDataHierarchyView.CompileCallStack(sb, m_CachedCallstack, frameDataView); } } else { sb.Append(kNoMetadataOrCallstackText); } var metadataText = sb.ToString(); Styles.callstackTextArea.CalcMinMaxWidth(GUIContent.Temp(metadataText), out _, out var maxWidth); float minHeight = Styles.callstackTextArea.CalcHeight(GUIContent.Temp(metadataText), maxWidth); EditorGUILayout.SelectableLabel(metadataText, Styles.callstackTextArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.MinWidth(maxWidth + 10), GUILayout.MinHeight(minHeight + 10)); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); }