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.
mb-throttle-test
Justin Clark-Casey (justincc) 2014-10-28 17:29:04 +00:00
parent 5ab5d7fe47
commit 9b09dd3575
2 changed files with 97 additions and 3 deletions

View File

@ -102,7 +102,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
scene.AddCommand(
"Users", this, "appearance show",
"appearance show [<first-name> <last-name>]",
"Show appearance information for each avatar in the simulator.",
"Show appearance information for avatars.",
"This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. "
+ "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud."
+ "\nOptionally, you can view just a particular avatar's appearance information."
@ -132,6 +132,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
"Find out which avatar uses the given asset as a baked texture, if any.",
"You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.",
HandleFindAppearanceCommand);
scene.AddCommand(
"Users", this, "wearables show",
"wearables show [<first-name> <last-name>]",
"Show information about wearables for avatars.",
"If no avatar name is given then a general summary for all avatars in the scene is shown.\n"
+ "If an avatar name is given then specific information about current wearables is shown.",
HandleShowWearablesCommand);
}
private void HandleSendAppearanceCommand(string module, string[] cmd)
@ -186,7 +194,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
}
}
protected void HandleShowAppearanceCommand(string module, string[] cmd)
private void HandleShowAppearanceCommand(string module, string[] cmd)
{
if (cmd.Length != 2 && cmd.Length < 4)
{
@ -263,7 +271,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
}
}
protected void HandleFindAppearanceCommand(string module, string[] cmd)
private void HandleFindAppearanceCommand(string module, string[] cmd)
{
if (cmd.Length != 3)
{
@ -304,5 +312,91 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray()));
}
}
protected void HandleShowWearablesCommand(string module, string[] cmd)
{
if (cmd.Length != 2 && cmd.Length < 4)
{
MainConsole.Instance.OutputFormat("Usage: wearables show [<first-name> <last-name>]");
return;
}
bool targetNameSupplied = false;
string optionalTargetFirstName = null;
string optionalTargetLastName = null;
if (cmd.Length >= 4)
{
targetNameSupplied = true;
optionalTargetFirstName = cmd[2];
optionalTargetLastName = cmd[3];
}
StringBuilder sb = new StringBuilder();
if (targetNameSupplied)
{
lock (m_scenes)
{
foreach (Scene scene in m_scenes.Values)
{
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
if (sp != null && !sp.IsChildAgent)
AppendWearablesDetailReport(sp, sb);
}
}
}
else
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Name", ConsoleDisplayUtil.UserNameSize);
cdt.AddColumn("Wearables", 2);
lock (m_scenes)
{
foreach (Scene scene in m_scenes.Values)
{
scene.ForEachRootScenePresence(
sp =>
{
int count = 0;
for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
count += sp.Appearance.Wearables[i].Count;
cdt.AddRow(sp.Name, count);
}
);
}
}
sb.Append(cdt.ToString());
}
MainConsole.Instance.Output(sb.ToString());
}
private void AppendWearablesDetailReport(ScenePresence sp, StringBuilder sb)
{
sb.AppendFormat("\nWearables for {0}\n", sp.Name);
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Type", 10);
cdt.AddColumn("Item UUID", ConsoleDisplayUtil.UuidSize);
cdt.AddColumn("Asset UUID", ConsoleDisplayUtil.UuidSize);
for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
{
AvatarWearable aw = sp.Appearance.Wearables[i];
for (int j = 0; j < aw.Count; j++)
{
WearableItem wi = aw[j];
cdt.AddRow(Enum.GetName(typeof(WearableType), i), wi.ItemID, wi.AssetID);
}
}
sb.Append(cdt.ToString());
}
}
}

Binary file not shown.