protected override TreeViewItem BuildRoot()
            {
                var root = new TreeViewItem(-1, -1);

                root.children = new List <TreeViewItem>();
                foreach (var k in m_Preview.m_Entries)
                {
                    root.AddChild(new Item(k));
                }

                return(root);
            }
Example #2
0
        protected override TreeViewItem BuildRoot()
        {
            var idForHiddenRoot    = -1;
            var depthForHiddenRoot = -1;
            var root = new TreeViewItem(idForHiddenRoot, depthForHiddenRoot, "root");

            var depth = 0;

            var top = new SelectionWindowTreeViewItem(-1, depth, m_AllIdentifier.name, m_AllIdentifier);

            root.AddChild(top);

            var expandList = new List <int> {
                -1
            };
            var lastName = "";
            var node     = root;

            for (var index = 0; index < m_Names.Length; ++index)
            {
                var nameWithIndex = m_Names[index];
                if (nameWithIndex == m_AllIdentifier.nameWithIndex)
                {
                    continue;
                }

                var identifier = new TreeItemIdentifier(nameWithIndex);
                var item       = new SelectionWindowTreeViewItem(index, depth, m_Names[index], identifier);

                if (identifier.name != lastName)
                {
                    // New items at root
                    node  = top;
                    depth = 0;
                }

                node.AddChild(item);

                if (identifier.name != lastName)
                {
                    // Extra instances hang of the parent
                    lastName = identifier.name;
                    node     = item;
                    depth    = 1;
                }
            }

            SetExpanded(expandList);

            SetupDepthsFromParentsAndChildren(root);

            return(root);
        }
Example #3
0
        private void Recurse(TreeViewItem tree, VisualElement elt)
        {
            VisualTreeItem visualTreeItem = new VisualTreeItem(elt, tree.depth + 1);

            tree.AddChild(visualTreeItem);
            IEnumerable <VisualElement> enumerable = (!this.includeShadowHierarchy) ? ((elt.contentContainer != null) ? elt.Children() : Enumerable.Empty <VisualElement>()) : elt.shadow.Children();

            foreach (VisualElement current in enumerable)
            {
                this.Recurse(visualTreeItem, current);
            }
        }
Example #4
0
            private void AddValueItem <TValue>(TreeViewItem parent, string name, TValue value, ref int id)
            {
                var item = new ConfigurationItem
                {
                    id          = id++,
                    depth       = parent.depth + 1,
                    displayName = $"{name}: {value.ToString()}",
                    name        = name
                };

                parent.AddChild(item);
            }
Example #5
0
            private TreeViewItem AddChild(TreeViewItem parent, string displayName, ref int id)
            {
                var item = new TreeViewItem
                {
                    id          = id++,
                    depth       = parent.depth + 1,
                    displayName = displayName
                };

                parent.AddChild(item);
                return(item);
            }
Example #6
0
        private static TreeViewItem GetTreeViewItem(ToolBagPrintData baseData)
        {
            TreeViewItem        item     = new TreeViewItem(0, -1, "Root");
            List <TreeViewItem> itemList = GetChildItems(1, baseData.childDataList);

            if (itemList != null)
            {
                itemList.ForEach(x => item.AddChild(x));
            }

            return(item);
        }
        void BuildFromSerializedObject(TreeViewItem root)
        {
            m_SerializedObject.Update();
            var actionMapsProperty = m_SerializedObject.FindProperty("m_ActionMaps");

            for (var i = 0; i < actionMapsProperty.arraySize; i++)
            {
                var actionMapItem = new ActionMapTreeItem(actionMapsProperty, i);
                ParseActionMap(actionMapItem, actionMapsProperty.GetArrayElementAtIndex(i), 1);
                root.AddChild(actionMapItem);
            }
        }
        public TreeViewItem BuildTree(PackedMemorySnapshot snapshot)
        {
            m_Snapshot           = snapshot;
            m_UniqueId           = 1;
            m_ManagedObjectCount = 0;
            m_ManagedObjectSize  = 0;

            var root = new TreeViewItem {
                id = 0, depth = -1, displayName = "Root"
            };

            if (m_Snapshot == null || m_Snapshot.managedObjects == null || m_Snapshot.managedObjects.Length == 0)
            {
                root.AddChild(new TreeViewItem {
                    id = 1, depth = -1, displayName = ""
                });
                return(root);
            }

            OnBeforeBuildTree();
            OnBuildTree(root);

            // remove groups if it contains one item only
            if (root.hasChildren)
            {
                for (int n = root.children.Count - 1; n >= 0; --n)
                {
                    var group = root.children[n];
                    if (group.children.Count == 1)
                    {
                        group.children[0].depth -= 1;
                        root.AddChild(group.children[0]);
                        root.children.RemoveAt(n);
                        continue;
                    }
                }
            }

            return(root);
        }
