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(); } } }
private bool UpdatePreviewTexture(int width, int height) { var vta = target as VisualTreeAsset; bool dirty = false; int currentDirtyCount = EditorUtility.GetDirtyCount(target); if (vta != m_LastTree || !m_LastTree || currentDirtyCount != m_LastDirtyCount || vta.contentHash != m_LastContentHash) { m_LastTree = vta; m_Tree = vta.Instantiate(); m_Tree.StretchToParentSize(); m_LastDirtyCount = currentDirtyCount; m_LastContentHash = vta.contentHash; dirty = true; } if (m_Panel == null) { m_Panel = UIElementsUtility.FindOrCreateEditorPanel(m_LastTree); var visualTree = m_Panel.visualTree; UIElementsEditorUtility.AddDefaultEditorStyleSheets(visualTree); dirty = true; } if (dirty) { m_Panel.visualTree.Clear(); m_Panel.visualTree.Add(m_Tree); RenderStaticPreview(width, height, ref m_preview_texture); } return(dirty); }
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); } } } } }
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(); } } } }
public void OnVisualTreeAssetsImported(HashSet <VisualTreeAsset> changedAssets, HashSet <string> deletedAssets) { if (panel.contextType == ContextType.Editor && m_EditorVisualTreeAssetTracker != null) { if (m_EditorVisualTreeAssetTracker.OnAssetsImported(changedAssets, deletedAssets)) { m_TrackersToRefresh.Add(m_EditorVisualTreeAssetTracker); } } else { foreach (var tracker in m_RuntimeVisualTreeAssetTrackers.Values) { if (tracker.OnAssetsImported(changedAssets, deletedAssets)) { m_TrackersToRefresh.Add(tracker); } } } if (m_TrackersToRefresh.Count == 0) { return; } UIElementsUtility.InMemoryAssetsHaveBeenChanged(); // Player panel require an update here or else it will only update when Unity is focused if (panel.contextType == ContextType.Player) { Update(); } }
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); }
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); }
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(); } } } }
protected void OnDestroy() { if (m_LastTree != null) { UIElementsUtility.RemoveCachedPanel(m_LastTree.GetInstanceID()); } }
protected override void OnDestroy() { Internal_Close(); UIElementsUtility.RemoveCachedPanel(this.GetInstanceID()); base.OnDestroy(); }
public void OnDisable() { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } }
public void Render(VisualTreeAsset vta, Rect r, GUIStyle background) { if (Event.current.type != EventType.Repaint || r.width < 100 && r.height < 100) { return; } bool dirty = false; if (vta != m_LastTree || !m_LastTree) { m_LastTree = vta; m_Tree = (vta as UnityEngine.UIElements.VisualTreeAsset).CloneTree(); m_Tree.StretchToParentSize(); dirty = true; } if (m_Panel == null) { m_Panel = UIElementsUtility.FindOrCreatePanel(m_LastTree, ContextType.Editor); var visualTree = m_Panel.visualTree; visualTree.pseudoStates |= PseudoStates.Root; UIElementsEditorUtility.AddDefaultEditorStyleSheets(visualTree); m_Panel.allowPixelCaching = false; dirty = true; } if (dirty) { m_Panel.visualTree.Clear(); m_Panel.visualTree.Add(m_Tree); } EditorGUI.DrawRect(r, EditorGUIUtility.kViewBackgroundColor); Rect layoutRect = GUIClip.UnclipToWindow(r); m_Panel.visualTree.layout = new Rect(0, 0, layoutRect.width, layoutRect.height); // We will draw relative to a viewport covering the preview area, so draw at 0,0 m_Panel.visualTree.IncrementVersion(VersionChangeType.Repaint); var oldState = SavedGUIState.Create(); int clips = GUIClip.Internal_GetCount(); while (clips > 0) { GUIClip.Pop(); clips--; } // Establish preview area viewport var pixelsPerPoint = GUIUtility.pixelsPerPoint; var viewportRect = new Rect(layoutRect.x * pixelsPerPoint, (GUIClip.visibleRect.height - layoutRect.yMax) * pixelsPerPoint, layoutRect.width * pixelsPerPoint, layoutRect.height * pixelsPerPoint); GL.Viewport(viewportRect); m_Panel.Repaint(Event.current); oldState.ApplyAndForget(); }
public void OnDisable() { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; current.Value.panelDebug = null; } }
public void Render(VisualTreeAsset vta, Rect r, GUIStyle background) { if (Event.current.type != EventType.Repaint || r.width < 100 && r.height < 100) { return; } bool dirty = false; if (vta != m_LastTree || !m_LastTree) { m_LastTree = vta; m_Tree = vta.CloneTree(null); m_Tree.StretchToParentSize(); dirty = true; } if (m_Panel == null) { UXMLEditorFactories.RegisterAll(); m_Panel = UIElementsUtility.FindOrCreatePanel(m_LastTree, ContextType.Editor, new DataWatchService()); if (m_Panel.visualTree.styleSheets == null) { UIElementsEditorUtility.AddDefaultEditorStyleSheets(m_Panel.visualTree); m_Panel.visualTree.LoadStyleSheetsFromPaths(); } m_Panel.allowPixelCaching = false; dirty = true; } if (dirty) { m_Panel.visualTree.Clear(); m_Panel.visualTree.Add(m_Tree); } EditorGUI.DrawRect(r, EditorGUIUtility.isProSkin ? EditorGUIUtility.kDarkViewBackground : HostView.kViewColor); m_Panel.visualTree.layout = GUIClip.UnclipToWindow(r); m_Panel.visualTree.Dirty(ChangeType.Layout); m_Panel.visualTree.Dirty(ChangeType.Repaint); var oldState = SavedGUIState.Create(); int clips = GUIClip.Internal_GetCount(); while (clips > 0) { GUIClip.Pop(); clips--; } m_Panel.Repaint(Event.current); oldState.ApplyAndForget(); }
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; }
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() { 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); } }
public static Panel FindOrCreate(ScriptableObject ownerObject) { var id = ownerObject.GetInstanceID(); Panel panel; if (UIElementsUtility.TryGetPanel(id, out panel)) { return(panel); } panel = new EditorPanel(ownerObject); UIElementsUtility.RegisterCachedPanel(id, panel); return(panel); }
static void UpdateSchedulers() { DataWatchService.sharedInstance.PollNativeData(); UIElementsUtility.GetAllPanels(panelsIteration, ContextType.Editor); foreach (var panel in panelsIteration) { // Dispatch all timer update messages to each scheduled item panel.timerEventScheduler.UpdateScheduledEvents(); panel.UpdateAnimations(); panel.UpdateBindings(); } }
protected void OnDestroy() { if (m_LastTree != null) { UIElementsUtility.RemoveCachedPanel(m_LastTree.GetInstanceID()); } if (m_preview_texture != null) { m_preview_texture.Release(); m_preview_texture.DiscardContents(); DestroyImmediate(m_preview_texture); } }
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(); } } } }
//---------------------------------------------------------------------------------------------------------------------- void InitDefaultSISPlayableAssetFPSField(VisualElement parent) { //fps VisualElement fieldContainer = UIElementsUtility.AddElement <VisualElement>(parent, /*className=*/ "field-container"); SISUserSettings userSettings = SISUserSettings.GetInstance(); int defaultSISPlayableAssetFPS = userSettings.GetDefaultSISPlayableAssetFPS(); IntegerField defaultSISPlayableAssetFPSField = UIElementsUtility.AddField <IntegerField, int>(fieldContainer, Contents.DEFAULT_SIS_PLAYABLE_ASSET_FPS, defaultSISPlayableAssetFPS); defaultSISPlayableAssetFPSField.RegisterValueChangedCallback((ChangeEvent <int> evt) => { userSettings.SetDefaultSISPlayableAssetFPS(evt.newValue); userSettings.SaveUserSettings(); }); }
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(); } } }
static void UpdateSchedulers() { DataWatchService.sharedInstance.PollNativeData(); UIElementsUtility.GetAllPanels(panelsIteration); foreach (var panel in panelsIteration) { // 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(); panel.UpdateBindings(); } }
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); } }
public void Render(VisualTreeAsset vta, Rect r, GUIStyle background) { if (Event.current.type == EventType.Repaint && (r.width >= 100f || r.height >= 100f)) { bool flag = false; if (vta != this.m_LastTree || !this.m_LastTree) { this.m_LastTree = vta; this.m_Tree = vta.CloneTree(null); this.m_Tree.StretchToParentSize(); flag = true; } if (this.m_Panel == null) { UXMLEditorFactories.RegisterAll(); this.m_Panel = UIElementsUtility.FindOrCreatePanel(this.m_LastTree, ContextType.Editor, new DataWatchService()); if (this.m_Panel.visualTree.styleSheets == null) { UIElementsEditorUtility.AddDefaultEditorStyleSheets(this.m_Panel.visualTree); this.m_Panel.visualTree.LoadStyleSheetsFromPaths(); } this.m_Panel.allowPixelCaching = false; flag = true; } if (flag) { this.m_Panel.visualTree.Clear(); this.m_Panel.visualTree.Add(this.m_Tree); } EditorGUI.DrawRect(r, (!EditorGUIUtility.isProSkin) ? HostView.kViewColor : EditorGUIUtility.kDarkViewBackground); this.m_Panel.visualTree.layout = GUIClip.UnclipToWindow(r); this.m_Panel.visualTree.Dirty(ChangeType.Layout); this.m_Panel.visualTree.Dirty(ChangeType.Repaint); SavedGUIState savedGUIState = SavedGUIState.Create(); for (int i = GUIClip.Internal_GetCount(); i > 0; i--) { GUIClip.Pop(); } this.m_Panel.Repaint(Event.current); savedGUIState.ApplyAndForget(); } }