ªTEST MESS* reduce animation packets send. Added onchangeanim event with parameters to define if to add or remove, and if to send anims pack on that evocation, etc

avinationmerge
UbitUmarov 2012-05-12 15:27:37 +01:00
parent cf8b7c8aff
commit 7461fe4554
7 changed files with 53 additions and 3 deletions

View File

@ -70,6 +70,8 @@ namespace OpenSim.Framework
public delegate void StopAnim(IClientAPI remoteClient, UUID animID);
public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack);
public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children);
public delegate void DelinkObjects(List<uint> primIds, IClientAPI client);
@ -791,6 +793,7 @@ namespace OpenSim.Framework
event ObjectDrop OnObjectDrop;
event StartAnim OnStartAnim;
event StopAnim OnStopAnim;
event ChangeAnim OnChangeAnim;
event LinkObjects OnLinkObjects;
event DelinkObjects OnDelinkObjects;
event RequestMapBlocks OnRequestMapBlocks;

View File

@ -98,6 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event AvatarPickerRequest OnAvatarPickerRequest;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event ChangeAnim OnChangeAnim;
public event Action<IClientAPI> OnRequestAvatarsData;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
@ -6386,7 +6387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
#endregion
/*
StartAnim handlerStartAnim = null;
StopAnim handlerStopAnim = null;
@ -6409,6 +6410,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
return true;
*/
ChangeAnim handlerChangeAnim = null;
for (int i = 0; i < AgentAni.AnimationList.Length; i++)
{
handlerChangeAnim = OnChangeAnim;
if (handlerChangeAnim != null)
{
handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
}
}
handlerChangeAnim = OnChangeAnim;
if (handlerChangeAnim != null)
{
handlerChangeAnim(UUID.Zero, false, true);
}
return true;
}

View File

@ -117,6 +117,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack();
}
public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack)
{
if (m_scenePresence.IsChildAgent)
return;
if (animID != UUID.Zero)
{
if (addRemove)
m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero);
else
m_animations.Remove(animID);
}
if(sendPack)
SendAnimPack();
}
// Called from scripts
public void RemoveAnimation(string name)
{

View File

@ -781,6 +781,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
ControllingClient.OnStartAnim += HandleStartAnim;
ControllingClient.OnStopAnim += HandleStopAnim;
ControllingClient.OnChangeAnim += avnHandleChangeAnim;
ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
ControllingClient.OnAutoPilotGo += MoveToTarget;
@ -2432,6 +2433,13 @@ namespace OpenSim.Region.Framework.Scenes
Animator.RemoveAnimation(animID);
}
public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
{
Animator.avnChangeAnim(animID, addRemove, sendPack);
}
/// <summary>
/// Rotate the avatar to the given rotation and apply a movement in the given relative vector
/// </summary>

View File

@ -669,6 +669,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;

View File

@ -189,6 +189,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;

View File

@ -88,6 +88,7 @@ namespace OpenSim.Tests.Common.Mock
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;