diff options
author | Justin Clark-Casey (justincc) | 2012-01-10 18:41:07 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-10 18:41:07 +0000 |
commit | d67e8291c86beb5c3c8e8b11a7f95b49c834c779 (patch) | |
tree | 23fe75d1ed5c58fc2dcef5860e3e4df1f36aa6b9 /OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |
parent | Add some run-time debugging support (diff) | |
download | opensim-SC-d67e8291c86beb5c3c8e8b11a7f95b49c834c779.zip opensim-SC-d67e8291c86beb5c3c8e8b11a7f95b49c834c779.tar.gz opensim-SC-d67e8291c86beb5c3c8e8b11a7f95b49c834c779.tar.bz2 opensim-SC-d67e8291c86beb5c3c8e8b11a7f95b49c834c779.tar.xz |
Add "app find <uuid-or-start-of-uuid>" command to find the appearance using a particular baked texture, if any.
This is for debugging to relate texture console entries back to particular users on the simulator end.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 39cd4c9..2369d94 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using log4net; | 33 | using log4net; |
@@ -124,6 +125,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
124 | + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen" | 125 | + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen" |
125 | + "\nsince requests can only be made for ids that the client has already sent us", | 126 | + "\nsince requests can only be made for ids that the client has already sent us", |
126 | HandleRebakeAppearanceCommand); | 127 | HandleRebakeAppearanceCommand); |
128 | |||
129 | scene.AddCommand( | ||
130 | this, "appearance find", | ||
131 | "appearance find <uuid-or-start-of-uuid>", | ||
132 | "Find out which avatar uses the given asset as a baked texture, if any.", | ||
133 | "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", | ||
134 | HandleFindAppearanceCommand); | ||
127 | } | 135 | } |
128 | 136 | ||
129 | private void HandleSendAppearanceCommand(string module, string[] cmd) | 137 | private void HandleSendAppearanceCommand(string module, string[] cmd) |
@@ -254,5 +262,47 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
254 | } | 262 | } |
255 | } | 263 | } |
256 | } | 264 | } |
265 | |||
266 | protected void HandleFindAppearanceCommand(string module, string[] cmd) | ||
267 | { | ||
268 | if (cmd.Length != 3) | ||
269 | { | ||
270 | MainConsole.Instance.OutputFormat("Usage: appearance find <uuid-or-start-of-uuid>"); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | string rawUuid = cmd[2]; | ||
275 | |||
276 | HashSet<ScenePresence> matchedAvatars = new HashSet<ScenePresence>(); | ||
277 | |||
278 | lock (m_scenes) | ||
279 | { | ||
280 | foreach (Scene scene in m_scenes.Values) | ||
281 | { | ||
282 | scene.ForEachRootScenePresence( | ||
283 | sp => | ||
284 | { | ||
285 | Dictionary<BakeType, Primitive.TextureEntryFace> bakedFaces = scene.AvatarFactory.GetBakedTextureFaces(sp.UUID); | ||
286 | foreach (Primitive.TextureEntryFace face in bakedFaces.Values) | ||
287 | { | ||
288 | if (face != null && face.TextureID.ToString().StartsWith(rawUuid)) | ||
289 | matchedAvatars.Add(sp); | ||
290 | } | ||
291 | }); | ||
292 | } | ||
293 | } | ||
294 | |||
295 | if (matchedAvatars.Count == 0) | ||
296 | { | ||
297 | MainConsole.Instance.OutputFormat("{0} did not match any baked avatar textures in use", rawUuid); | ||
298 | } | ||
299 | else | ||
300 | { | ||
301 | MainConsole.Instance.OutputFormat( | ||
302 | "{0} matched {1}", | ||
303 | rawUuid, | ||
304 | string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray())); | ||
305 | } | ||
306 | } | ||
257 | } | 307 | } |
258 | } \ No newline at end of file | 308 | } \ No newline at end of file |