private void RecursiveComputeEnabledStateForFolders(PackageExportTreeView.PackageExportTreeViewItem pitem, HashSet<PackageExportTreeView.PackageExportTreeViewItem> done) { if (!pitem.isFolder) return; if (pitem.hasChildren) { using (List<TreeViewItem>.Enumerator enumerator = pitem.children.GetEnumerator()) { while (enumerator.MoveNext()) this.RecursiveComputeEnabledStateForFolders(enumerator.Current as PackageExportTreeView.PackageExportTreeViewItem, done); } } if (done.Contains(pitem)) return; PackageExportTreeView.EnabledState childrenEnabledState = this.GetFolderChildrenEnabledState(pitem); pitem.enabledState = childrenEnabledState; if (childrenEnabledState != PackageExportTreeView.EnabledState.Mixed) return; done.Add(pitem); for (PackageExportTreeView.PackageExportTreeViewItem parent = pitem.parent as PackageExportTreeView.PackageExportTreeViewItem; parent != null; parent = parent.parent as PackageExportTreeView.PackageExportTreeViewItem) { if (!done.Contains(parent)) { parent.enabledState = PackageExportTreeView.EnabledState.Mixed; done.Add(parent); } } }
public PackageExportTreeViewDataSource(TreeViewController treeView, PackageExportTreeView view) : base(treeView) { m_PackageExportView = view; rootIsCollapsable = false; showRootItem = false; }
public PackageExportTreeViewDataSource(TreeView treeView, PackageExportTreeView view) : base(treeView) { this.m_PackageExportView = view; this.rootIsCollapsable = false; this.showRootNode = false; }
private void TreeViewArea(bool showLoadingScreen) { Rect treeAreaRect = GUILayoutUtility.GetRect(1, 9999, 1, 99999); if (showLoadingScreen) { GUI.Label(treeAreaRect, "Loading...", Styles.loadingTextStyle); return; } if (m_ExportPackageItems != null && m_ExportPackageItems.Length > 0) { if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); } if (m_Tree == null) { m_Tree = new PackageExportTreeView(this, m_TreeViewState, new Rect()); } m_Tree.OnGUI(treeAreaRect); } }
private void TreeViewArea(bool showLoadingScreen) { Rect rect = GUILayoutUtility.GetRect(1f, 9999f, 1f, 99999f); if (showLoadingScreen) { GUI.Label(rect, "Loading...", PackageExport.Styles.loadingTextStyle); } else { if (this.m_ExportPackageItems == null || this.m_ExportPackageItems.Length <= 0) { return; } if (this.m_TreeViewState == null) { this.m_TreeViewState = new TreeViewState(); } if (this.m_Tree == null) { this.m_Tree = new PackageExportTreeView(this, this.m_TreeViewState, new Rect()); } this.m_Tree.OnGUI(rect); } }
private void BuildAssetList() { this.UnscheduleBuildAssetList(); this.m_ExportPackageItems = PackageExport.GetAssetItemsForExport(Selection.assetGUIDsDeepSelection, this.m_IncludeDependencies).ToArray <ExportPackageItem>(); this.m_Tree = null; this.m_TreeViewState = null; base.Repaint(); }
public PackageExportTreeViewGUI(TreeView treeView, PackageExportTreeView view) : base(treeView) { this.m_PackageExportView = view; base.k_BaseIndent = 4f; if (!PackageExportTreeView.s_UseFoldouts) { base.k_FoldoutWidth = 0f; } }
public PackageExportTreeViewGUI(TreeViewController treeView, PackageExportTreeView view) : base(treeView) { m_PackageExportView = view; k_BaseIndent = 4f; if (!s_UseFoldouts) { k_FoldoutWidth = 0f; } }
public PackageExportTreeViewGUI(TreeView treeView, PackageExportTreeView view) : base(treeView) { this.m_PackageExportView = view; this.k_BaseIndent = 4f; if (PackageExportTreeView.s_UseFoldouts) { return; } this.k_FoldoutWidth = 0.0f; }
private void BuildAssetList() { UnscheduleBuildAssetList(); m_ExportPackageItems = GetAssetItemsForExport(Selection.assetGUIDsDeepSelection, m_IncludeDependencies).ToArray(); // GUI is reconstructed in OnGUI (when needed) m_Tree = null; m_TreeViewState = null; Repaint(); }
private PackageExportTreeView.EnabledState GetFolderChildrenEnabledState(PackageExportTreeView.PackageExportTreeViewItem folder) { if (!folder.isFolder) Debug.LogError((object) "Should be a folder item!"); if (!folder.hasChildren) return PackageExportTreeView.EnabledState.None; PackageExportTreeView.EnabledState enabledState1 = PackageExportTreeView.EnabledState.NotSet; PackageExportTreeView.EnabledState enabledState2 = (folder.children[0] as PackageExportTreeView.PackageExportTreeViewItem).enabledState; for (int index = 1; index < folder.children.Count; ++index) { PackageExportTreeView.PackageExportTreeViewItem child = folder.children[index] as PackageExportTreeView.PackageExportTreeViewItem; if (enabledState2 != child.enabledState) { enabledState1 = PackageExportTreeView.EnabledState.Mixed; break; } } if (enabledState1 == PackageExportTreeView.EnabledState.NotSet) enabledState1 = enabledState2 != PackageExportTreeView.EnabledState.All ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All; return enabledState1; }
public void SetAllEnabled(PackageExportTreeView.EnabledState enabled) { this.EnableChildrenRecursive(this.m_TreeView.data.root, enabled); this.ComputeEnabledStateForFolders(); }
private void EnableChildrenRecursive(TreeViewItem parentItem, PackageExportTreeView.EnabledState enabled) { if (!parentItem.hasChildren) return; using (List<TreeViewItem>.Enumerator enumerator = parentItem.children.GetEnumerator()) { while (enumerator.MoveNext()) { PackageExportTreeView.PackageExportTreeViewItem current = enumerator.Current as PackageExportTreeView.PackageExportTreeViewItem; current.enabledState = enabled; this.EnableChildrenRecursive((TreeViewItem) current, enabled); } } }
public PackageExportTreeViewGUI(TreeView treeView, PackageExportTreeView view) : base(treeView) { this.m_PackageExportView = view; this.k_BaseIndent = 4f; if (PackageExportTreeView.s_UseFoldouts) return; this.k_FoldoutWidth = 0.0f; }
private static void Toggle(ExportPackageItem[] items, PackageExportTreeView.PackageExportTreeViewItem pitem, Rect toggleRect) { bool flag1 = pitem.enabledState > PackageExportTreeView.EnabledState.None; GUIStyle style = EditorStyles.toggle; if (pitem.isFolder && pitem.enabledState == PackageExportTreeView.EnabledState.Mixed) style = EditorStyles.toggleMixed; bool flag2 = GUI.Toggle(toggleRect, flag1, GUIContent.none, style); if (flag2 == flag1) return; pitem.enabledState = !flag2 ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All; }
private void BuildAssetList() { this.m_ExportPackageItems = PackageExport.GetAssetItemsForExport((ICollection<string>) Selection.assetGUIDsDeepSelection, this.m_IncludeDependencies).ToArray<ExportPackageItem>(); this.m_Tree = (PackageExportTreeView) null; this.m_TreeViewState = (TreeViewState) null; }
private void TreeViewArea(bool showLoadingScreen) { Rect rect = GUILayoutUtility.GetRect(1f, 9999f, 1f, 99999f); if (showLoadingScreen) { GUI.Label(rect, "Loading...", PackageExport.Styles.loadingTextStyle); } else { if (this.m_ExportPackageItems == null || this.m_ExportPackageItems.Length <= 0) return; if (this.m_TreeViewState == null) this.m_TreeViewState = new TreeViewState(); if (this.m_Tree == null) this.m_Tree = new PackageExportTreeView(this, this.m_TreeViewState, new Rect()); this.m_Tree.OnGUI(rect); } }
private static void Toggle(ExportPackageItem[] items, PackageExportTreeView.PackageExportTreeViewItem pitem, Rect toggleRect) { bool flag = pitem.enabledState > PackageExportTreeView.EnabledState.None; GUIStyle toggle = EditorStyles.toggle; if (pitem.isFolder && (pitem.enabledState == PackageExportTreeView.EnabledState.Mixed)) { toggle = EditorStyles.toggleMixed; } bool flag3 = GUI.Toggle(toggleRect, flag, GUIContent.none, toggle); if (flag3 != flag) { pitem.enabledState = !flag3 ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All; } }
private void DoToggle(PackageExportTreeView.PackageExportTreeViewItem pitem, Rect toggleRect) { EditorGUI.BeginChangeCheck(); Toggle(this.m_PackageExportView.items, pitem, toggleRect); if (EditorGUI.EndChangeCheck()) { if ((base.m_TreeView.GetSelection().Length <= 1) || !Enumerable.Contains<int>(base.m_TreeView.GetSelection(), pitem.id)) { int[] selectedIDs = new int[] { pitem.id }; base.m_TreeView.SetSelection(selectedIDs, false); base.m_TreeView.NotifyListenersThatSelectionChanged(); } if (this.itemWasToggled != null) { this.itemWasToggled(pitem); } Event.current.Use(); } }
private void DoIconAndText(PackageExportTreeView.PackageExportTreeViewItem item, Rect contentRect, bool selected, bool focused) { EditorGUIUtility.SetIconSize(new Vector2(base.k_IconWidth, base.k_IconWidth)); GUIStyle lineStyle = TreeViewGUI.s_Styles.lineStyle; lineStyle.padding.left = 0; if (Event.current.type == EventType.Repaint) { lineStyle.Draw(contentRect, GUIContent.Temp(item.displayName, this.GetIconForItem(item)), false, false, selected, focused); } EditorGUIUtility.SetIconSize(Vector2.zero); }
public PackageExportTreeViewGUI(TreeViewController treeView, PackageExportTreeView view) : base(treeView) { this.k_FoldoutWidth = 12f; this.m_PackageExportView = view; base.k_BaseIndent = 4f; if (!PackageExportTreeView.s_UseFoldouts) { this.k_FoldoutWidth = 0f; } }
public PackageExportTreeViewDataSource(TreeViewController treeView, PackageExportTreeView view) : base(treeView) { this.m_PackageExportView = view; base.rootIsCollapsable = false; base.showRootItem = false; }
private void BuildAssetList() { this.m_ExportPackageItems = PackageExport.GetAssetItemsForExport((ICollection <string>)Selection.assetGUIDsDeepSelection, this.m_IncludeDependencies).ToArray <ExportPackageItem>(); this.m_Tree = (PackageExportTreeView)null; this.m_TreeViewState = (TreeViewState)null; }
private void ItemWasToggled(PackageExportTreeView.PackageExportTreeViewItem pitem) { if (this.m_Selection.Count <= 1) { this.EnableChildrenRecursive((TreeViewItem) pitem, pitem.enabledState); } else { using (List<PackageExportTreeView.PackageExportTreeViewItem>.Enumerator enumerator = this.m_Selection.GetEnumerator()) { while (enumerator.MoveNext()) enumerator.Current.enabledState = pitem.enabledState; } } this.ComputeEnabledStateForFolders(); }
private void DoToggle(PackageExportTreeView.PackageExportTreeViewItem pitem, Rect toggleRect) { EditorGUI.BeginChangeCheck(); PackageExportTreeView.PackageExportTreeViewGUI.Toggle(this.m_PackageExportView.items, pitem, toggleRect); if (!EditorGUI.EndChangeCheck()) return; if (this.m_TreeView.GetSelection().Length <= 1 || !((IEnumerable<int>) this.m_TreeView.GetSelection()).Contains<int>(pitem.id)) { this.m_TreeView.SetSelection(new int[1]{ pitem.id }, 0 != 0); this.m_TreeView.NotifyListenersThatSelectionChanged(); } if (this.itemWasToggled != null) this.itemWasToggled(pitem); Event.current.Use(); }