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.cs113
1 files changed, 93 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 6feba21..87241e1 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -141,7 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
141 "show object uuid", 141 "show object uuid",
142 "show object uuid [--full] <UUID>", 142 "show object uuid [--full] <UUID>",
143 "Show details of a scene object with the given UUID", 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.", 144 "The --full option will print out information on all the parts of the object.\n"
145 + "For yet more detailed part information, use the \"show part\" commands.",
145 HandleShowObjectByUuid); 146 HandleShowObjectByUuid);
146 147
147 m_console.Commands.AddCommand( 148 m_console.Commands.AddCommand(
@@ -151,6 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
151 "show object name [--full] [--regex] <name>", 152 "show object name [--full] [--regex] <name>",
152 "Show details of scene objects with the given name.", 153 "Show details of scene objects with the given name.",
153 "The --full option will print out information on all the parts of the object.\n" 154 "The --full option will print out information on all the parts of the object.\n"
155 + "For yet more detailed part information, use the \"show part\" commands.\n"
154 + "If --regex is specified then the name is treatead as a regular expression.", 156 + "If --regex is specified then the name is treatead as a regular expression.",
155 HandleShowObjectByName); 157 HandleShowObjectByName);
156 158
@@ -161,6 +163,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
161 "show object pos [--full] <start-coord> to <end-coord>", 163 "show object pos [--full] <start-coord> to <end-coord>",
162 "Show details of scene objects within the given area.", 164 "Show details of scene objects within the given area.",
163 "The --full option will print out information on all the parts of the object.\n" 165 "The --full option will print out information on all the parts of the object.\n"
166 + "For yet more detailed part information, use the \"show part\" commands.\n"
164 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 167 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n"
165 + "If you don't care about the z component you can simply omit it.\n" 168 + "If you don't care about the z component you can simply omit it.\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" 169 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
@@ -242,7 +245,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
242 m_console.OutputFormat(sb.ToString()); 245 m_console.OutputFormat(sb.ToString());
243 } 246 }
244 247
245 private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate) 248 private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate, bool showFull)
246 { 249 {
247 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups(); 250 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
248 List<SceneObjectPart> parts = new List<SceneObjectPart>(); 251 List<SceneObjectPart> parts = new List<SceneObjectPart>();
@@ -253,7 +256,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
253 256
254 foreach (SceneObjectPart part in parts) 257 foreach (SceneObjectPart part in parts)
255 { 258 {
256 AddScenePartReport(sb, part); 259 AddScenePartReport(sb, part, showFull);
257 sb.Append("\n"); 260 sb.Append("\n");
258 } 261 }
259 262
@@ -362,21 +365,27 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
362 OutputSogsToConsole(searchPredicate, showFull); 365 OutputSogsToConsole(searchPredicate, showFull);
363 } 366 }
364 367
365 private void HandleShowPartByUuid(string module, string[] cmd) 368 private void HandleShowPartByUuid(string module, string[] cmdparams)
366 { 369 {
367 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 370 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
368 return; 371 return;
369 372
370 if (cmd.Length < 4) 373// bool showFull = false;
374 OptionSet options = new OptionSet();
375// options.Add("full", v => showFull = v != null );
376
377 List<string> mainParams = options.Parse(cmdparams);
378
379 if (mainParams.Count < 4)
371 { 380 {
372 m_console.OutputFormat("Usage: show part uuid <uuid>"); 381 m_console.OutputFormat("Usage: show part uuid [--full] <uuid>");
373 return; 382 return;
374 } 383 }
375 384
376 UUID objectUuid; 385 UUID objectUuid;
377 if (!UUID.TryParse(cmd[3], out objectUuid)) 386 if (!UUID.TryParse(mainParams[3], out objectUuid))
378 { 387 {
379 m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); 388 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
380 return; 389 return;
381 } 390 }
382 391
@@ -389,7 +398,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
389 } 398 }
390 399
391 StringBuilder sb = new StringBuilder(); 400 StringBuilder sb = new StringBuilder();
392 AddScenePartReport(sb, sop); 401 AddScenePartReport(sb, sop, true);
393 402
394 m_console.OutputFormat(sb.ToString()); 403 m_console.OutputFormat(sb.ToString());
395 } 404 }
@@ -399,13 +408,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
399 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 408 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
400 return; 409 return;
401 410
402 if (cmdparams.Length < 5) 411// bool showFull = false;
412 OptionSet options = new OptionSet();
413// options.Add("full", v => showFull = v != null );
414
415 List<string> mainParams = options.Parse(cmdparams);
416
417 if (mainParams.Count < 5)
403 { 418 {
404 m_console.OutputFormat("Usage: show part pos <start-coord> to <end-coord>"); 419 m_console.OutputFormat("Usage: show part pos [--full] <start-coord> to <end-coord>");
405 return; 420 return;
406 } 421 }
407 422
408 string rawConsoleStartVector = cmdparams[3]; 423 string rawConsoleStartVector = mainParams[3];
409 Vector3 startVector; 424 Vector3 startVector;
410 425
411 if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) 426 if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector))
@@ -414,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
414 return; 429 return;
415 } 430 }
416 431
417 string rawConsoleEndVector = cmdparams[5]; 432 string rawConsoleEndVector = mainParams[5];
418 Vector3 endVector; 433 Vector3 endVector;
419 434
420 if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) 435 if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector))
@@ -423,7 +438,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
423 return; 438 return;
424 } 439 }
425 440
426 OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector)); 441 OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector), true);
427 } 442 }
428 443
429 private void HandleShowPartByName(string module, string[] cmdparams) 444 private void HandleShowPartByName(string module, string[] cmdparams)
@@ -431,14 +446,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
431 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 446 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
432 return; 447 return;
433 448
449// bool showFull = false;
434 bool useRegex = false; 450 bool useRegex = false;
435 OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); 451 OptionSet options = new OptionSet();
452// options.Add("full", v => showFull = v != null );
453 options.Add("regex", v => useRegex = v != null );
436 454
437 List<string> mainParams = options.Parse(cmdparams); 455 List<string> mainParams = options.Parse(cmdparams);
438 456
439 if (mainParams.Count < 4) 457 if (mainParams.Count < 4)
440 { 458 {
441 m_console.OutputFormat("Usage: show part name [--regex] <name>"); 459 m_console.OutputFormat("Usage: show part name [--full] [--regex] <name>");
442 return; 460 return;
443 } 461 }
444 462
@@ -456,16 +474,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
456 searchPredicate = sop => sop.Name == name; 474 searchPredicate = sop => sop.Name == name;
457 } 475 }
458 476
459 OutputSopsToConsole(searchPredicate); 477 OutputSopsToConsole(searchPredicate, true);
460 } 478 }
461 479
480 /// <summary>
481 /// Append a scene object report to an input StringBuilder
482 /// </summary>
483 /// <returns></returns>
484 /// <param name='sb'></param>
485 /// <param name='so'</param>
486 /// <param name='showFull'>
487 /// If true then information on all parts of an object is appended.
488 /// If false then only summary information about an object is appended.
489 /// </param>
462 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull) 490 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull)
463 { 491 {
464 if (showFull) 492 if (showFull)
465 { 493 {
466 foreach (SceneObjectPart sop in so.Parts) 494 foreach (SceneObjectPart sop in so.Parts)
467 { 495 {
468 AddScenePartReport(sb, sop); 496 AddScenePartReport(sb, sop, false);
469 sb.Append("\n"); 497 sb.Append("\n");
470 } 498 }
471 } 499 }
@@ -491,7 +519,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
491 return sb.Append(cdl.ToString()); 519 return sb.Append(cdl.ToString());
492 } 520 }
493 521
494 private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) 522 /// <summary>
523 /// Append a scene object part report to an input StringBuilder
524 /// </summary>
525 /// <returns></returns>
526 /// <param name='sb'></param>
527 /// <param name='sop'</param>
528 /// <param name='showFull'>
529 /// If true then information on each inventory item will be shown.
530 /// If false then only summary inventory information is shown.
531 /// </param>
532 private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop, bool showFull)
495 { 533 {
496 ConsoleDisplayList cdl = new ConsoleDisplayList(); 534 ConsoleDisplayList cdl = new ConsoleDisplayList();
497 cdl.AddRow("Name", sop.Name); 535 cdl.AddRow("Name", sop.Name);
@@ -504,11 +542,46 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
504 sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID)); 542 sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID));
505 cdl.AddRow("Link number", sop.LinkNum); 543 cdl.AddRow("Link number", sop.LinkNum);
506 cdl.AddRow("Flags", sop.Flags); 544 cdl.AddRow("Flags", sop.Flags);
507 cdl.AddRow("Items", sop.Inventory.Count); 545
546 object itemsOutput;
547 if (showFull)
548 {
549 StringBuilder itemsSb = new StringBuilder("\n");
550 itemsOutput = AddScenePartItemsReport(itemsSb, sop.Inventory).ToString();
551 }
552 else
553 {
554 itemsOutput = sop.Inventory.Count;
555 }
556
557
558 cdl.AddRow("Items", itemsOutput);
508 559
509 return sb.Append(cdl.ToString()); 560 return sb.Append(cdl.ToString());
510 } 561 }
511 562
563 private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
564 {
565 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
566 cdt.Indent = 2;
567
568 cdt.AddColumn("Name", 50);
569 cdt.AddColumn("Type", 12);
570 cdt.AddColumn("Running", 7);
571 cdt.AddColumn("Item UUID", 36);
572 cdt.AddColumn("Asset UUID", 36);
573
574 foreach (TaskInventoryItem item in inv.GetInventoryItems())
575 cdt.AddRow(
576 item.Name,
577 ((InventoryType)item.InvType).ToString(),
578 (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a",
579 item.ItemID.ToString(),
580 item.AssetID.ToString());
581
582 return sb.Append(cdt.ToString());
583 }
584
512 private void HandleDeleteObject(string module, string[] cmd) 585 private void HandleDeleteObject(string module, string[] cmd)
513 { 586 {
514 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 587 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))