Пример #1
0
        /*!
         * @param url		URL to 3D animation file to load.
         * @param target	name of avatar/garment to apply animation to
         *				if null, the current avatar is assumed
         * Load a 3D animation content file (BVH, Havok or Vixen format)
         * and apply it to the named avatar or garment. The name of the
         * animation is the base name of the file without the extension.
         *
         * @see PlayAnimation PauseAnimation
         */
        public virtual void LoadAnimation(String url, String targetname)
        {
            String    ext     = url.Substring(url.LastIndexOf('.')).ToLower();
            SharedObj targobj = null;
            Garment   g       = null;

            if (ext == ".scp")
            {
                scriptor.LoadScript(url);
                return;
            }
            if (ext == ".xml")
            {
                if (targetname != null)
                {
                    g = FindGarment(targetname);
                }
                else
                {
                    g = currentGarment;
                }
                LoadMayaCache(g, url, null, scriptor);
            }
            else
            {
                Puppet p = null;

                if (targetname != null)
                {
                    p = FindAvatar(targetname);
                    g = FindGarment(targetname);
                }
                else
                {
                    if (currentAvatar == null)
                    {
                        return;
                    }
                    p = currentAvatar;
                }
                if (p != null)
                {
                    targetname = p.AnimSkeleton.Name;
                    targetname = targetname.Substring(targetname.IndexOf('.'));
                    targobj    = p.AnimSkeleton;
                }
                else if (g != null)
                {
                    targobj    = g.ClothMesh;
                    targetname = g.ClothMesh.Name;
                }
                scriptor.Load(url, targetname, 0, targobj);
            }
        }
Пример #2
0
        /*!
         * Display the named avatar. This function will only display the avatar
         * if it has already been loaded. If the name is null, the current avatar is shown.
         *
         * @see LoadAvatar HideAvatar
         */
        public virtual void ShowAvatar(String name)
        {
            Puppet p = FindAvatar(name);

            if (p == null)
            {
                return;
            }
            if (p != currentAvatar)
            {
                HideAvatar();
            }
            currentAvatar = p;
            p.Show();
        }
Пример #3
0
        /*!
         * @param name	name to assign to loaded avatar.
         * @param url	URL of 3D avatar content to load.
         * Load a 3D avatar content file (Havok or Vixen format)
         * and handle a LoadAvatarEvent when load is complete.
         */
        public virtual void LoadAvatar(String name, String url)
        {
            Puppet p = FindAvatar(name);

            if (p != null)
            {
                ShowAvatar(name);
            }
            else
            {
                currentAvatar = new Puppet(name, url, config.avatar);
                avatarRoot.Append(currentAvatar.BodyModel);
                avatars.Add(currentAvatar);
            }
        }