예제 #1
0
        /// <summary>
        ///
        /// </summary>
        private void RefreshBoneList()
        {
            BoneList.Nodes.Clear();
            Dictionary <SBBone, SBTreeNode> boneToNode = new Dictionary <SBBone, SBTreeNode>();

            if (SelectedSkeleton != null)
            {
                SelectedSkeleton = SelectedSkeleton as SBSkeleton;

                foreach (var bone in SelectedSkeleton.Bones)
                {
                    var node = new SBTreeNode(bone.Name)
                    {
                        Tag = bone
                    };
                    boneToNode.Add(bone, node);
                    if (bone.Parent == null)
                    {
                        BoneList.Nodes.Add(node);
                    }
                    else if (boneToNode.ContainsKey(bone.Parent))
                    {
                        boneToNode[bone.Parent].Nodes.Add(node);
                    }
                }
            }
            if (BoneList.Nodes.Count > 0)
            {
                BoneList.Nodes[0].ExpandAll();
            }
        }
예제 #2
0
        /// <summary>
        /// loads the bone nodes from a scene
        /// </summary>
        /// <param name="Scene"></param>
        public void LoadFromScene(SBScene Scene)
        {
            Nodes.Clear();
            Dictionary <SBBone, SBTreeNode> boneToNode = new Dictionary <SBBone, SBTreeNode>();

            if (Scene.Skeleton != null)
            {
                foreach (var bone in Scene.Skeleton.Bones)
                {
                    var node = new SBTreeNode(bone.Name)
                    {
                        Tag = bone
                    };
                    boneToNode.Add(bone, node);
                    if (bone.Parent == null)
                    {
                        Nodes.Add(node);
                    }
                    else if (boneToNode.ContainsKey(bone.Parent))
                    {
                        boneToNode[bone.Parent].Nodes.Add(node);
                    }
                }
            }
            if (Nodes.Count > 0)
            {
                Nodes[0].ExpandAll();
            }
        }
예제 #3
0
        private void Pick(SBTreeNode treeNode, Ray ray)
        {
            Vector3 close;

            if (treeNode.Tag is SBBone bone)
            {
                if (ray.CheckSphereHit(Vector3.TransformPosition(Vector3.Zero, bone.AnimatedWorldTransform), 0.5f, out close))
                {
                    BoneList.SelectedNode = treeNode;
                    return;
                }
            }

            foreach (var child in treeNode.Nodes)
            {
                Pick((SBTreeNode)child, ray);
            }
        }