Пример #1
0
    public UnityAvatarData getAvatarData(UnityScene unityScene, string refName = null)
    {
        UnityAvatarRenderer renderer = getAvatarRenderer();
        UnityAvatarData     avatar   = null;

        if (null == refName)
        {
            refName = renderer.avatar;
        }

        if (null == refName)
        {
            return(null);
        }

        if (unityScene.avatarObj.ContainsKey(refName))
        {
            avatar = unityScene.avatarObj[refName];
        }
        else
        {
            avatar = new UnityAvatarData();
            unityScene.avatarObj.Add(refName, avatar);
        }

        renderer.avatar = refName;

        return(avatar);
    }
Пример #2
0
        public override object parser(GameObject _object, Component component, UnityScene unityScene)
        {
            Animator animator = component as Animator;
            string   path     = AssetDatabase.GetAssetPath(animator.avatar);

            if ("" == path)
            {
                return(null);
            }

            UnityAvatarData avataData = null;

            UnityAvatarRenderer avatar = unityScene.getAvatarRenderer();

            if (true == unityScene.avatarObj.ContainsKey(path))
            {
                avataData = unityScene.avatarObj[path];
            }
            else
            {
                avataData = unityScene.getAvatarData(unityScene, path);
                //step1 : parser Nodes
                avataData.root = toNodes(_object, unityScene, path);
                //step2 : parser meshs
                toAvatar(_object, unityScene);

                avataData.refName = getRefName(path);

                unityScene.avatarObj[path] = avataData;
            }

            avatar.avatar = avataData.refName;

            //step3 : parser animation
            if (animator.runtimeAnimatorController)
            {
                avataData.animator = avatar.animator = toAnimator(_object, animator.runtimeAnimatorController as AnimatorController, unityScene);
            }



            return(avatar);
        }