Example #9
0
        protected override TreeViewItem BuildRoot()
        {
            var root = new TreeViewItem(-1, -1);

            root.children = new List <TreeViewItem>();
            if (m_InspectTab == null)
            {
                Debug.Log("Unknown problem in AssetBundle Browser Inspect tab.  Restart Browser and try again, or file ticket on github.");
            }
            else
            {
                foreach (var folder in m_InspectTab.BundleList)
                {
                    Debug.Log("folder" + folder);
                    if (System.String.IsNullOrEmpty(folder.Key))
                    {
                        foreach (var path in folder.Value)
                        {
                            root.AddChild(new InspectTreeItem(path, 0));
                        }
                    }
                    else
                    {
                        var folderItem = new TreeViewItem(folder.Key.GetHashCode(), 0, folder.Key);
                        foreach (var path in folder.Value)
                        {
                            var prettyName = path;
                            if (path.StartsWith(folder.Key))                             //how could it not?
                            {
                                prettyName = path.Remove(0, folder.Key.Length + 1);
                            }

                            folderItem.AddChild(new InspectTreeItem(path, folder.Key, 1, prettyName));
                        }
                        root.AddChild(folderItem);
                    }
                }
            }
            return(root);
        }
Example #10
0
        protected void ParseBindings(TreeViewItem parent, string actionMapName, string actionName, SerializedProperty bindingsArrayProperty, int depth)
        {
            bool actionSearchMatched = IsSearching() && actionName.ToLower().Contains(m_NameFilter.ToLower());
            var  bindingsCount       = InputActionSerializationHelpers.GetBindingCount(bindingsArrayProperty, actionName);
            CompositeGroupTreeItem compositeGroupTreeItem = null;

            for (var j = 0; j < bindingsCount; j++)
            {
                var bindingProperty = InputActionSerializationHelpers.GetBinding(bindingsArrayProperty, actionName, j);
                var bindingsItem    = new BindingTreeItem(actionMapName, bindingProperty, j);
                bindingsItem.depth = depth;
                if (!string.IsNullOrEmpty(m_GroupFilter) && !bindingsItem.groups.Split(';').Contains(m_GroupFilter))
                {
                    continue;
                }
                if (bindingsItem.isComposite)
                {
                    compositeGroupTreeItem       = new CompositeGroupTreeItem(actionMapName, bindingProperty, j);
                    compositeGroupTreeItem.depth = depth;
                    parent.AddChild(compositeGroupTreeItem);
                    continue;
                }
                if (bindingsItem.isPartOfComposite)
                {
                    var compositeItem = new CompositeTreeItem(actionMapName, bindingProperty, j);
                    compositeItem.depth = depth + 1;
                    if (compositeGroupTreeItem != null)
                    {
                        compositeGroupTreeItem.AddChild(compositeItem);
                    }
                    continue;
                }
                compositeGroupTreeItem = null;
                if (!actionSearchMatched && IsSearching() && !bindingsItem.path.ToLower().Contains(m_NameFilter.ToLower()))
                {
                    continue;
                }
                parent.AddChild(bindingsItem);
            }
        }
        void BuildResults(TreeViewItem root, List <AnalyzeRule.AnalyzeResult> ruleResults)
        {
            hashToAnalyzeResults.Clear();
            int updateFrequency = Mathf.Max(ruleResults.Count / 10, 1);

            for (int index = 0; index < ruleResults.Count; ++index)
            {
                var result = ruleResults[index];
                if (index == 0 || index % updateFrequency == 0)
                {
                    EditorUtility.DisplayProgressBar("Building Results Tree...", result.resultName, (float)index / hashToAnalyzeResults.Keys.Count);
                }

                var          resPath = result.resultName.Split(AnalyzeRule.kDelimiter);
                string       name    = string.Empty;
                TreeViewItem parent  = root;

                for (int i = 0; i < resPath.Length; i++)
                {
                    name += resPath[i];
                    int hash = name.GetHashCode();

                    if (!hashToAnalyzeResults.ContainsKey(hash))
                    {
                        AnalyzeResultsTreeViewItem item = new AnalyzeResultsTreeViewItem(hash, i + m_CurrentDepth, resPath[i], result.severity, result);
                        hashToAnalyzeResults.Add(item.id, item);
                        parent.AddChild(item);
                        parent = item;
                    }
                    else
                    {
                        var targetItem = hashToAnalyzeResults[hash];
                        targetItem.results.Add(result);
                        parent = targetItem;
                    }
                }
            }

            EditorUtility.ClearProgressBar();

            List <TreeViewItem> allTreeViewItems = new List <TreeViewItem>();

            allTreeViewItems.Add(root);
            allTreeViewItems.AddRange(root.children);

            foreach (var node in allTreeViewItems)
            {
                (node as AnalyzeTreeViewItemBase)?.AddIssueCountToName();
            }

            AnalyzeSystem.SerializeData();
        }
    protected void CreateFolderContext(object item)
    {
        TreeViewItem root = item as TreeViewItem;
        TreeViewItem itm  = new TreeViewItem(freeID);

        freeID         += 1;
        itm.displayName = "Folder";
        itm.icon        = m_FolderIcone;
        root.AddChild(itm);

        SetupDepthsFromParentsAndChildren(root);
        SetExpanded(itm.id, true);
    }
