aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs116
1 files changed, 82 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 7a35182..6feba21 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -139,25 +139,29 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
139 "Objects", 139 "Objects",
140 false, 140 false,
141 "show object uuid", 141 "show object uuid",
142 "show object uuid <UUID>", 142 "show object uuid [--full] <UUID>",
143 "Show details of a scene object with the given UUID", HandleShowObjectByUuid); 143 "Show details of a scene object with the given UUID",
144 "The --full option will print out information on all the parts of the object.",
145 HandleShowObjectByUuid);
144 146
145 m_console.Commands.AddCommand( 147 m_console.Commands.AddCommand(
146 "Objects", 148 "Objects",
147 false, 149 false,
148 "show object name", 150 "show object name",
149 "show object name [--regex] <name>", 151 "show object name [--full] [--regex] <name>",
150 "Show details of scene objects with the given name.", 152 "Show details of scene objects with the given name.",
151 "If --regex is specified then the name is treatead as a regular expression", 153 "The --full option will print out information on all the parts of the object.\n"
154 + "If --regex is specified then the name is treatead as a regular expression.",
152 HandleShowObjectByName); 155 HandleShowObjectByName);
153 156
154 m_console.Commands.AddCommand( 157 m_console.Commands.AddCommand(
155 "Objects", 158 "Objects",
156 false, 159 false,
157 "show object pos", 160 "show object pos",
158 "show object pos <start-coord> to <end-coord>", 161 "show object pos [--full] <start-coord> to <end-coord>",
159 "Show details of scene objects within the given area.", 162 "Show details of scene objects within the given area.",
160 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 163 "The --full option will print out information on all the parts of the object.\n"
164 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n"
161 + "If you don't care about the z component you can simply omit it.\n" 165 + "If you don't care about the z component you can simply omit it.\n"
162 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" 166 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
163 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" 167 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
@@ -216,7 +220,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
216// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 220// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
217 } 221 }
218 222
219 private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate) 223 /// <summary>
224 /// Outputs the sogs to console.
225 /// </summary>
226 /// <param name='searchPredicate'></param>
227 /// <param name='showFull'>If true then output all part details. If false then output summary.</param>
228 private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate, bool showFull)
220 { 229 {
221 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); 230 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate);
222 231
@@ -224,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
224 233
225 foreach (SceneObjectGroup so in sceneObjects) 234 foreach (SceneObjectGroup so in sceneObjects)
226 { 235 {
227 AddSceneObjectReport(sb, so); 236 AddSceneObjectReport(sb, so, showFull);
228 sb.Append("\n"); 237 sb.Append("\n");
229 } 238 }
230 239
@@ -253,21 +262,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
253 m_console.OutputFormat(sb.ToString()); 262 m_console.OutputFormat(sb.ToString());
254 } 263 }
255 264
256 private void HandleShowObjectByUuid(string module, string[] cmd) 265 private void HandleShowObjectByUuid(string module, string[] cmdparams)
257 { 266 {
258 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 267 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
259 return; 268 return;
260 269
261 if (cmd.Length < 4) 270 bool showFull = false;
271 OptionSet options = new OptionSet().Add("full", v => showFull = v != null );
272
273 List<string> mainParams = options.Parse(cmdparams);
274
275 if (mainParams.Count < 4)
262 { 276 {
263 m_console.OutputFormat("Usage: show object uuid <uuid>"); 277 m_console.OutputFormat("Usage: show object uuid <uuid>");
264 return; 278 return;
265 } 279 }
266 280
267 UUID objectUuid; 281 UUID objectUuid;
268 if (!UUID.TryParse(cmd[3], out objectUuid)) 282 if (!UUID.TryParse(mainParams[3], out objectUuid))
269 { 283 {
270 m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); 284 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
271 return; 285 return;
272 } 286 }
273 287
@@ -280,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
280 } 294 }
281 295
282 StringBuilder sb = new StringBuilder(); 296 StringBuilder sb = new StringBuilder();
283 AddSceneObjectReport(sb, so); 297 AddSceneObjectReport(sb, so, showFull);
284 298
285 m_console.OutputFormat(sb.ToString()); 299 m_console.OutputFormat(sb.ToString());
286 } 300 }
@@ -290,14 +304,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
290 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 304 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
291 return; 305 return;
292 306
307 bool showFull = false;
293 bool useRegex = false; 308 bool useRegex = false;
294 OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); 309 OptionSet options = new OptionSet();
310 options.Add("full", v => showFull = v != null );
311 options.Add("regex", v => useRegex = v != null );
295 312
296 List<string> mainParams = options.Parse(cmdparams); 313 List<string> mainParams = options.Parse(cmdparams);
297 314
298 if (mainParams.Count < 4) 315 if (mainParams.Count < 4)
299 { 316 {
300 m_console.OutputFormat("Usage: show object name [--regex] <name>"); 317 m_console.OutputFormat("Usage: show object name [--full] [--regex] <name>");
301 return; 318 return;
302 } 319 }
303 320
@@ -315,7 +332,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
315 searchPredicate = so => so.Name == name; 332 searchPredicate = so => so.Name == name;
316 } 333 }
317 334
318 OutputSogsToConsole(searchPredicate); 335 OutputSogsToConsole(searchPredicate, showFull);
319 } 336 }
320 337
321 private void HandleShowObjectByPos(string module, string[] cmdparams) 338 private void HandleShowObjectByPos(string module, string[] cmdparams)
@@ -323,9 +340,14 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
323 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 340 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
324 return; 341 return;
325 342
326 if (cmdparams.Length < 5) 343 bool showFull = false;
344 OptionSet options = new OptionSet().Add("full", v => showFull = v != null );
345
346 List<string> mainParams = options.Parse(cmdparams);
347
348 if (mainParams.Count < 5)
327 { 349 {
328 m_console.OutputFormat("Usage: show object pos <start-coord> to <end-coord>"); 350 m_console.OutputFormat("Usage: show object pos [--full] <start-coord> to <end-coord>");
329 return; 351 return;
330 } 352 }
331 353
@@ -337,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
337 Predicate<SceneObjectGroup> searchPredicate 359 Predicate<SceneObjectGroup> searchPredicate
338 = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); 360 = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector);
339 361
340 OutputSogsToConsole(searchPredicate); 362 OutputSogsToConsole(searchPredicate, showFull);
341 } 363 }
342 364
343 private void HandleShowPartByUuid(string module, string[] cmd) 365 private void HandleShowPartByUuid(string module, string[] cmd)
@@ -437,28 +459,54 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
437 OutputSopsToConsole(searchPredicate); 459 OutputSopsToConsole(searchPredicate);
438 } 460 }
439 461
440 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) 462 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull)
441 { 463 {
442 sb.AppendFormat("Name: {0}\n", so.Name); 464 if (showFull)
443 sb.AppendFormat("Description: {0}\n", so.Description); 465 {
444 sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); 466 foreach (SceneObjectPart sop in so.Parts)
445 sb.AppendFormat("Parts: {0}\n", so.PrimCount); 467 {
446 sb.AppendFormat("Flags: {0}\n", so.RootPart.Flags); 468 AddScenePartReport(sb, sop);
469 sb.Append("\n");
470 }
471 }
472 else
473 {
474 AddSummarySceneObjectReport(sb, so);
475 }
447 476
448 return sb; 477 return sb;
449 } 478 }
450 479
451 private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) 480 private StringBuilder AddSummarySceneObjectReport(StringBuilder sb, SceneObjectGroup so)
452 { 481 {
453 sb.AppendFormat("Name: {0}\n", sop.Name); 482 ConsoleDisplayList cdl = new ConsoleDisplayList();
454 sb.AppendFormat("Description: {0}\n", sop.Description); 483 cdl.AddRow("Name", so.Name);
455 sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); 484 cdl.AddRow("Descrition", so.Description);
456 sb.AppendFormat("Parent: {0}", 485 cdl.AddRow("Local ID", so.LocalId);
457 sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); 486 cdl.AddRow("UUID", so.UUID);
458 sb.AppendFormat("Link number: {0}\n", sop.LinkNum); 487 cdl.AddRow("Location", string.Format("{0} @ {1}", so.AbsolutePosition, so.Scene.Name));
459 sb.AppendFormat("Flags: {0}\n", sop.Flags); 488 cdl.AddRow("Parts", so.PrimCount);
489 cdl.AddRow("Flags", so.RootPart.Flags);
490
491 return sb.Append(cdl.ToString());
492 }
460 493
461 return sb; 494 private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop)
495 {
496 ConsoleDisplayList cdl = new ConsoleDisplayList();
497 cdl.AddRow("Name", sop.Name);
498 cdl.AddRow("Description", sop.Description);
499 cdl.AddRow("Local ID", sop.LocalId);
500 cdl.AddRow("UUID", sop.UUID);
501 cdl.AddRow("Location", string.Format("{0} @ {1}", sop.AbsolutePosition, sop.ParentGroup.Scene.Name));
502 cdl.AddRow(
503 "Parent",
504 sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID));
505 cdl.AddRow("Link number", sop.LinkNum);
506 cdl.AddRow("Flags", sop.Flags);
507 cdl.AddRow("Items", sop.Inventory.Count);
508
509 return sb.Append(cdl.ToString());
462 } 510 }
463 511
464 private void HandleDeleteObject(string module, string[] cmd) 512 private void HandleDeleteObject(string module, string[] cmd)