diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 196 |
1 files changed, 185 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index d718a2f..2f9bb1e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |||
@@ -51,7 +51,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
51 | { | 51 | { |
52 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 54 | private List<Scene> m_scenes = new List<Scene>(); |
55 | |||
55 | // private IAvatarFactoryModule m_avatarFactory; | 56 | // private IAvatarFactoryModule m_avatarFactory; |
56 | 57 | ||
57 | public string Name { get { return "Appearance Information Module"; } } | 58 | public string Name { get { return "Appearance Information Module"; } } |
@@ -83,7 +84,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
83 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | 84 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); |
84 | 85 | ||
85 | lock (m_scenes) | 86 | lock (m_scenes) |
86 | m_scenes.Remove(scene.RegionInfo.RegionID); | 87 | m_scenes.Remove(scene); |
87 | } | 88 | } |
88 | 89 | ||
89 | public void RegionLoaded(Scene scene) | 90 | public void RegionLoaded(Scene scene) |
@@ -91,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
91 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 92 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
92 | 93 | ||
93 | lock (m_scenes) | 94 | lock (m_scenes) |
94 | m_scenes[scene.RegionInfo.RegionID] = scene; | 95 | m_scenes.Add(scene); |
95 | 96 | ||
96 | scene.AddCommand( | 97 | scene.AddCommand( |
97 | "Users", this, "show appearance", | 98 | "Users", this, "show appearance", |
@@ -102,7 +103,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
102 | scene.AddCommand( | 103 | scene.AddCommand( |
103 | "Users", this, "appearance show", | 104 | "Users", this, "appearance show", |
104 | "appearance show [<first-name> <last-name>]", | 105 | "appearance show [<first-name> <last-name>]", |
105 | "Show appearance information for each avatar in the simulator.", | 106 | "Show appearance information for avatars.", |
106 | "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " | 107 | "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " |
107 | + "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud." | 108 | + "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud." |
108 | + "\nOptionally, you can view just a particular avatar's appearance information." | 109 | + "\nOptionally, you can view just a particular avatar's appearance information." |
@@ -132,6 +133,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
132 | "Find out which avatar uses the given asset as a baked texture, if any.", | 133 | "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 | "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", |
134 | HandleFindAppearanceCommand); | 135 | HandleFindAppearanceCommand); |
136 | |||
137 | scene.AddCommand( | ||
138 | "Users", this, "wearables show", | ||
139 | "wearables show [<first-name> <last-name>]", | ||
140 | "Show information about wearables for avatars.", | ||
141 | "If no avatar name is given then a general summary for all avatars in the scene is shown.\n" | ||
142 | + "If an avatar name is given then specific information about current wearables is shown.", | ||
143 | HandleShowWearablesCommand); | ||
144 | |||
145 | scene.AddCommand( | ||
146 | "Users", this, "wearables check", | ||
147 | "wearables check <first-name> <last-name>", | ||
148 | "Check that the wearables of a given avatar in the scene are valid.", | ||
149 | "This currently checks that the wearable assets themselves and any assets referenced by them exist.", | ||
150 | HandleCheckWearablesCommand); | ||
135 | } | 151 | } |
136 | 152 | ||
137 | private void HandleSendAppearanceCommand(string module, string[] cmd) | 153 | private void HandleSendAppearanceCommand(string module, string[] cmd) |
@@ -155,7 +171,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
155 | 171 | ||
156 | lock (m_scenes) | 172 | lock (m_scenes) |
157 | { | 173 | { |
158 | foreach (Scene scene in m_scenes.Values) | 174 | foreach (Scene scene in m_scenes) |
159 | { | 175 | { |
160 | if (targetNameSupplied) | 176 | if (targetNameSupplied) |
161 | { | 177 | { |
@@ -186,7 +202,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
186 | } | 202 | } |
187 | } | 203 | } |
188 | 204 | ||
189 | protected void HandleShowAppearanceCommand(string module, string[] cmd) | 205 | private void HandleShowAppearanceCommand(string module, string[] cmd) |
190 | { | 206 | { |
191 | if (cmd.Length != 2 && cmd.Length < 4) | 207 | if (cmd.Length != 2 && cmd.Length < 4) |
192 | { | 208 | { |
@@ -207,7 +223,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
207 | 223 | ||
208 | lock (m_scenes) | 224 | lock (m_scenes) |
209 | { | 225 | { |
210 | foreach (Scene scene in m_scenes.Values) | 226 | foreach (Scene scene in m_scenes) |
211 | { | 227 | { |
212 | if (targetNameSupplied) | 228 | if (targetNameSupplied) |
213 | { | 229 | { |
@@ -222,7 +238,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
222 | { | 238 | { |
223 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); | 239 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); |
224 | MainConsole.Instance.OutputFormat( | 240 | MainConsole.Instance.OutputFormat( |
225 | "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); | 241 | "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "incomplete"); |
226 | } | 242 | } |
227 | ); | 243 | ); |
228 | } | 244 | } |
@@ -243,7 +259,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
243 | 259 | ||
244 | lock (m_scenes) | 260 | lock (m_scenes) |
245 | { | 261 | { |
246 | foreach (Scene scene in m_scenes.Values) | 262 | foreach (Scene scene in m_scenes) |
247 | { | 263 | { |
248 | ScenePresence sp = scene.GetScenePresence(firstname, lastname); | 264 | ScenePresence sp = scene.GetScenePresence(firstname, lastname); |
249 | if (sp != null && !sp.IsChildAgent) | 265 | if (sp != null && !sp.IsChildAgent) |
@@ -263,7 +279,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
263 | } | 279 | } |
264 | } | 280 | } |
265 | 281 | ||
266 | protected void HandleFindAppearanceCommand(string module, string[] cmd) | 282 | private void HandleFindAppearanceCommand(string module, string[] cmd) |
267 | { | 283 | { |
268 | if (cmd.Length != 3) | 284 | if (cmd.Length != 3) |
269 | { | 285 | { |
@@ -277,7 +293,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
277 | 293 | ||
278 | lock (m_scenes) | 294 | lock (m_scenes) |
279 | { | 295 | { |
280 | foreach (Scene scene in m_scenes.Values) | 296 | foreach (Scene scene in m_scenes) |
281 | { | 297 | { |
282 | scene.ForEachRootScenePresence( | 298 | scene.ForEachRootScenePresence( |
283 | sp => | 299 | sp => |
@@ -304,5 +320,163 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
304 | string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray())); | 320 | string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray())); |
305 | } | 321 | } |
306 | } | 322 | } |
323 | |||
324 | protected void HandleShowWearablesCommand(string module, string[] cmd) | ||
325 | { | ||
326 | if (cmd.Length != 2 && cmd.Length < 4) | ||
327 | { | ||
328 | MainConsole.Instance.OutputFormat("Usage: wearables show [<first-name> <last-name>]"); | ||
329 | return; | ||
330 | } | ||
331 | |||
332 | bool targetNameSupplied = false; | ||
333 | string optionalTargetFirstName = null; | ||
334 | string optionalTargetLastName = null; | ||
335 | |||
336 | if (cmd.Length >= 4) | ||
337 | { | ||
338 | targetNameSupplied = true; | ||
339 | optionalTargetFirstName = cmd[2]; | ||
340 | optionalTargetLastName = cmd[3]; | ||
341 | } | ||
342 | |||
343 | StringBuilder sb = new StringBuilder(); | ||
344 | |||
345 | if (targetNameSupplied) | ||
346 | { | ||
347 | lock (m_scenes) | ||
348 | { | ||
349 | foreach (Scene scene in m_scenes) | ||
350 | { | ||
351 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
352 | if (sp != null && !sp.IsChildAgent) | ||
353 | AppendWearablesDetailReport(sp, sb); | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
360 | cdt.AddColumn("Name", ConsoleDisplayUtil.UserNameSize); | ||
361 | cdt.AddColumn("Wearables", 2); | ||
362 | |||
363 | lock (m_scenes) | ||
364 | { | ||
365 | foreach (Scene scene in m_scenes) | ||
366 | { | ||
367 | scene.ForEachRootScenePresence( | ||
368 | sp => | ||
369 | { | ||
370 | int count = 0; | ||
371 | |||
372 | for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++) | ||
373 | count += sp.Appearance.Wearables[i].Count; | ||
374 | |||
375 | cdt.AddRow(sp.Name, count); | ||
376 | } | ||
377 | ); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | sb.Append(cdt.ToString()); | ||
382 | } | ||
383 | |||
384 | MainConsole.Instance.Output(sb.ToString()); | ||
385 | } | ||
386 | |||
387 | private void HandleCheckWearablesCommand(string module, string[] cmd) | ||
388 | { | ||
389 | if (cmd.Length != 4) | ||
390 | { | ||
391 | MainConsole.Instance.OutputFormat("Usage: wearables check <first-name> <last-name>"); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | string firstname = cmd[2]; | ||
396 | string lastname = cmd[3]; | ||
397 | |||
398 | StringBuilder sb = new StringBuilder(); | ||
399 | UuidGatherer uuidGatherer = new UuidGatherer(m_scenes[0].AssetService); | ||
400 | |||
401 | lock (m_scenes) | ||
402 | { | ||
403 | foreach (Scene scene in m_scenes) | ||
404 | { | ||
405 | ScenePresence sp = scene.GetScenePresence(firstname, lastname); | ||
406 | if (sp != null && !sp.IsChildAgent) | ||
407 | { | ||
408 | sb.AppendFormat("Wearables checks for {0}\n\n", sp.Name); | ||
409 | |||
410 | for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++) | ||
411 | { | ||
412 | AvatarWearable aw = sp.Appearance.Wearables[i]; | ||
413 | |||
414 | if (aw.Count > 0) | ||
415 | { | ||
416 | sb.Append(Enum.GetName(typeof(WearableType), i)); | ||
417 | sb.Append("\n"); | ||
418 | |||
419 | for (int j = 0; j < aw.Count; j++) | ||
420 | { | ||
421 | WearableItem wi = aw[j]; | ||
422 | |||
423 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
424 | cdl.Indent = 2; | ||
425 | cdl.AddRow("Item UUID", wi.ItemID); | ||
426 | cdl.AddRow("Assets", ""); | ||
427 | sb.Append(cdl.ToString()); | ||
428 | |||
429 | uuidGatherer.AddForInspection(wi.AssetID); | ||
430 | uuidGatherer.GatherAll(); | ||
431 | string[] assetStrings | ||
432 | = Array.ConvertAll<UUID, string>(uuidGatherer.GatheredUuids.Keys.ToArray(), u => u.ToString()); | ||
433 | |||
434 | bool[] existChecks = scene.AssetService.AssetsExist(assetStrings); | ||
435 | |||
436 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
437 | cdt.Indent = 4; | ||
438 | cdt.AddColumn("Type", 10); | ||
439 | cdt.AddColumn("UUID", ConsoleDisplayUtil.UuidSize); | ||
440 | cdt.AddColumn("Found", 5); | ||
441 | |||
442 | for (int k = 0; k < existChecks.Length; k++) | ||
443 | cdt.AddRow( | ||
444 | (AssetType)uuidGatherer.GatheredUuids[new UUID(assetStrings[k])], | ||
445 | assetStrings[k], existChecks[k] ? "yes" : "no"); | ||
446 | |||
447 | sb.Append(cdt.ToString()); | ||
448 | sb.Append("\n"); | ||
449 | } | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | MainConsole.Instance.Output(sb.ToString()); | ||
457 | } | ||
458 | |||
459 | private void AppendWearablesDetailReport(ScenePresence sp, StringBuilder sb) | ||
460 | { | ||
461 | sb.AppendFormat("\nWearables for {0}\n", sp.Name); | ||
462 | |||
463 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
464 | cdt.AddColumn("Type", 10); | ||
465 | cdt.AddColumn("Item UUID", ConsoleDisplayUtil.UuidSize); | ||
466 | cdt.AddColumn("Asset UUID", ConsoleDisplayUtil.UuidSize); | ||
467 | |||
468 | for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++) | ||
469 | { | ||
470 | AvatarWearable aw = sp.Appearance.Wearables[i]; | ||
471 | |||
472 | for (int j = 0; j < aw.Count; j++) | ||
473 | { | ||
474 | WearableItem wi = aw[j]; | ||
475 | cdt.AddRow(Enum.GetName(typeof(WearableType), i), wi.ItemID, wi.AssetID); | ||
476 | } | ||
477 | } | ||
478 | |||
479 | sb.Append(cdt.ToString()); | ||
480 | } | ||
307 | } | 481 | } |
308 | } \ No newline at end of file | 482 | } \ No newline at end of file |