From 9474bdb6df9b7a44aa944fe9b55967b8c85f92dc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 9 Jan 2012 13:07:39 +0000 Subject: [PATCH] Add "appearance rebake" command to ask a specific viewer to rebake textures from the server end. This is not as useful as it sounds, since you can only request rebakes for texture IDs already received. In other words, if the viewer has never sent the server this information (which happens quite often) then it will have no effect. Nonetheless, this is useful for diagnostic/debugging purposes. --- .../AvatarFactory/AvatarFactoryModule.cs | 19 ++++++--- .../Avatar/Appearance/AppearanceInfoModule.cs | 40 ++++++++++++++++++- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 6fb80d303f..46fbaf4312 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -181,12 +181,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) continue; - if (missingTexturesOnly && m_scene.AssetService.Get(face.TextureID.ToString()) != null) - continue; + if (missingTexturesOnly) + { + if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + continue; + else + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + } else - m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", - face.TextureID, idx, sp.Name); + { + m_log.DebugFormat( + "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.", + face.TextureID, idx, sp.Name); + } sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 06c172556b..fd839c57b9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -116,6 +116,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance "Send appearance data for each avatar in the simulator to other viewers.", "Optionally, you can specify that only a particular avatar's appearance data is sent.", HandleSendAppearanceCommand); + + scene.AddCommand( + this, "appearance rebake", + "appearance rebake ", + "Send a request to the user's viewer for it to rebake and reupload its appearance textures.", + "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not." + + "\nThis will only work for texture ids that the viewer has already uploaded." + + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen" + + "\nsince requests can only be made for ids that the client has already sent us", + HandleRebakeAppearanceCommand); } private void HandleSendAppearanceCommand(string module, string[] cmd) @@ -243,6 +253,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance } } } - } + } + + private void HandleRebakeAppearanceCommand(string module, string[] cmd) + { + if (cmd.Length != 4) + { + MainConsole.Instance.OutputFormat("Usage: appearance rebake "); + return; + } + + string firstname = cmd[2]; + string lastname = cmd[3]; + + lock (m_scenes) + { + foreach (Scene scene in m_scenes.Values) + { + ScenePresence sp = scene.GetScenePresence(firstname, lastname); + if (sp != null && !sp.IsChildAgent) + { + MainConsole.Instance.OutputFormat( + "Requesting rebake of uploaded textures for {0}", + sp.Name, scene.RegionInfo.RegionName); + + scene.AvatarFactory.RequestRebake(sp, false); + } + } + } + } } } \ No newline at end of file