aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-10-28 17:29:04 +0000
committerJustin Clark-Casey (justincc)2014-11-25 23:23:09 +0000
commit9b09dd357556b0a038c2f7f83e4cd7318555bd11 (patch)
treee9f7eaf0305eb01dcf5ad4783a56f503ffd240c9 /OpenSim/Region/OptionalModules
parentFix recent regression where adaptive throttles stopped adjusting. (diff)
downloadopensim-SC_OLD-9b09dd357556b0a038c2f7f83e4cd7318555bd11.zip
opensim-SC_OLD-9b09dd357556b0a038c2f7f83e4cd7318555bd11.tar.gz
opensim-SC_OLD-9b09dd357556b0a038c2f7f83e4cd7318555bd11.tar.bz2
opensim-SC_OLD-9b09dd357556b0a038c2f7f83e4cd7318555bd11.tar.xz
Add "wearables show" console command.
This shows summary wearables information (shape, hair, etc.) for all avatars in the scene or specific information about a given avatar's wearables. Similar to the existing "attachments show" command.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs100
1 files changed, 97 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index fa35f0f..51dfd47 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
102 scene.AddCommand( 102 scene.AddCommand(
103 "Users", this, "appearance show", 103 "Users", this, "appearance show",
104 "appearance show [<first-name> <last-name>]", 104 "appearance show [<first-name> <last-name>]",
105 "Show appearance information for each avatar in the simulator.", 105 "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. " 106 "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." 107 + "\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." 108 + "\nOptionally, you can view just a particular avatar's appearance information."
@@ -132,6 +132,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
132 "Find out which avatar uses the given asset as a baked texture, if any.", 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.", 133 "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.",
134 HandleFindAppearanceCommand); 134 HandleFindAppearanceCommand);
135
136 scene.AddCommand(
137 "Users", this, "wearables show",
138 "wearables show [<first-name> <last-name>]",
139 "Show information about wearables for avatars.",
140 "If no avatar name is given then a general summary for all avatars in the scene is shown.\n"
141 + "If an avatar name is given then specific information about current wearables is shown.",
142 HandleShowWearablesCommand);
135 } 143 }
136 144
137 private void HandleSendAppearanceCommand(string module, string[] cmd) 145 private void HandleSendAppearanceCommand(string module, string[] cmd)
@@ -186,7 +194,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
186 } 194 }
187 } 195 }
188 196
189 protected void HandleShowAppearanceCommand(string module, string[] cmd) 197 private void HandleShowAppearanceCommand(string module, string[] cmd)
190 { 198 {
191 if (cmd.Length != 2 && cmd.Length < 4) 199 if (cmd.Length != 2 && cmd.Length < 4)
192 { 200 {
@@ -263,7 +271,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
263 } 271 }
264 } 272 }
265 273
266 protected void HandleFindAppearanceCommand(string module, string[] cmd) 274 private void HandleFindAppearanceCommand(string module, string[] cmd)
267 { 275 {
268 if (cmd.Length != 3) 276 if (cmd.Length != 3)
269 { 277 {
@@ -304,5 +312,91 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
304 string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray())); 312 string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray()));
305 } 313 }
306 } 314 }
315
316 protected void HandleShowWearablesCommand(string module, string[] cmd)
317 {
318 if (cmd.Length != 2 && cmd.Length < 4)
319 {
320 MainConsole.Instance.OutputFormat("Usage: wearables show [<first-name> <last-name>]");
321 return;
322 }
323
324 bool targetNameSupplied = false;
325 string optionalTargetFirstName = null;
326 string optionalTargetLastName = null;
327
328 if (cmd.Length >= 4)
329 {
330 targetNameSupplied = true;
331 optionalTargetFirstName = cmd[2];
332 optionalTargetLastName = cmd[3];
333 }
334
335 StringBuilder sb = new StringBuilder();
336
337 if (targetNameSupplied)
338 {
339 lock (m_scenes)
340 {
341 foreach (Scene scene in m_scenes.Values)
342 {
343 ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
344 if (sp != null && !sp.IsChildAgent)
345 AppendWearablesDetailReport(sp, sb);
346 }
347 }
348 }
349 else
350 {
351 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
352 cdt.AddColumn("Name", ConsoleDisplayUtil.UserNameSize);
353 cdt.AddColumn("Wearables", 2);
354
355 lock (m_scenes)
356 {
357 foreach (Scene scene in m_scenes.Values)
358 {
359 scene.ForEachRootScenePresence(
360 sp =>
361 {
362 int count = 0;
363
364 for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
365 count += sp.Appearance.Wearables[i].Count;
366
367 cdt.AddRow(sp.Name, count);
368 }
369 );
370 }
371 }
372
373 sb.Append(cdt.ToString());
374 }
375
376 MainConsole.Instance.Output(sb.ToString());
377 }
378
379 private void AppendWearablesDetailReport(ScenePresence sp, StringBuilder sb)
380 {
381 sb.AppendFormat("\nWearables for {0}\n", sp.Name);
382
383 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
384 cdt.AddColumn("Type", 10);
385 cdt.AddColumn("Item UUID", ConsoleDisplayUtil.UuidSize);
386 cdt.AddColumn("Asset UUID", ConsoleDisplayUtil.UuidSize);
387
388 for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
389 {
390 AvatarWearable aw = sp.Appearance.Wearables[i];
391
392 for (int j = 0; j < aw.Count; j++)
393 {
394 WearableItem wi = aw[j];
395 cdt.AddRow(Enum.GetName(typeof(WearableType), i), wi.ItemID, wi.AssetID);
396 }
397 }
398
399 sb.Append(cdt.ToString());
400 }
307 } 401 }
308} \ No newline at end of file 402} \ No newline at end of file