From b69c5d663339c7509767b0852b9fc50822ba94cc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Dec 2010 23:50:09 +0000 Subject: minor: change OpenSimBase log messages associated with newer module loader to make the association clear --- OpenSim/Region/Application/OpenSimBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 74ad168..36d5e51 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -352,13 +352,13 @@ namespace OpenSim m_moduleLoader.InitialiseSharedModules(scene); // Use this in the future, the line above will be deprecated soon - m_log.Info("[MODULES]: Loading Region's modules (new style)"); + m_log.Info("[REGIONMODULE]: Loading Region's modules (new style)"); IRegionModulesController controller; if (ApplicationRegistry.TryGet(out controller)) { controller.AddRegionToModules(scene); } - else m_log.Error("[MODULES]: The new RegionModulesController is missing..."); + else m_log.Error("[REGIONMODULE]: The new RegionModulesController is missing..."); scene.SetModuleInterfaces(); -- cgit v1.1 From df860516bf4fa4e4196be4d5fc26db71d98334f4 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 3 Dec 2010 16:17:50 -0800 Subject: Various bug fixes for appearance handling: more aggressive reset of textures and vparams when appearance is not cached and when wearables change. Send appearance to the viewer with initial data. Cleaned up (and added) debugging. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 99 ++++++++++++++-------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 ++++++---- 2 files changed, 93 insertions(+), 52 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index ab1c206..7d6d191 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -115,8 +115,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory #endregion + /// + /// Check for the existence of the baked texture assets. Request a rebake + /// unless checkonly is true. + /// + /// + /// public bool ValidateBakedTextureCache(IClientAPI client) { + return ValidateBakedTextureCache(client, true); + } + + private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly) + { ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp == null) { @@ -131,15 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { int idx = AvatarAppearance.BAKE_INDICES[i]; Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face == null || face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) + + // if there is no texture entry, skip it + if (face == null) continue; + // if the texture is one of the "defaults" then skip it + // this should probably be more intelligent (skirt texture doesnt matter + // if the avatar isnt wearing a skirt) but if any of the main baked + // textures is default then the rest should be as well + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + continue; + defonly = false; // found a non-default texture reference if (! CheckBakedTextureAsset(client,face.TextureID,idx)) - return false; + { + // the asset didn't exist if we are only checking, then we found a bad + // one and we're done otherwise, ask for a rebake + if (checkonly) return false; + + m_log.InfoFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID); + client.SendRebakeAvatarTextures(face.TextureID); + } } + m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId); + // If we only found default textures, then the appearance is not cached return (defonly ? false : true); } @@ -158,55 +187,43 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return; } - // m_log.WarnFormat("[AVFACTORY]: Start SetAppearance for {0}",client.AgentId); + m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId); + // TODO: This is probably not necessary any longer, just assume the + // textureEntry set implies that the appearance transaction is complete bool changed = false; // Process the texture entry transactionally, this doesn't guarantee that Appearance is // going to be handled correctly but it does serialize the updates to the appearance lock (m_setAppearanceLock) { + // Process the visual params, this may change height as well + if (visualParams != null) + { + changed = sp.Appearance.SetVisualParams(visualParams); + if (sp.Appearance.AvatarHeight > 0) + sp.SetHeight(sp.Appearance.AvatarHeight); + } + + // Process the baked texture array if (textureEntry != null) { - changed = sp.Appearance.SetTextureEntries(textureEntry); + changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; - // m_log.WarnFormat("[AVFACTORY]: Prepare to check textures for {0}",client.AgentId); + m_log.InfoFormat("[AVFACTORY]: received texture update for {0}",client.AgentId); + Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); }); - for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) - { - int idx = AvatarAppearance.BAKE_INDICES[i]; - Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; - if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) - Util.FireAndForget(delegate(object o) { - if (! CheckBakedTextureAsset(client,face.TextureID,idx)) - client.SendRebakeAvatarTextures(face.TextureID); - }); - } + // This appears to be set only in the final stage of the appearance + // update transaction. In theory, we should be able to do an immediate + // appearance send and save here. - m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); + QueueAppearanceSave(client.AgentId); + QueueAppearanceSend(client.AgentId); } - // Process the visual params, this may change height as well - if (visualParams != null) - { - if (sp.Appearance.SetVisualParams(visualParams)) - { - changed = true; - if (sp.Appearance.AvatarHeight > 0) - sp.SetHeight(sp.Appearance.AvatarHeight); - } - } } - - // If something changed in the appearance then queue an appearance save - if (changed) - QueueAppearanceSave(client.AgentId); - - // And always queue up an appearance update to send out - QueueAppearanceSend(client.AgentId); - - // m_log.WarnFormat("[AVFACTORY]: Complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); + // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); } /// @@ -229,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory #region UpdateAppearanceTimer + /// + /// Queue up a request to send appearance, makes it possible to + /// accumulate changes without sending out each one separately. + /// public void QueueAppearanceSend(UUID agentid) { // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); @@ -268,6 +289,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); + + // Send animations back to the avatar as well + sp.Animator.SendAnimPack(); } private void HandleAppearanceSave(UUID agentid) @@ -353,9 +377,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId); + // we need to clean out the existing textures + sp.Appearance.ResetAppearance(); + // operate on a copy of the appearance so we don't have to lock anything AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); - + foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) { if (wear.Type < AvatarWearable.MAX_WEARABLES) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 82214bf..a1c80e5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2418,30 +2418,44 @@ namespace OpenSim.Region.Framework.Scenes // the inventory arrives // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); - // This agent just became root. We are going to tell everyone about it. The process of - // getting other avatars information was initiated in the constructor... don't do it - // again here... - SendAvatarDataToAllAgents(); + bool cachedappearance = false; // We have an appearance but we may not have the baked textures. Check the asset cache // to see if all the baked textures are already here. if (m_scene.AvatarFactory != null) { - if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) - { -// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); - SendAppearanceToAgent(this); - - // 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(); - } + cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); } else { m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); } + + // If we aren't using a cached appearance, then clear out the baked textures + if (! cachedappearance) + { + m_appearance.ResetAppearance(); + if (m_scene.AvatarFactory != null) + 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 in the constructor... don't do it + // again here... this comes after the cached appearance check because the avatars + // appearance goes into the avatar update packet + SendAvatarDataToAllAgents(); + SendAppearanceToAgent(this); + + // If we are using the the cached appearance then send it out to everyone + if (cachedappearance) + { + m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", 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(); + } } /// @@ -2501,7 +2515,7 @@ namespace OpenSim.Region.Framework.Scenes /// Send avatar data to an agent. /// /// - private void SendAvatarDataToAgent(ScenePresence avatar) + public void SendAvatarDataToAgent(ScenePresence avatar) { // m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); @@ -2569,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes /// Send appearance data to an agent. /// /// - private void SendAppearanceToAgent(ScenePresence avatar) + public void SendAppearanceToAgent(ScenePresence avatar) { // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); -- cgit v1.1