From 31307849342c36c133b5cb8039296116c5456136 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Tue, 17 Feb 2009 04:16:42 +0000
Subject: Re-add the objectID field to the anim pack, that was deemed
unneccessary and dropped nonths ago, because it is required to get smooth
region crossings with AO running. Without it, in some corner cases, anims
will continue to run in an unstoppable state.
---
OpenSim/Framework/IClientAPI.cs | 2 +-
.../Region/ClientStack/LindenUDP/LLClientView.cs | 11 +++++---
.../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +-
OpenSim/Region/Framework/Scenes/Animation.cs | 10 +++++++-
OpenSim/Region/Framework/Scenes/AnimationSet.cs | 18 ++++++++------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 29 ++++++++++++----------
.../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +-
.../Shared/Api/Implementation/LSL_Api.cs | 4 +--
.../Shared/Api/Implementation/OSSL_Api.cs | 2 +-
OpenSim/Tests/Common/Mock/TestClient.cs | 2 +-
10 files changed, 49 insertions(+), 33 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 759059f..673810e 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -794,7 +794,7 @@ namespace OpenSim.Framework
///
void SendKillObject(ulong regionHandle, uint localID);
- void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId);
+ void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index dd0f6ac..3565e5a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2493,15 +2493,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(avp, ThrottleOutPacketType.Task);
}
- public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
+ public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
//m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name);
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
// TODO: don't create new blocks if recycling an old packet
- ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
- ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
- ani.AnimationSourceList[0].ObjectID = sourceAgentId;
+ ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[animations.Length];
ani.Sender = new AvatarAnimationPacket.SenderBlock();
ani.Sender.ID = sourceAgentId;
ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[animations.Length];
@@ -2511,6 +2509,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ani.AnimationList[i] = new AvatarAnimationPacket.AnimationListBlock();
ani.AnimationList[i].AnimID = animations[i];
ani.AnimationList[i].AnimSequenceID = seqs[i];
+
+ ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock();
+ ani.AnimationSourceList[i].ObjectID = objectIDs[i];
+ if (objectIDs[i] == UUID.Zero)
+ ani.AnimationSourceList[i].ObjectID = sourceAgentId;
}
ani.Header.Reliable = false;
OutPacket(ani, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 1ee4424..4e11759 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -393,7 +393,7 @@ namespace OpenSim.Region.Examples.SimpleModule
}
- public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
+ public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
}
diff --git a/OpenSim/Region/Framework/Scenes/Animation.cs b/OpenSim/Region/Framework/Scenes/Animation.cs
index cb0afa7..6f0681c 100644
--- a/OpenSim/Region/Framework/Scenes/Animation.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation.cs
@@ -45,14 +45,22 @@ namespace OpenSim.Region.Framework.Scenes
set { sequenceNum = value; }
}
+ private UUID objectID;
+ public UUID ObjectID
+ {
+ get { return objectID; }
+ set { objectID = value; }
+ }
+
public Animation()
{
}
- public Animation(UUID animID, int sequenceNum)
+ public Animation(UUID animID, int sequenceNum, UUID objectID)
{
this.animID = animID;
this.sequenceNum = sequenceNum;
+ this.objectID = objectID;
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/AnimationSet.cs
index 49bcda8..864e599 100644
--- a/OpenSim/Region/Framework/Scenes/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/AnimationSet.cs
@@ -60,13 +60,13 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
- public bool Add(UUID animID, int sequenceNum)
+ public bool Add(UUID animID, int sequenceNum, UUID objectID)
{
lock (m_animations)
{
if (!HasAnimation(animID))
{
- m_animations.Add(new Animation(animID, sequenceNum));
+ m_animations.Add(new Animation(animID, sequenceNum, objectID));
return true;
}
}
@@ -106,11 +106,11 @@ namespace OpenSim.Region.Framework.Scenes
/// The default animation is reserved for "main" animations
/// that are mutually exclusive, e.g. flying and sitting.
///
- public bool SetDefaultAnimation(UUID animID, int sequenceNum)
+ public bool SetDefaultAnimation(UUID animID, int sequenceNum, UUID objectID)
{
if (m_defaultAnimation.AnimID != animID)
{
- m_defaultAnimation = new Animation(animID, sequenceNum);
+ m_defaultAnimation = new Animation(animID, sequenceNum, objectID);
return true;
}
return false;
@@ -118,27 +118,28 @@ namespace OpenSim.Region.Framework.Scenes
protected bool ResetDefaultAnimation()
{
- return TrySetDefaultAnimation("STAND", 1);
+ return TrySetDefaultAnimation("STAND", 1, UUID.Zero);
}
///
/// Set the animation as the default animation if it's known
///
- public bool TrySetDefaultAnimation(string anim, int sequenceNum)
+ public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
{
if (Animations.AnimsUUID.ContainsKey(anim))
{
- return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum);
+ return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID);
}
return false;
}
- public void GetArrays(out UUID[] animIDs, out int[] sequenceNums)
+ public void GetArrays(out UUID[] animIDs, out int[] sequenceNums, out UUID[] objectIDs)
{
lock (m_animations)
{
animIDs = new UUID[m_animations.Count + 1];
sequenceNums = new int[m_animations.Count + 1];
+ objectIDs = new UUID[m_animations.Count + 1];
animIDs[0] = m_defaultAnimation.AnimID;
sequenceNums[0] = m_defaultAnimation.SequenceNum;
@@ -147,6 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
{
animIDs[i + 1] = m_animations[i].AnimID;
sequenceNums[i + 1] = m_animations[i].SequenceNum;
+ objectIDs[i + i] = m_animations[i].ObjectID;
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fc3166a..a488f59 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1754,18 +1754,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void AddAnimation(UUID animID)
+ public void AddAnimation(UUID animID, UUID objectID)
{
if (m_isChildAgent)
return;
- if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber))
+ if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber, objectID))
{
SendAnimPack();
}
}
- public void AddAnimation(string name)
+ public void AddAnimation(string name, UUID objectID)
{
if (m_isChildAgent)
return;
@@ -1774,7 +1774,7 @@ namespace OpenSim.Region.Framework.Scenes
if (animID == UUID.Zero)
return;
- AddAnimation(animID);
+ AddAnimation(animID, objectID);
}
public void RemoveAnimation(UUID animID)
@@ -1804,13 +1804,14 @@ namespace OpenSim.Region.Framework.Scenes
{
UUID[] animIDs;
int[] sequenceNums;
- m_animations.GetArrays( out animIDs, out sequenceNums );
+ UUID[] objectIDs;
+ m_animations.GetArrays( out animIDs, out sequenceNums, out objectIDs);
return animIDs;
}
public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
{
- AddAnimation(animID);
+ AddAnimation(animID, UUID.Zero);
}
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
@@ -1826,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes
{
//m_log.DebugFormat("Updating movement animation to {0}", anim);
- if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber))
+ if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber, UUID.Zero))
{
SendAnimPack();
}
@@ -2284,13 +2285,13 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public void SendAnimPack(UUID[] animations, int[] seqs)
+ public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs)
{
if (m_isChildAgent)
return;
m_scene.Broadcast(
- delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); });
+ delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); });
}
public void SendAnimPackToClient(IClientAPI client)
@@ -2299,10 +2300,11 @@ namespace OpenSim.Region.Framework.Scenes
return;
UUID[] animIDs;
int[] sequenceNums;
+ UUID[] objectIDs;
- m_animations.GetArrays(out animIDs, out sequenceNums);
+ m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
- client.SendAnimations(animIDs, sequenceNums, m_controllingClient.AgentId);
+ client.SendAnimations(animIDs, sequenceNums, m_controllingClient.AgentId, objectIDs);
}
///
@@ -2317,10 +2319,11 @@ namespace OpenSim.Region.Framework.Scenes
UUID[] animIDs;
int[] sequenceNums;
+ UUID[] objectIDs;
- m_animations.GetArrays(out animIDs, out sequenceNums);
+ m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
- SendAnimPack(animIDs, sequenceNums);
+ SendAnimPack(animIDs, sequenceNums, objectIDs);
}
#endregion
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 91518e2..c84ede8 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -482,7 +482,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
- public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
+ public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e5f097f..5f6ea16 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2854,9 +2854,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Do NOT try to parse UUID, animations cannot be triggered by ID
UUID animID=InventoryKey(anim, (int)AssetType.Animation);
if (animID == UUID.Zero)
- presence.AddAnimation(anim);
+ presence.AddAnimation(anim, m_host.UUID);
else
- presence.AddAnimation(animID);
+ presence.AddAnimation(animID, m_host.UUID);
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index eeef58b..564648b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -559,7 +559,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence)
{
ScenePresence target = (ScenePresence)World.Entities[avatarID];
- target.AddAnimation(animation);
+ target.AddAnimation(animation, m_host.UUID);
}
}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 2463b3b..373ee13 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -443,7 +443,7 @@ namespace OpenSim.Tests.Common.Mock
}
- public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
+ public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
}
--
cgit v1.1