From f5c9a56c8b73ef93db712fefe9f0366c4983e04f Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Fri, 29 Oct 2010 13:37:13 -0700 Subject: Bunch of fixes that reduce the number of times appearance and avatar data are sent. And the number of times they are stored. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 66 +++++++++++++++++------- 1 file changed, 46 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f828a2d..7d9c8e5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -704,20 +704,14 @@ namespace OpenSim.Region.Framework.Scenes // we created a new ScenePresence (a new child agent) in a fresh region. // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) - SendInitialFullUpdateToAllClients(); + +// MIC: This should be called by OnCompleteMovement +// SendInitialFullUpdateToAllClients(); RegisterToEvents(); SetDirectionVectors(); } -/* - public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, - AvatarWearable[] wearables) - : this(client, world, reginfo) - { - m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); - } -*/ public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) : this(client, world, reginfo) { @@ -1081,7 +1075,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void CompleteMovement(IClientAPI client) { - //m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); +// DEBUG ON + m_log.WarnFormat("[SCENE PRESENCE]: CompleteMovement for {0}",UUID); +// DEBUG OFF Vector3 look = Velocity; if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) @@ -2381,12 +2377,20 @@ namespace OpenSim.Region.Framework.Scenes // 2 stage check is needed. if (remoteAvatar == null) return; + IClientAPI cl=remoteAvatar.ControllingClient; if (cl == null) return; + if (m_appearance.Texture == null) return; + if (LocalId == remoteAvatar.LocalId) + { + m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); + return; + } + if (IsChildAgent) { m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data"); @@ -2407,20 +2411,23 @@ namespace OpenSim.Region.Framework.Scenes m_scene.ForEachScenePresence(delegate(ScenePresence avatar) { ++avUpdates; - // only send if this is the root (children are only "listening posts" in a foreign region) + + // Don't update ourselves + if (avatar.LocalId == LocalId) + return; + + // If this is a root agent, then get info about the avatar if (!IsChildAgent) { SendFullUpdateToOtherClient(avatar); } - if (avatar.LocalId != LocalId) + // If the other avatar is a root + if (!avatar.IsChildAgent) { - if (!avatar.IsChildAgent) - { - avatar.SendFullUpdateToOtherClient(this); - avatar.SendAppearanceToOtherAgent(this); - avatar.Animator.SendAnimPackToClient(ControllingClient); - } + avatar.SendFullUpdateToOtherClient(this); + avatar.SendAppearanceToOtherAgent(this); + avatar.Animator.SendAnimPackToClient(ControllingClient); } }); @@ -2465,7 +2472,19 @@ namespace OpenSim.Region.Framework.Scenes // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); m_controllingClient.SendAvatarDataImmediate(this); - m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); + if (m_scene.AvatarFactory != null) + { + if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) + { + m_log.WarnFormat("[SP] baked textures are in the ache for {0}",Name); + m_controllingClient.SendAppearance( + m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); + } + } + else + { + m_log.WarnFormat("[SP] AvatarFactory not set"); + } SendInitialFullUpdateToAllClients(); } @@ -2497,9 +2516,16 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendAppearanceToOtherAgent(ScenePresence avatar) { + if (LocalId == avatar.LocalId) + { + m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); + return; + } + // DEBUG ON - m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); +// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); // DEBUG OFF + avatar.ControllingClient.SendAppearance( m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); } -- cgit v1.1 From 49fa7e91b93221f4bd33e6f009185bc0e043a880 Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Fri, 29 Oct 2010 13:45:59 -0700 Subject: Clean up some cruft from the last commit. Re-add the initial update send in the scene presence constructor... need to figure this out later. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7d9c8e5..d4d6979 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -705,8 +705,8 @@ namespace OpenSim.Region.Framework.Scenes // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) -// MIC: This should be called by OnCompleteMovement -// SendInitialFullUpdateToAllClients(); +// MIC: This gets called again in CompleteMovement + SendInitialFullUpdateToAllClients(); RegisterToEvents(); SetDirectionVectors(); -- cgit v1.1