コード例 #1
0
 private void AddChildrenRecursive(BoneTreeElement element, TreeViewItem item)
 {
     foreach (var childElement in element.Children)
     {
         var childItem = CreateTreeViewItem(childElement);
         item.AddChild(childItem);
         AddChildrenRecursive(childElement, childItem);
     }
 }
コード例 #2
0
        private BoneTreeElement BoneInfoToBoneTreeView(BoneInfo bone, ref int id)
        {
            var element = new BoneTreeElement {
                Id = ++id, Name = bone.boneTrans.name, Bone = bone
            };

            if (bone.childs != null && bone.childs.Count() > 0)
            {
                foreach (var child in bone.childs)
                {
                    var childElement = BoneInfoToBoneTreeView(child, ref id);
                    element.AddChild(childElement);
                }
            }

            return(element);
        }
コード例 #3
0
        private BoneTreeView CreateBoneTreeView(List <BoneInfo> rootBoneInfos, TreeViewState treeViewState)
        {
            var treeView  = new BoneTreeView(treeViewState);
            var currentId = 0;
            var root      = new BoneTreeElement {
                Id = ++currentId, Name = "Bones"
            };

            for (int i = 0; i < rootBoneInfos.Count(); i++)
            {
                root.AddChild(BoneInfoToBoneTreeView(rootBoneInfos[i], ref currentId));
            }
            treeView.Setup(new List <BoneTreeElement> {
                root
            }.ToArray());

            return(treeView);
        }
コード例 #4
0
 private TreeViewItem CreateTreeViewItem(BoneTreeElement model)
 {
     return(new BoneTreeElement {
         id = model.Id, displayName = model.Name, Bone = model.Bone
     });
 }
コード例 #5
0
 public void AddChild(BoneTreeElement child)
 {
     Children.Add(child);
 }