public static IEnumerable <T> GetGraphViewWindows <T>(Type typeFilter) where T : EditorWindow { var guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); // Get all GraphViews used by existing tool windows of our type using (var it = UIElementsUtility.GetPanelsIterator()) { while (it.MoveNext()) { var dockArea = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key) as DockArea; if (dockArea == null) { continue; } if (typeFilter == null) { foreach (var window in dockArea.m_Panes.OfType <T>()) { yield return(window); } } else { foreach (var window in dockArea.m_Panes.Where(p => p.GetType() == typeFilter).Cast <T>()) { yield return(window); } } } } }
private void RefreshVisualTrees() { m_VisualTrees.Clear(); List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { HostView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key) as HostView; if (view == null) { continue; } // Skip this window if (view.actualView == this) { continue; } var panel = it.Current.Value; var panelMode = UIRDebugUtility.GetPanelRepaintMode(panel); if (panelMode != RepaintMode.Standard) { m_VisualTrees.Add(new VisualTreeDebug() { panel = panel }); } } }
public static T FindBoundGraphViewToolWindow <T>(VisualElement gv) where T : GraphViewToolWindowBridge { var guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); FieldInfo fieldInfo = typeof(T).GetField("m_SelectedGraphView", BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(fieldInfo); using (var it = UIElementsUtility.GetPanelsIterator()) { while (it.MoveNext()) { var dockArea = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key) as DockArea; if (dockArea == null) { continue; } foreach (var graphViewTool in dockArea.m_Panes.OfType <T>()) { var usedGv = (VisualElement)fieldInfo.GetValue(graphViewTool); if (usedGv == gv) { return(graphViewTool); } } } } return(null); }
static void UpdateSchedulersInternal(HashSet <Object> tmpDirtySet) { DataWatchService.sharedInstance.PollNativeData(); var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; // Game panels' scheduler are ticked by the engine if (panel.contextType != ContextType.Editor) { continue; } var timerEventScheduler = panel.scheduler; // Dispatch all timer update messages to each scheduled item panel.timerEventScheduler.UpdateScheduledEvents(); // Dispatch might have triggered a repaint request. if (panel.visualTree.IsDirty(ChangeType.Repaint)) { var guiView = panel.ownerObject as GUIView; if (guiView != null) { guiView.Repaint(); } } } }
static void RequestRepaintForPanels() { var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; // Game panels' scheduler are ticked by the engine if (panel.contextType != ContextType.Editor) { continue; } // Dispatch might have triggered a repaint request. if (panel.isDirty) { var guiView = panel.ownerObject as GUIView; if (guiView != null) { guiView.Repaint(); } } } }
private static void OneShotUxmlLiveReload() { try { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; HostView hostView = current.Value.ownerObject as HostView; if (hostView != null && hostView.actualView != null) { hostView.Reload(hostView.actualView); } } } catch (Exception exception) { Debug.LogException(exception); } Delegate arg_96_0 = EditorApplication.update; if (RetainedMode.< > f__mg$cache3 == null) { RetainedMode.< > f__mg$cache3 = new EditorApplication.CallbackFunction(RetainedMode.OneShotUxmlLiveReload); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_96_0, RetainedMode.< > f__mg$cache3); }
public static void FlagStyleSheetChange() { // clear caches that depend on loaded style sheets UnityEngine.UIElements.StyleSheets.StyleSheetCache.ClearCaches(); // for now we don't bother tracking which panel depends on which style sheet var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; // In-game doesn't support styling if (panel.contextType != ContextType.Editor) { continue; } panel.DirtyStyleSheets(); var guiView = panel.ownerObject as GUIView; if (guiView != null) { guiView.Repaint(); } } }
public void OnDisable() { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } }
public void OnDisable() { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; current.Value.panelDebug = null; } }
private const string k_UssExtensionGenerated = ".uss.asset"; // for editor_resources project static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { // Early exit: no imported or deleted assets. var uxmlImportedAssets = new HashSet <string>(importedAssets.Where(x => MatchesFileExtension(x, k_UxmlExtension))); var uxmlDeletedAssets = new HashSet <string>(deletedAssets.Where(x => MatchesFileExtension(x, k_UxmlExtension))); var ussImportedAssets = new HashSet <string>(importedAssets.Where(x => MatchesFileExtension(x, k_UssExtension) || MatchesFileExtension(x, k_UssExtensionGenerated))); var ussDeletedAssets = new HashSet <string>(deletedAssets.Where(x => MatchesFileExtension(x, k_UssExtension))); if (uxmlImportedAssets.Count == 0 && uxmlDeletedAssets.Count == 0 && ussImportedAssets.Count == 0 && ussDeletedAssets.Count == 0) { return; } HashSet <VisualTreeAsset> uxmlModifiedAssets = null; if (uxmlImportedAssets.Count > 0) { UXMLImporterImpl.logger.FinishImport(); // the inline stylesheet cache might get out of date. // Usually called by the USS importer, which might not get called here StyleSheetCache.ClearCaches(); uxmlModifiedAssets = new HashSet <VisualTreeAsset>(); foreach (var assetPath in uxmlImportedAssets) { VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(assetPath); if (asset != null) // Shouldn't be! { uxmlModifiedAssets.Add(asset); } } } HashSet <StyleSheet> ussModifiedAssets = null; var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; panel.liveReloadSystem.OnVisualTreeAssetsImported(uxmlModifiedAssets, uxmlDeletedAssets); // ussModifiedAssets is null but we don't care for those, only deleted ones (that we'll stop tracking). panel.liveReloadSystem.OnStyleSheetAssetsImported(ussModifiedAssets, ussDeletedAssets); } if (ussImportedAssets.Count > 0 || ussDeletedAssets.Count > 0) { FlagStyleSheetChange(); } }
public void Refresh() { m_Panels.Clear(); var it = UIElementsUtility.GetPanelsIterator(); List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); bool setMax = false; Rect screen = new Rect(float.MaxValue, float.MaxValue, 0, 0); while (it.MoveNext()) { GUIView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key); if (view == null) { continue; } m_Panels.Add(new UIElementsDebugger.ViewPanel { Panel = it.Current.Value, View = view }); if (screen.xMin > view.screenPosition.xMin) { screen.xMin = view.screenPosition.xMin; } if (screen.yMin > view.screenPosition.yMin) { screen.yMin = view.screenPosition.yMin; } if (screen.xMax < view.screenPosition.xMax || !setMax) { screen.xMax = view.screenPosition.xMax; } if (screen.yMax < view.screenPosition.yMax || !setMax) { screen.yMax = view.screenPosition.yMax; } setMax = true; } m_Labels = new GUIContent[m_Panels.Count + 1]; m_Labels[0] = EditorGUIUtility.TrTextContent("Select a panel"); for (int i = 0; i < m_Panels.Count; i++) { m_Labels[i + 1] = new GUIContent(GetName(m_Panels[i])); } screenRect = screen; }
public void Refresh() { this.m_Panels.Clear(); Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); List <GUIView> list = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(list); bool flag = false; Rect rect = new Rect(3.40282347E+38f, 3.40282347E+38f, 0f, 0f); while (it.MoveNext()) { GUIView gUIView = list.FirstOrDefault(delegate(GUIView v) { int arg_19_0 = v.GetInstanceID(); KeyValuePair <int, Panel> current2 = it.Current; return(arg_19_0 == current2.Key); }); if (!(gUIView == null)) { List <UIElementsDebugger.ViewPanel> arg_A6_0 = this.m_Panels; UIElementsDebugger.ViewPanel item = default(UIElementsDebugger.ViewPanel); KeyValuePair <int, Panel> current = it.Current; item.Panel = current.Value; item.View = gUIView; arg_A6_0.Add(item); if (rect.xMin > gUIView.screenPosition.xMin) { rect.xMin = gUIView.screenPosition.xMin; } if (rect.yMin > gUIView.screenPosition.yMin) { rect.yMin = gUIView.screenPosition.yMin; } if (rect.xMax < gUIView.screenPosition.xMax || !flag) { rect.xMax = gUIView.screenPosition.xMax; } if (rect.yMax < gUIView.screenPosition.yMax || !flag) { rect.yMax = gUIView.screenPosition.yMax; } flag = true; } } this.m_Labels = new GUIContent[this.m_Panels.Count + 1]; this.m_Labels[0] = EditorGUIUtility.TrTextContent("Select a panel", null, null); for (int i = 0; i < this.m_Panels.Count; i++) { this.m_Labels[i + 1] = new GUIContent(PickingData.GetName(this.m_Panels[i])); } this.screenRect = rect; }
void RefreshPanelChoices() { m_GraphViewChoices.Clear(); List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { GUIView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key); if (view == null) { continue; } DockArea dockArea = view as DockArea; if (dockArea == null) { continue; } foreach (var graphViewEditor in dockArea.m_Panes.OfType <GraphViewEditorWindow>()) { int idx = 0; foreach (var graphView in graphViewEditor.graphViews.Where(IsGraphViewSupported)) { m_GraphViewChoices.Add(new GraphViewChoice { window = graphViewEditor, idx = idx++, graphView = graphView }); } } } var menu = m_SelectorMenu.menu; var menuItemsCount = menu.MenuItems().Count; // Clear previous items (but not the "none" one at the top of the list) for (int i = menuItemsCount - 1; i > 0; i--) { menu.RemoveItemAt(i); } foreach (var graphView in m_GraphViewChoices) { menu.AppendAction(graphView.graphView.name, OnSelectGraphView, a => ((GraphViewChoice)a.userData).graphView == m_SelectedGraphView ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal, graphView); } }
private static void ProcessAssetPath(string assetPath) { if (StyleSheetAssetPostprocessor.s_StyleSheetReferencedAssetPaths != null && StyleSheetAssetPostprocessor.s_StyleSheetReferencedAssetPaths.Contains(assetPath)) { StyleContext.ClearStyleCache(); Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; value.visualTree.Dirty(ChangeType.Styles | ChangeType.Repaint); } } }
private void DoViewsPanel() { GUILayout.Label("Views Panel", EditorStyles.boldLabel); List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { HostView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key) as HostView; if (view == null) { continue; } // Skip this window if (view.actualView == this) { continue; } var panel = it.Current.Value; var panelMode = UIRDebugUtility.GetPanelRepaintMode(panel); string name = panel.name; var mode = (RepaintMode)EditorGUILayout.EnumPopup(name, panelMode); if (panelMode != mode) { if (Panel.BeforeUpdaterChange != null) { Panel.BeforeUpdaterChange(); } UIRDebugUtility.SwitchPanelRepaintMode(panel, mode); if (mode == RepaintMode.UIR) { view.actualView.depthBufferBits = 24; } else { view.actualView.depthBufferBits = 0; } view.actualView.MakeParentsSettingsMatchMe(); if (Panel.AfterUpdaterChange != null) { Panel.AfterUpdaterChange(); } } } }
private void RefreshPanelChoices() { m_PanelChoices.Clear(); m_PanelToEditorWindow.Clear(); List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { GUIView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key); if (view == null) { continue; } // Skip this window HostView hostView = view as HostView; if (hostView != null && hostView.actualView == this) { continue; } var p = it.Current.Value; m_PanelChoices.Add(new PanelChoice { panel = p, name = p.name }); if (hostView != null && hostView.actualView != null) { m_PanelToEditorWindow.Add(p, hostView.actualView); } } var menu = m_PanelSelect.menu; var menuItemsCount = menu.MenuItems().Count; // Clear previous items for (int i = 0; i < menuItemsCount; i++) { menu.RemoveItemAt(0); } foreach (var panelChoice in m_PanelChoices) { menu.AppendAction(panelChoice.ToString(), OnSelectPanel, DropdownMenuAction.AlwaysEnabled, panelChoice); } }
void OnBeforeRepaint(Panel source) { bool colorSpaceChanged = CheckForColorSpaceChange(); bool importCountChanged = CheckForImportCountChange(); bool renderTexturesTrashed = CheckForRenderTexturesTrashed(); if (colorSpaceChanged || importCountChanged || renderTexturesTrashed) { var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { Panel panel = it.Current.Value; (panel.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater)?.DestroyRenderChain(); panel.atlas?.Reset(); } } }
private unsafe static void OnRegisterIntermediateRenderers(Camera camera) { var panels = UIElementsUtility.GetPanelsIterator(); while (panels.MoveNext()) { var p = panels.Current.Value; RenderChain renderChain = (p.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater)?.renderChain; if (renderChain == null || renderChain.m_StaticIndex < 0) { continue; } Material standardMat = renderChain.GetStandardWorldSpaceMaterial(); RuntimePanel rtp = (RuntimePanel)p; int renderNodeIndex = renderChain.m_ActiveRenderNodes; if (renderNodeIndex < renderChain.m_RenderNodesData.Count) { var renderNodeData = renderChain.m_RenderNodesData[renderNodeIndex]; renderNodeData.viewport = p.visualTree.layout; renderNodeData.standardMat = standardMat; renderChain.m_RenderNodesData[renderNodeIndex] = renderNodeData; } else { renderNodeIndex = renderChain.m_RenderNodesData.Count; renderChain.m_RenderNodesData.Add(new RenderNodeData() { matPropBlock = new MaterialPropertyBlock(), viewport = p.visualTree.layout, standardMat = standardMat }); } int *userData = stackalloc int[2]; userData[0] = renderChain.m_StaticIndex; userData[1] = renderNodeIndex; UIR.Utility.RegisterIntermediateRenderer(camera, standardMat, rtp.panelToWorld, new Bounds(Vector3.zero, new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)), 3, 0, false, 0, (ulong)camera.cullingMask, (int)UIR.Utility.RendererCallbacks.RendererCallback_Exec, new IntPtr(userData), sizeof(int) * 2); } }
private static void ProcessAssetPath(string assetPath) { if (s_StyleSheetReferencedAssetPaths == null || !s_StyleSheetReferencedAssetPaths.Contains(assetPath)) { return; } // Clear the style cache to force all USS rules to recompute // and subsequently reload/reimport all images. StyleContext.ClearStyleCache(); // Force all currently active panels to repaint by marking them dirty. var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; panel.visualTree.Dirty(ChangeType.Styles | ChangeType.Repaint); } }
static void UpdateSchedulers() { DataWatchService.sharedInstance.PollNativeData(); var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; // Game panels' scheduler are ticked by the engine if (panel.contextType != ContextType.Editor) { continue; } // Dispatch all timer update messages to each scheduled item panel.timerEventScheduler.UpdateScheduledEvents(); } }
public static void FlagStyleSheetChange() { StyleSheetCache.ClearCaches(); Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { value.styleContext.DirtyStyleSheets(); value.visualTree.Dirty(ChangeType.Styles); GUIView gUIView = EditorUtility.InstanceIDToObject(value.instanceID) as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } }
public static void FlagStyleSheetChange() { // clear caches that depend on loaded style sheets StyleSheetCache.ClearCaches(); // for now we don't bother tracking which panel depends on which style sheet var iterator = UIElementsUtility.GetPanelsIterator(); while (iterator.MoveNext()) { var panel = iterator.Current.Value; panel.DirtyStyleSheets(); var guiView = panel.ownerObject as GUIView; if (guiView != null) { guiView.Repaint(); } } }
protected virtual void PopulatePanelChoices(List <IPanelChoice> panelChoices) { List <GUIView> guiViews = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(guiViews); var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { // Skip this debugger window GUIView view = guiViews.FirstOrDefault(v => v.GetInstanceID() == it.Current.Key); HostView hostView = view as HostView; if (!m_DebuggerWindow.CanDebugView(hostView)) { continue; } var p = it.Current.Value; panelChoices.Add(new PanelChoice(p)); } }
private static void OneShotUxmlLiveReload() { try { var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { var view = it.Current.Value.ownerObject as HostView; if (view != null && view.actualView != null && !(view.actualView is UIElementsDebugger)) { view.Reload(view.actualView); } } } catch (Exception e) { Debug.LogException(e); } // Make sure to unregister ourself to prevent any infinit updates. EditorApplication.update -= OneShotUxmlLiveReload; }
private void EndPicking(UIElementsDebugger.ViewPanel?viewPanel) { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; current.Value.panelDebug = null; } this.m_CurPanel = viewPanel; if (this.m_CurPanel.HasValue) { this.m_LastWindowTitle = PickingData.GetName(this.m_CurPanel.Value); if (this.m_CurPanel.Value.Panel.panelDebug == null) { this.m_CurPanel.Value.Panel.panelDebug = new PanelDebug(); } this.m_CurPanel.Value.Panel.panelDebug.enabled = true; this.m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); this.m_VisualTreeTreeView.panel = this.m_CurPanel.Value.Panel; this.m_VisualTreeTreeView.Reload(); } }
private static void UpdateSchedulersInternal(HashSet <UnityEngine.Object> tmpDirtySet) { DataWatchService.sharedInstance.PollNativeData(); Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { IScheduler scheduler = value.scheduler; value.timerEventScheduler.UpdateScheduledEvents(); if (value.visualTree.IsDirty(ChangeType.Repaint)) { GUIView gUIView = value.ownerObject as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } } }
private void EndPicking(ViewPanel?viewPanel) { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } m_CurPanel = viewPanel; if (m_CurPanel.HasValue) { m_LastWindowTitle = PickingData.GetName(m_CurPanel.Value); if (m_CurPanel.Value.Panel.panelDebug == null) { m_CurPanel.Value.Panel.panelDebug = new PanelDebug(); } m_CurPanel.Value.Panel.panelDebug.enabled = true; m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); m_VisualTreeTreeView.panel = (m_CurPanel.Value.Panel); m_VisualTreeTreeView.Reload(); } }
static void OnBeforeRepaint(Panel source) { bool colorSpaceChanged = CheckForColorSpaceChange(); bool importedTextureChanged = CheckForImportedTextures(); bool importedVectorImageChanged = CheckForImportedVectorImages(); bool renderTexturesTrashed = CheckForRenderTexturesTrashed(); bool resetAtlases = colorSpaceChanged || importedTextureChanged || importedVectorImageChanged || renderTexturesTrashed; bool resetRenderChains = renderTexturesTrashed; if (resetAtlases || resetRenderChains) { if (resetAtlases && !resetRenderChains) { // If the render chain was to be reset, it would implicitly reset the VectorImageManagers. for (int i = 0; i < VectorImageManager.instances.Count; ++i) { VectorImageManager.instances[i].Reset(); } } var it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { Panel panel = it.Current.Value; if (resetRenderChains) { (panel.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater)?.DestroyRenderChain(); } if (resetAtlases) { panel.atlas?.Reset(); } } } }
private static void UpdateSchedulers() { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { IScheduler scheduler = value.scheduler; value.timerEventScheduler.UpdateScheduledEvents(); DataWatchService dataWatchService = value.dataWatch as DataWatchService; dataWatchService.ProcessNotificationQueue(); if (value.visualTree.IsDirty(ChangeType.Repaint)) { GUIView gUIView = EditorUtility.InstanceIDToObject(value.instanceID) as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } } }
public void OnGUI() { if (m_ScheduledWindowPicking) { if (m_PickingData.TrySelectWindow(m_ScheduledWindowPicking)) { EndPicking(m_PickingData.Selected); m_VisualTreeTreeView.ExpandAll(); } m_ScheduledWindowPicking = null; } else if (m_ScheduleRestoreSelection) { m_ScheduleRestoreSelection = false; if (m_PickingData.TryRestoreSelectedWindow(m_LastWindowTitle)) { EndPicking(m_PickingData.Selected); m_VisualTreeTreeView.ExpandAll(); } else { m_LastWindowTitle = String.Empty; } } EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); bool refresh = false; EditorGUI.BeginChangeCheck(); m_PickingData.DoSelectDropDown(() => { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } m_Refresh = true; }); bool includeShadowHierarchy = GUILayout.Toggle(m_VisualTreeTreeView.includeShadowHierarchy, Styles.includeShadowHierarchyContent, EditorStyles.toolbarButton); if (includeShadowHierarchy != m_VisualTreeTreeView.includeShadowHierarchy) { m_VisualTreeTreeView.includeShadowHierarchy = includeShadowHierarchy; refresh = true; } GUI.enabled = m_CurPanel.HasValue; bool newPickingElementInPanel = GUILayout.Toggle(m_PickingElementInPanel, Styles.pickElementInPanelContent, EditorStyles.toolbarButton); m_PickingElementInPanel = newPickingElementInPanel; GUI.enabled = true; m_Overlay = GUILayout.Toggle(m_Overlay, Styles.overlayContent, EditorStyles.toolbarButton); // Note for future us : the UXML reload feature isn't quite ready to be public if (Unsupported.IsDeveloperBuild()) { bool uxmlLiveReloadIsEnabled = RetainedMode.UxmlLiveReloadIsEnabled; bool newUxmlLiveReloadIsEnabled = GUILayout.Toggle(uxmlLiveReloadIsEnabled, Styles.liveReloadContent, EditorStyles.toolbarButton); if (newUxmlLiveReloadIsEnabled != uxmlLiveReloadIsEnabled) { RetainedMode.UxmlLiveReloadIsEnabled = newUxmlLiveReloadIsEnabled; } } EditorGUILayout.EndHorizontal(); if (refresh || m_Refresh) { EndPicking(m_PickingData.Selected); } if (m_CurPanel.HasValue) { if (m_CurPanel.Value.Panel.panelDebug.enabled != (m_Overlay || m_PickingElementInPanel)) { m_CurPanel.Value.Panel.panelDebug.enabled = m_Overlay || m_PickingElementInPanel; m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); } SplitterGUILayout.BeginHorizontalSplit(m_SplitterState, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); SplitterGUILayout.EndHorizontalSplit(); float column1Width = m_SplitterState.realSizes.Length > 0 ? m_SplitterState.realSizes[0] : 150; float column2Width = position.width - column1Width; Rect column1Rect = new Rect(0, EditorGUI.kWindowToolbarHeight, column1Width, position.height - EditorGUI.kWindowToolbarHeight); Rect column2Rect = new Rect(column1Width, EditorGUI.kWindowToolbarHeight, column2Width, column1Rect.height); m_VisualTreeTreeView.OnGUI(column1Rect); DrawSelection(column2Rect); // Draw separator EditorGUI.DrawRect( new Rect(column1Width + column1Rect.xMin, column1Rect.y, 1, column1Rect.height), Styles.separatorColor); } }