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.
0.6.3-post-fixes
Melanie Thielker 2009-02-17 04:16:42 +00:00
parent 2c272762f8
commit 3130784934
10 changed files with 49 additions and 33 deletions

View File

@ -794,7 +794,7 @@ namespace OpenSim.Framework
/// <param name="localID"></param>
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,

View File

@ -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);

View File

@ -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)
{
}

View File

@ -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;
}
}
}

View File

@ -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.
/// </summary>
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);
}
/// <summary>
/// Set the animation as the default animation if it's known
/// </summary>
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;
}
}
}

View File

@ -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
/// </summary>
/// <param name="animations"></param>
/// <param name="seqs"></param>
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);
}
/// <summary>
@ -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

View File

@ -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)
{
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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)
{
}