change how avatar data, appearance and animations are sent, specially

the order
avinationmerge
UbitUmarov 2014-08-16 14:52:09 +01:00
parent 1edaf29149
commit dc178959c5
1 changed files with 98 additions and 112 deletions

View File

@ -1806,6 +1806,17 @@ namespace OpenSim.Region.Framework.Scenes
look = new Vector3(0.99f, 0.042f, 0); look = new Vector3(0.99f, 0.042f, 0);
} }
if (!IsChildAgent)
{
InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
if (cof == null)
COF = UUID.Zero;
else
COF = cof.ID;
m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF);
}
// Tell the client that we're totally ready // Tell the client that we're totally ready
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
@ -2776,34 +2787,15 @@ namespace OpenSim.Region.Framework.Scenes
if (satOnObject) if (satOnObject)
{ {
// SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0; m_requestedSitTargetID = 0;
part.RemoveSittingAvatar(UUID); part.RemoveSittingAvatar(UUID);
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
}
else if (PhysicsActor == null) SendAvatarDataToAllAgents();
AddToPhysicalScene(false); }
Animator.TrySetMovementAnimation("STAND"); Animator.TrySetMovementAnimation("STAND");
if (satOnObject)
{
ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X,AbsolutePosition.Y);
if (land != null)
{
UUID parcelID = land.LandData.GlobalID;
if (m_currentParcelUUID != parcelID)
currentParcelUUID = parcelID;
else
SendAvatarDataToAllAgents();
}
else
SendAvatarDataToAllAgents();
}
TriggerScenePresenceUpdated(); TriggerScenePresenceUpdated();
} }
@ -3078,11 +3070,14 @@ namespace OpenSim.Region.Framework.Scenes
ParentPart = part; ParentPart = part;
ParentID = part.LocalId; ParentID = part.LocalId;
SendAvatarDataToAllAgents();
if(status == 3) if(status == 3)
Animator.TrySetMovementAnimation("SIT_GROUND"); Animator.TrySetMovementAnimation("SIT_GROUND");
else else
Animator.TrySetMovementAnimation("SIT"); Animator.TrySetMovementAnimation("SIT");
SendAvatarDataToAllAgents();
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
} }
@ -3182,13 +3177,14 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
SendAvatarDataToAllAgents();
String sitAnimation = "SIT"; String sitAnimation = "SIT";
if (!String.IsNullOrEmpty(part.SitAnimation)) if (!String.IsNullOrEmpty(part.SitAnimation))
{ {
sitAnimation = part.SitAnimation; sitAnimation = part.SitAnimation;
} }
Animator.TrySetMovementAnimation(sitAnimation); Animator.TrySetMovementAnimation(sitAnimation);
SendAvatarDataToAllAgents();
TriggerScenePresenceUpdated(); TriggerScenePresenceUpdated();
} }
} }
@ -3478,8 +3474,8 @@ namespace OpenSim.Region.Framework.Scenes
landch.sendClientInitialLandInfo(ControllingClient); landch.sendClientInitialLandInfo(ControllingClient);
} }
} }
SendOtherAgentsAvatarDataToMe();
SendOtherAgentsAppearanceToMe(); SendOtherAgentsAvatarFullToMe();
EntityBase[] entities = Scene.Entities.GetEntities(); EntityBase[] entities = Scene.Entities.GetEntities();
foreach (EntityBase e in entities) foreach (EntityBase e in entities)
@ -3512,36 +3508,41 @@ namespace OpenSim.Region.Framework.Scenes
// If we aren't using a cached appearance, then clear out the baked textures // If we aren't using a cached appearance, then clear out the baked textures
if (!cachedappearance) if (!cachedappearance)
{ {
// Appearance.ResetAppearance();
// save what ????
// maybe needed so the tryretry repair works?
if (m_scene.AvatarFactory != null) if (m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(UUID); m_scene.AvatarFactory.QueueAppearanceSave(UUID);
} }
// This agent just became root. We are going to tell everyone about it. The process of
// getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it
// again here... this comes after the cached appearance check because the avatars
// appearance goes into the avatar update packet
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
// This invocation always shows up in the viewer logs as an error. Is it needed?
// send all information we have
// possible not needed since viewer should ask about it
// least it all ask for baked
SendAppearanceToAgent(this); SendAppearanceToAgent(this);
// If we are using the the cached appearance then send it out to everyone // if (cachedappearance)
// send even grays // {
if (cachedappearance)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
// If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when
// the avatar finishes updating its appearance
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
// }
Animator.SendAnimPack();
} }
/// <summary>
/// Send avatar full data appearance and animations for all other root agents to this agent, this agent
/// can be either a child or root
/// </summary>
public void SendOtherAgentsAvatarFullToMe()
{
int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{
// only send information about other root agents
if (scenePresence.UUID == UUID)
return;
scenePresence.SendAvatarDataToAgent(this);
scenePresence.SendAppearanceToAgent(this);
scenePresence.SendAnimPackToAgent(this);
// for now attachments are sent with all SOG
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
} }
/// <summary> /// <summary>
@ -3573,27 +3574,6 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentUpdates(count);
} }
/// <summary>
/// Send avatar data for all other root agents to this agent, this agent
/// can be either a child or root
/// </summary>
public void SendOtherAgentsAvatarDataToMe()
{
int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{
// only send information about other root agents
if (scenePresence.UUID == UUID)
return;
scenePresence.SendAvatarDataToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
}
/// <summary> /// <summary>
/// Send avatar data to an agent. /// Send avatar data to an agent.
/// </summary> /// </summary>
@ -3604,7 +3584,6 @@ namespace OpenSim.Region.Framework.Scenes
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200)
return; return;
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
Animator.SendAnimPackToClient(avatar.ControllingClient);
} }
/// <summary> /// <summary>
@ -3638,28 +3617,6 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentUpdates(count);
} }
/// <summary>
/// Send appearance from all other root agents to this agent. this agent
/// can be either root or child
/// </summary>
public void SendOtherAgentsAppearanceToMe()
{
// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID);
int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{
// only send information about other root agents
if (scenePresence.UUID == UUID)
return;
scenePresence.SendAppearanceToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
}
/// <summary> /// <summary>
/// Send appearance data to an agent. /// Send appearance data to an agent.
/// </summary> /// </summary>
@ -3674,6 +3631,30 @@ namespace OpenSim.Region.Framework.Scenes
UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
} }
public void SendAnimPackToAgent(ScenePresence p)
{
if (IsChildAgent || Animator == null)
return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
return;
Animator.SendAnimPackToClient(p.ControllingClient);
}
public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs)
{
if (IsChildAgent)
return;
m_scene.ForEachScenePresence(delegate(ScenePresence p)
{
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
return;
p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
});
}
#endregion #endregion
#region Significant Movement Method #region Significant Movement Method
@ -4193,13 +4174,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch { } catch { }
Animator.ResetAnimations();
// FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
if (cAgent.Anims != null)
Animator.Animations.FromArray(cAgent.Anims);
if (cAgent.DefaultAnim != null) if (cAgent.DefaultAnim != null)
Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
if (cAgent.AnimState != null) if (cAgent.AnimState != null)
Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero);
if (cAgent.Anims != null)
Animator.Animations.FromArray(cAgent.Anims);
if (Scene.AttachmentsModule != null) if (Scene.AttachmentsModule != null)
Scene.AttachmentsModule.CopyAttachments(cAgent, this); Scene.AttachmentsModule.CopyAttachments(cAgent, this);
@ -5442,6 +5425,7 @@ namespace OpenSim.Region.Framework.Scenes
p.SendAttachmentsToClient(ControllingClient); p.SendAttachmentsToClient(ControllingClient);
if (p.Animator != null) if (p.Animator != null)
p.Animator.SendAnimPackToClient(ControllingClient); p.Animator.SendAnimPackToClient(ControllingClient);
} }
} }
} }
@ -5597,7 +5581,7 @@ namespace OpenSim.Region.Framework.Scenes
if (GodLevel >= 200) if (GodLevel >= 200)
return; return;
List<ScenePresence> killsToSendme = new List<ScenePresence>(); List<uint> killsToSendme = new List<uint>();
foreach (ScenePresence p in allpresences) foreach (ScenePresence p in allpresences)
{ {
if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
@ -5605,28 +5589,29 @@ namespace OpenSim.Region.Framework.Scenes
if (p.currentParcelUUID == m_currentParcelUUID) if (p.currentParcelUUID == m_currentParcelUUID)
{ {
killsToSendme.Add(p); m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname);
killsToSendme.Add(p.LocalId);
} }
} }
if (killsToSendme.Count > 0) if (killsToSendme.Count > 0)
{ {
foreach (ScenePresence p in killsToSendme) try
{ {
m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); ControllingClient.SendKillObject(killsToSendme);
try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); } }
catch (NullReferenceException) { } catch (NullReferenceException) { }
} }
}
}
}
}
}
private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID,
bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check)
{ {
List<ScenePresence> killsToSendto = new List<ScenePresence>(); List<ScenePresence> killsToSendto = new List<ScenePresence>();
List<ScenePresence> killsToSendme = new List<ScenePresence>(); List<uint> killsToSendme = new List<uint>();
List<ScenePresence> viewsToSendto = new List<ScenePresence>(); List<ScenePresence> viewsToSendto = new List<ScenePresence>();
List<ScenePresence> viewsToSendme = new List<ScenePresence>(); List<ScenePresence> viewsToSendme = new List<ScenePresence>();
List<ScenePresence> allpresences = null; List<ScenePresence> allpresences = null;
@ -5697,7 +5682,7 @@ namespace OpenSim.Region.Framework.Scenes
if(p.GodLevel < 200) if(p.GodLevel < 200)
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
if(GodLevel < 200) if(GodLevel < 200)
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p.LocalId); // i dont see them
} }
// only those on new parcel need see // only those on new parcel need see
if (currentParcelID == p.currentParcelUUID) if (currentParcelID == p.currentParcelUUID)
@ -5746,7 +5731,7 @@ namespace OpenSim.Region.Framework.Scenes
// only those old parcel need receive kills // only those old parcel need receive kills
if (previusParcelID == p.currentParcelUUID && GodLevel < 200) if (previusParcelID == p.currentParcelUUID && GodLevel < 200)
{ {
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p.LocalId); // i dont see them
} }
else else
{ {
@ -5773,12 +5758,13 @@ namespace OpenSim.Region.Framework.Scenes
if (killsToSendme.Count > 0) if (killsToSendme.Count > 0)
{ {
foreach (ScenePresence p in killsToSendme) m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString());
try
{ {
m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); ControllingClient.SendKillObject(killsToSendme);
try {ControllingClient.SendKillObject(new List<uint> { p.LocalId }); }
catch (NullReferenceException) { }
} }
catch (NullReferenceException) { }
} }
if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc)