aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs95
1 files changed, 94 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 1ce24f1..2369d94 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Reflection; 31using System.Reflection;
31using System.Text; 32using System.Text;
32using log4net; 33using log4net;
@@ -114,6 +115,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
114 "Send appearance data for each avatar in the simulator to other viewers.", 115 "Send appearance data for each avatar in the simulator to other viewers.",
115 "Optionally, you can specify that only a particular avatar's appearance data is sent.", 116 "Optionally, you can specify that only a particular avatar's appearance data is sent.",
116 HandleSendAppearanceCommand); 117 HandleSendAppearanceCommand);
118
119 scene.AddCommand(
120 this, "appearance rebake",
121 "appearance rebake <first-name> <last-name>",
122 "Send a request to the user's viewer for it to rebake and reupload its appearance textures.",
123 "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not."
124 + "\nThis will only work for texture ids that the viewer has already uploaded."
125 + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen"
126 + "\nsince requests can only be made for ids that the client has already sent us",
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);
117 } 135 }
118 136
119 private void HandleSendAppearanceCommand(string module, string[] cmd) 137 private void HandleSendAppearanceCommand(string module, string[] cmd)
@@ -210,6 +228,81 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
210 } 228 }
211 } 229 }
212 } 230 }
213 } 231 }
232
233 private void HandleRebakeAppearanceCommand(string module, string[] cmd)
234 {
235 if (cmd.Length != 4)
236 {
237 MainConsole.Instance.OutputFormat("Usage: appearance rebake <first-name> <last-name>");
238 return;
239 }
240
241 string firstname = cmd[2];
242 string lastname = cmd[3];
243
244 lock (m_scenes)
245 {
246 foreach (Scene scene in m_scenes.Values)
247 {
248 ScenePresence sp = scene.GetScenePresence(firstname, lastname);
249 if (sp != null && !sp.IsChildAgent)
250 {
251 int rebakesRequested = scene.AvatarFactory.RequestRebake(sp, false);
252
253 if (rebakesRequested > 0)
254 MainConsole.Instance.OutputFormat(
255 "Requesting rebake of {0} uploaded textures for {1} in {2}",
256 rebakesRequested, sp.Name, scene.RegionInfo.RegionName);
257 else
258 MainConsole.Instance.OutputFormat(
259 "No texture IDs available for rebake request for {0} in {1}",
260 sp.Name, scene.RegionInfo.RegionName);
261 }
262 }
263 }
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 }
214 } 307 }
215} \ No newline at end of file 308} \ No newline at end of file