Example #13
0
        protected override TreeViewItem BuildRoot()
        {
            var root = new TreeViewItem {
                depth = -1
            };

            foreach (var n in m_list)
            {
                root.AddChild(n);
            }

            return(root);
        }
 private void AddChildrenRecursive(GameSimParametersTreeElement element, TreeViewItem item, IList <TreeViewItem> rows)
 {
     foreach (var childElement in element.Children)
     {
         var childItem = CreateTreeViewItem(childElement);
         item.AddChild(childItem);
         rows.Add(childItem);
         if (childElement.Children.Count >= 1)
         {
             childItem.children = CreateChildListForCollapsedParent();
         }
     }
 }
Example #15
0
        private TreeViewItem CreatePayloadDescribingItem(object telegramPayload, int depth)
        {
            var name = $"Payload: {telegramPayload.GetType()}";
            var item = new TreeViewItem(_lastTreeItemId++, depth, name);

            foreach (var fi in telegramPayload.GetType().GetFields())
            {
                var fieldName = $"Field {fi.Name} : {fi.GetValue(telegramPayload)}";
                var fieldItem = new TreeViewItem(_lastTreeItemId++, depth + 1, fieldName);
                item.AddChild(fieldItem);
            }
            return(item);
        }
Example #16
0
        private TreeViewItem CreateTaskSnapshotItem(AiRegistryTaskSnapshot snapshot, int depth)
        {
            var item = new TreeViewItem(_lastTreeItemId++, depth, GetTaskName(snapshot.TaskWithStatus.Task) + " InStatus:" + snapshot.TaskWithStatus.Status);

            foreach (var child in snapshot.Children)
            {
                var childItem = CreateTaskSnapshotItem(child, depth + 1);
                var callInfo  = snapshot.ChildCalls.FirstOrDefault(c => c.TaskAfterCall.Task == child.TaskWithStatus.Task);
                UpdateTreeViewItemWithCallInfo(childItem, callInfo);
                item.AddChild(childItem);
            }
            return(item);
        }
        public TreeViewItem BuildTree(PackedMemorySnapshot snapshot)
        {
            m_Snapshot = snapshot;
            m_UniqueId = 1;

            var root = new TreeViewItem {
                id = 0, depth = -1, displayName = "Root"
            };

            if (m_Snapshot == null)
            {
                root.AddChild(new TreeViewItem {
                    id = 1, depth = -1, displayName = ""
                });
                return(root);
            }

            for (int n = 0, nend = m_Snapshot.managedStaticTypes.Length; n < nend; ++n)
            {
                if (window.isClosing) // the window is closing
                {
                    break;
                }

                var type = m_Snapshot.managedTypes[m_Snapshot.managedStaticTypes[n]];

                var group = new StaticTypeItem
                {
                    id          = m_UniqueId++,
                    depth       = 0,
                    displayName = ""
                };
                group.Initialize(this, m_Snapshot, type);

                root.AddChild(group);
            }

            return(root);
        }
