Exemplo n.º 1
0
        protected override TreeViewItem BuildRoot()
        {
            m_boneMap.Clear();
            var root = new TreeViewItem {
                id = 0, depth = -1, displayName = m_root.name
            };
            var allItems = new List <TreeViewItem>();
            var bones    = m_root.GetComponentsInChildren <VRMSpringBone>();
            var id       = 1;

            for (int i = 0; i < bones.Length; ++i, ++id)
            {
                var bone = bones[i];

                m_boneMap.Add(id, bone);

                allItems.Add(new TreeViewItem
                {
                    id          = id,
                    displayName = bone.name,
                });
            }
            // Utility method that initializes the TreeViewItem.children and -parent for all items.
            SetupParentsAndChildrenFromDepths(root, allItems);

            // Return root of the tree
            return(root);
        }
Exemplo n.º 2
0
        public VRM10ControllerRuntime(VRM10Controller target)
        {
            m_target = target;
            var animator = target.GetComponent <Animator>();

            if (animator == null)
            {
                throw new Exception();
            }
            m_head = animator.GetBoneTransform(HumanBodyBones.Head);
            target.Vrm.LookAt.Setup(animator, m_head, target.LookAtTargetType, target.Gaze);
            target.Vrm.Expression.Setup(target, target.Vrm.LookAt, target.Vrm.LookAt.EyeDirectionApplicable);

            if (m_constraints == null)
            {
                m_constraints = target.GetComponentsInChildren <VRM10Constraint>();
            }
        }