Beispiel #1
0
 public void Avatars_OnAvatarAnimation(object sender, AvatarAnimationEventArgs e)
 {
     if (!MaintainAnims) return;
         EventQueue.Enqueue(() =>
         {
             SimAvatar avatar = (SimAvatar) CreateSimAvatar(e.AvatarID, this, null);
             if (avatar == null)
             {
                 return;
             }
             if (UseEventSource(avatar))
             {
                 avatar.OnAvatarAnimations(e.Animations);
             }
         });
 }
Beispiel #2
0
 void Avatars_AvatarAnimation(object sender, AvatarAnimationEventArgs e)
 {
     if (InvokeRequired) {
         Invoke(new MethodInvoker(() => Avatars_AvatarAnimation(sender, e)));
         return;
     }
     if (e.AvatarID== av.ID)
     {
         foreach (Animation a in e.Animations)
         {
             if (!seenAnim.Contains(a.AnimationID))
             {
                 Logger.Log("New anim for " + av.Name + ": " + a.AnimationID, Helpers.LogLevel.Debug);
                 seenAnim.Add(a.AnimationID);
                 AnimDetail ad = new AnimDetail(instance, av, a.AnimationID, n);
                 ad.Location = new Point(0, n++ * ad.Height);
                 ad.Dock = DockStyle.Top;
                 Controls.Add(ad);
             }
         }
     }
 }
Beispiel #3
0
 ///<summary>Raises the AvatarAnimation Event</summary>
 /// <param name="e">An AvatarAnimationEventArgs object containing
 /// the data sent from the simulator</param>
 protected virtual void OnAvatarAnimation(AvatarAnimationEventArgs e)
 {
     EventHandler<AvatarAnimationEventArgs> handler = m_AvatarAnimation;
     if (handler != null)
         handler(this, e);
 }
Beispiel #4
0
        void AvatarAnimationChanged(object sender, AvatarAnimationEventArgs e)
        {

            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => AvatarAnimationChanged(sender, e)));
                return;
            }

            // We don't currently have UUID -> RenderAvatar mapping so we need to walk the list
            foreach (RenderAvatar av in Avatars.Values)
            {
                if (av.avatar.ID == e.AvatarID)
                {
                    av.glavatar.skel.flushanimations();
                    foreach (Animation anim in e.Animations)
                    {

                        int nofails = 0;
                        if (AssetFetchFailCount.TryGetValue(anim.AnimationID, out nofails))
                        {
                            if (nofails >= 5)
                                continue; // asset fetch has failed 5 times, give up.
                        }

                        UUID tid = UUID.Random();
                        skeleton.mAnimationTransactions.Add(tid, av);

                        BinBVHAnimationReader bvh;
                        if (skeleton.mAnimationCache.TryGetValue(anim.AnimationID, out bvh))
                        {
                            skeleton.addanimation(null, tid, bvh);
                            continue;
                        }

                        Logger.Log("Requesting new animation asset " + anim.AnimationID.ToString(), Helpers.LogLevel.Info);

                        Client.Assets.RequestAsset(anim.AnimationID, AssetType.Animation, false, SourceType.Asset, tid, animRecievedCallback);
                    }
                    break;
                }
            }
        }
Beispiel #5
0
        // This is called when ever an animation play state changes, that might be a start/stop event etc
        // the entire list of animations is sent each time and it is our job to determine which are new and
        // which are deleted
        void AvatarAnimationChanged(object sender, AvatarAnimationEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => AvatarAnimationChanged(sender, e)));
                return;
            }

            // We don't currently have UUID -> RenderAvatar mapping so we need to walk the list
            foreach (RenderAvatar av in Avatars.Values)
            {
                if (av.avatar.ID == e.AvatarID)
                {
                    UpdateAvatarAnimations(av);
                    break;
                }
            }
        }
Beispiel #6
0
        void AvatarAnimationChanged(object sender, AvatarAnimationEventArgs e)
        {
            // We don't currently have UUID -> RenderAvatar mapping so we need to walk the list
            foreach (RenderAvatar av in Avatars.Values)
            {
                if (av.avatar.ID == e.AvatarID)
                {
                    av.glavatar.skel.flushanimations();
                    foreach (Animation anim in e.Animations)
                    {

                        UUID tid = UUID.Random();
                        skeleton.mAnimationTransactions.Add(tid, av);

                        BinBVHAnimationReader bvh;
                        if (skeleton.mAnimationCache.TryGetValue(anim.AnimationID, out bvh))
                        {
                            skeleton.addanimation(null, tid, bvh);
                            continue;
                        }

                        Logger.Log("Requesting new animation asset " + anim.AnimationID.ToString(), Helpers.LogLevel.Info);

                        Client.Assets.RequestAsset(anim.AnimationID, AssetType.Animation, false, SourceType.Asset, tid, animRecievedCallback);
                    }
                    break;
                }
            }
        }
Beispiel #7
0
        // This is called when ever an animation play state changes, that might be a start/stop event etc
        // the entire list of animations is sent each time and it is our job to determine which are new and
        // which are deleted

        void AvatarAnimationChanged(object sender, AvatarAnimationEventArgs e)
        {

            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => AvatarAnimationChanged(sender, e)));
                return;
            }

            // We don't currently have UUID -> RenderAvatar mapping so we need to walk the list
            foreach (RenderAvatar av in Avatars.Values)
            {
                if (av.avatar.ID == e.AvatarID)
                {
                    av.glavatar.skel.flushanimations();
                    foreach (Animation anim in e.Animations)
                    {
                        //Console.WriteLine(string.Format("AvatarAnimationChanged {0} {1}", anim.AnimationID, anim.AnimationSequence));
                        
                        // Don't play internal turn 180 animations
                        if (anim.AnimationID == new UUID("038fcec9-5ebd-8a8e-0e2e-6e71a0a1ac53"))
                            continue;

                        if (anim.AnimationID == new UUID("6883a61a-b27b-5914-a61e-dda118a9ee2c"))
                            continue;

                        av.glavatar.skel.processAnimation(anim.AnimationID);
                        
                        int nofails = 0;
                        if (AssetFetchFailCount.TryGetValue(anim.AnimationID, out nofails))
                        {
                            if (nofails >= 5)
                                continue; // asset fetch has failed 5 times, give up.
                        }

                        UUID tid = UUID.Random();
                        skeleton.mAnimationTransactions.Add(tid, av);

                        BinBVHAnimationReader bvh;
                        if (skeleton.mAnimationCache.TryGetValue(anim.AnimationID, out bvh))
                        {
                            skeleton.addanimation(null, tid, bvh, anim.AnimationID);
                            continue;
                        }

                        Logger.Log("Requesting new animation asset " + anim.AnimationID.ToString(), Helpers.LogLevel.Info);

                        Client.Assets.RequestAsset(anim.AnimationID, AssetType.Animation, false, SourceType.Asset, tid, animRecievedCallback);
                    }

                    av.glavatar.skel.flushanimationsfinal();
                    skeleton.recalcpriorities(av);

                    break;
                }
            }
        }