Example #18
0
        protected override TreeViewItem BuildRoot()
        {
            TreeViewItem root = new TreeViewItem(-1, -1, "Root");

            root.children = new List <TreeViewItem> ();

            for (int i = 0; i < list.ElementCount; i++)
            {
                root.AddChild(new TreeViewItem(list.State.UniqueID + i, -1, "Element"));
            }

            return(root);
        }
 protected override TreeViewItem BuildRoot()
 {
     mRoot          = new TreeViewItem();
     mRoot.id       = -1;
     mRoot.depth    = -1;
     mRoot.children = new List <TreeViewItem>();
     foreach (AssetMode.GroupInfo name in AssetMode.gropsEditorInfo)
     {
         var t = new TreeViewItem(name.NameHashCode, name.NameHashCode, name.Name);
         mRoot.AddChild(t);
     }
     return(mRoot);
 }
        protected override TreeViewItem BuildRoot()
        {
            //return new TreeViewItem<T>(m_TreeModel.root.id, depthForHiddenRoot, m_TreeModel.root.name, m_TreeModel.root);
            m_root = new TreeViewItem(0, -1, "Root");

            for (int i = 0; i < m_itemList.Count; i++)
            {
                m_root.AddChild(m_itemList[i]);
            }

            //SetupDepthsFromParentsAndChildren(m_root);
            return(m_root);
        }
Example #21
0
 private void AddFilteredNodesRecursive(TreeViewItem rootNode, Transform theTransform, int depth = 0, string Filter = "")
 {
     boneTreeView.NodeCount++;
     if (theTransform.name.ToLower().Contains(Filter))
     {
         TreeViewItem Node = new TreeViewItem(boneTreeView.NodeCount, depth, theTransform.name);
         rootNode.AddChild(Node);
     }
     foreach (Transform t in theTransform)
     {
         AddFilteredNodesRecursive(rootNode, t, depth++, Filter);
     }
 }
        protected override TreeViewItem BuildRoot()
        {
            componentGroupsById = new Dictionary <int, ComponentGroup>();
            var currentID = 0;
            var root      = new TreeViewItem {
                id = currentID++, depth = -1, displayName = "Root"
            };

            if (currentSystem == null)
            {
                root.AddChild(new TreeViewItem {
                    id = currentID++, displayName = "No Manager selected"
                });
            }
            else if (currentSystem.ComponentGroups.Length == 0)
            {
                root.AddChild(new TreeViewItem {
                    id = currentID++, displayName = "No Component Groups in Manager"
                });
            }
            else
            {
                var groupIndex = 0;
                foreach (var group in currentSystem.ComponentGroups)
                {
                    componentGroupsById.Add(currentID, group);
                    var types     = group.Types;
                    var groupName = string.Join(", ", (from x in types select x.Name).ToArray());

                    var groupItem = new TreeViewItem {
                        id = currentID++, displayName = string.Format("({1}):", groupIndex, groupName)
                    };
                    root.AddChild(groupItem);
                    ++groupIndex;
                }
                SetupDepthsFromParentsAndChildren(root);
            }
            return(root);
        }
Example #23
0
        public new static CompositeBindingTreeItem AddTo(TreeViewItem parent, SerializedProperty bindingProperty)
        {
            var item = new CompositeBindingTreeItem(bindingProperty);

            item.depth       = parent.depth + 1;
            item.displayName = !string.IsNullOrEmpty(item.name)
                ? item.name
                : ObjectNames.NicifyVariableName(NameAndParameters.ParseName(item.path));

            parent.AddChild(item);

            return(item);
        }
Example #24
0
        protected override TreeViewItem BuildRoot()
        {
            var root = new TreeViewItem(0, -1, "Root");

            foreach (var t in DebuggerState._functionCalls)
            {
                root.AddChild(t);
            }

            SetupDepthsFromParentsAndChildren(root);

            return(root);
        }
        private void ParseAction(TreeViewItem parentTreeItem, SerializedProperty actionMapProperty, SerializedProperty actionsArrayProperty, int index, int depth)
        {
            var bindingsArrayProperty = actionMapProperty.FindPropertyRelative("m_Bindings");
            var actionMapName = actionMapProperty.FindPropertyRelative("m_Name").stringValue;
            var actionProperty = actionsArrayProperty.GetArrayElementAtIndex(index);

            var actionItem = new ActionTreeItem(actionMapProperty, actionProperty, index);
            actionItem.depth = depth;
            var actionName = actionItem.actionName;

            ParseBindings(actionItem, actionMapName, actionName, bindingsArrayProperty, depth + 1);

            bool actionSearchMatched = IsSearching() && actionName.ToLower().Contains(m_NameFilter.ToLower());
            if (actionSearchMatched || IsSearching() && actionItem.children != null && actionItem.children.Any())
            {
                parentTreeItem.AddChild(actionItem);
            }
            else if (!IsSearching())
            {
                parentTreeItem.AddChild(actionItem);
            }
        }
