Exemple #1
0
        private static void AddTreeViewItem(IList <TreeViewItem> rows, BoneCache bone, BoneCache[] bones, int depth)
        {
            var item = new TreeViewItemBase <BoneCache>(bone.GetInstanceID(), -1, bone.name, bone);

            item.depth = depth;
            rows.Add(item);

            foreach (var childBone in bones.Where(x => x.parentBone == bone))
            {
                AddTreeViewItem(rows, childBone, bones, depth + 1);
            }
        }
        private static void AddTreeViewItem(IList <TreeViewItem> rows, BoneCache bone, BoneCache[] bones, int depth)
        {
            var item = new TreeViewItemBase <BoneCache>(bone.GetInstanceID(), depth, bone.name, bone);

            rows.Add(item);

            var children = bones.Where(x => x.parentBone == bone).ToArray();

            System.Array.Sort(children, (a, b) => a.siblingIndex.CompareTo(b.siblingIndex));

            foreach (var childBone in children)
            {
                AddTreeViewItem(rows, childBone, bones, depth + 1);
            }
        }