Example #26
0
            private TreeViewItem AddChild(TreeViewItem parent, string displayName, ref int id, Texture2D icon = null)
            {
                var item = new TreeViewItem
                {
                    id          = id++,
                    depth       = parent.depth + 1,
                    displayName = displayName,
                    icon        = icon,
                };

                parent.AddChild(item);
                return(item);
            }
Example #27
0
        void AddGroupChildrenBuild(AddressableAssetGroup group, TreeViewItem root)
        {
            var groupItem = new AssetEntryTreeViewItem(group, 0);

            root.AddChild(groupItem);
            if (group.entries.Count > 0)
            {
                foreach (var entry in group.entries)
                {
                    AddAndRecurseEntriesBuild(entry, groupItem, 1);
                }
            }
        }
Example #28
0
        public SpringBoneTreeView(TreeViewState state, Vrm10Instance target, SerializedObject so) : base(state)
        {
            Target = target;
            _so    = so;

            _root = new TreeViewItem(_nextNodeID++, -1, "Root");
            var springBone = new TreeViewItem(_nextNodeID++, 0, "SpringBone");

            _root.AddChild(springBone);

            _colliderGroups = new TreeViewItem(_nextNodeID++, 1, "ColliderGroups");
            springBone.AddChild(_colliderGroups);

            _springs = new TreeViewItem(_nextNodeID++, 1, "Springs");
            springBone.AddChild(_springs);

            // load
            _map = new Dictionary <int, object>();
            for (var i = 0; i < target.SpringBone.ColliderGroups.Count; ++i)
            {
                var colliderGroup = target.SpringBone.ColliderGroups[i];
                var name          = colliderGroup.GUIName(i);
                var id            = _nextNodeID++;
                var item          = new TreeViewItem(id, 2, name);
                _map.Add(id, colliderGroup);
                _colliderGroups.AddChild(item);
            }

            for (var i = 0; i < target.SpringBone.Springs.Count; ++i)
            {
                var spring = target.SpringBone.Springs[i];
                var name   = spring.GUIName(i);
                var id     = _nextNodeID++;
                var item   = new TreeViewItem(id, 2, name);
                _map.Add(id, spring);
                _springs.AddChild(item);
            }
        }
        //public TreeViewItem BuildTree(PackedMemorySnapshot snapshot, bool removeUnalignedSections = false)
        public TreeViewItem BuildTree(PackedMemorySnapshot snapshot, PackedMemorySection[] sections)
        {
            m_Snapshot = snapshot;
            m_UniqueId = 1;

            var root = new TreeViewItem {
                id = 0, depth = -1, displayName = "Root"
            };

            if (m_Snapshot == null)
            {
                root.AddChild(new TreeViewItem {
                    id = 1, depth = -1, displayName = ""
                });
                return(root);
            }

            for (int n = 0, nend = sections.Length; n < nend; ++n)
            {
                if (window.isClosing) // the window is closing
                {
                    break;
                }

                var section = sections[n];

                var item = new HeapSectionItem()
                {
                    id    = m_UniqueId++,
                    depth = root.depth + 1,
                };

                item.Initialize(this, m_Snapshot, section.arrayIndex);
                root.AddChild(item);
            }

            return(root);
        }
Example #30
0
        private void ParseAction(TreeViewItem parentTreeItem, SerializedProperty actionMapProperty, SerializedProperty actionsArrayProperty, int index, int depth)
        {
            var bindingsArrayProperty = actionMapProperty.FindPropertyRelative("m_Bindings");
            var actionMapName         = actionMapProperty.FindPropertyRelative("m_Name").stringValue;
            var actionProperty        = actionsArrayProperty.GetArrayElementAtIndex(index);

            var actionItem = new ActionTreeItem(actionMapProperty, actionProperty, index);

            actionItem.depth = depth;
            var actionName = actionItem.actionName;

            ParseBindings(actionItem, actionMapName, actionName, bindingsArrayProperty, depth + 1);
            parentTreeItem.AddChild(actionItem);
        }