aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-24 04:10:22 +0100
committerJustin Clark-Casey (justincc)2012-10-24 04:10:22 +0100
commit81aeecc90723658187668baa49bd168b7b333afb (patch)
tree11e62ae375450e7d8d500565e29d05cc9b0b4ec7 /OpenSim/Region/CoreModules
parentGet "save oar" and "save iar" to tell you in a more friendly manner if the fi... (diff)
downloadopensim-SC_OLD-81aeecc90723658187668baa49bd168b7b333afb.zip
opensim-SC_OLD-81aeecc90723658187668baa49bd168b7b333afb.tar.gz
opensim-SC_OLD-81aeecc90723658187668baa49bd168b7b333afb.tar.bz2
opensim-SC_OLD-81aeecc90723658187668baa49bd168b7b333afb.tar.xz
Allow "show object", "show part", "dump object" and "delete object" to accept a local ID as well as a UUID.
This means that the sub-commands are now id rather than uuid, e.g. show object id
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs103
1 files changed, 61 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index f0a35ad..b2c9bce 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -99,9 +99,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
99 HandleDeleteObject); 99 HandleDeleteObject);
100 100
101 m_console.Commands.AddCommand( 101 m_console.Commands.AddCommand(
102 "Objects", false, "delete object uuid", 102 "Objects", false, "delete object id",
103 "delete object uuid <UUID>", 103 "delete object id <UUID-or-localID>",
104 "Delete a scene object by uuid", 104 "Delete a scene object by uuid or localID",
105 HandleDeleteObject); 105 HandleDeleteObject);
106 106
107 m_console.Commands.AddCommand( 107 m_console.Commands.AddCommand(
@@ -131,12 +131,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
131 m_console.Commands.AddCommand( 131 m_console.Commands.AddCommand(
132 "Objects", 132 "Objects",
133 false, 133 false,
134 "show object uuid", 134 "show object id",
135 "show object uuid [--full] <UUID>", 135 "show object id [--full] <UUID-or-localID>",
136 "Show details of a scene object with the given UUID", 136 "Show details of a scene object with the given UUID or localID",
137 "The --full option will print out information on all the parts of the object.\n" 137 "The --full option will print out information on all the parts of the object.\n"
138 + "For yet more detailed part information, use the \"show part\" commands.", 138 + "For yet more detailed part information, use the \"show part\" commands.",
139 HandleShowObjectByUuid); 139 HandleShowObjectById);
140 140
141 m_console.Commands.AddCommand( 141 m_console.Commands.AddCommand(
142 "Objects", 142 "Objects",
@@ -163,9 +163,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
163 m_console.Commands.AddCommand( 163 m_console.Commands.AddCommand(
164 "Objects", 164 "Objects",
165 false, 165 false,
166 "show part uuid", 166 "show part id",
167 "show part uuid <UUID>", 167 "show part id <UUID-or-localID>",
168 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 168 "Show details of a scene object part with the given UUID or localID", HandleShowPartById);
169 169
170 m_console.Commands.AddCommand( 170 m_console.Commands.AddCommand(
171 "Objects", 171 "Objects",
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
173 "show part name", 173 "show part name",
174 "show part name [--regex] <name>", 174 "show part name [--regex] <name>",
175 "Show details of scene object parts with the given name.", 175 "Show details of scene object parts with the given name.",
176 "If --regex is specified then the name is treatead as a regular expression", 176 "If --regex is specified then the name is treated as a regular expression",
177 HandleShowPartByName); 177 HandleShowPartByName);
178 178
179 m_console.Commands.AddCommand( 179 m_console.Commands.AddCommand(
@@ -188,12 +188,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
188 m_console.Commands.AddCommand( 188 m_console.Commands.AddCommand(
189 "Objects", 189 "Objects",
190 false, 190 false,
191 "dump object uuid", 191 "dump object id",
192 "dump object uuid <UUID>", 192 "dump object id <UUID-or-localID>",
193 "Dump the formatted serialization of the given object to the file <UUID>.xml", 193 "Dump the formatted serialization of the given object to the file <UUID>.xml",
194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n" 194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
195 + "To locate the UUID in the first place, you need to use the other show object commands", 195 + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n"
196 HandleDumpObjectByUuid); 196 + "If a local ID is given then the filename used is still that for the UUID",
197 HandleDumpObjectById);
197 } 198 }
198 199
199 public void RemoveRegion(Scene scene) 200 public void RemoveRegion(Scene scene)
@@ -248,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
248 m_console.OutputFormat(sb.ToString()); 249 m_console.OutputFormat(sb.ToString());
249 } 250 }
250 251
251 private void HandleShowObjectByUuid(string module, string[] cmdparams) 252 private void HandleShowObjectById(string module, string[] cmdparams)
252 { 253 {
253 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 254 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
254 return; 255 return;
@@ -264,14 +265,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
264 return; 265 return;
265 } 266 }
266 267
267 UUID objectUuid; 268 UUID uuid;
268 if (!UUID.TryParse(mainParams[3], out objectUuid)) 269 uint localId;
269 { 270 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out uuid, out localId))
270 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
271 return; 271 return;
272 }
273 272
274 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); 273 SceneObjectGroup so;
274
275 if (localId != ConsoleUtil.LocalIdNotFound)
276 so = m_scene.GetSceneObjectGroup(localId);
277 else
278 so = m_scene.GetSceneObjectGroup(uuid);
275 279
276 if (so == null) 280 if (so == null)
277 { 281 {
@@ -348,7 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
348 OutputSogsToConsole(searchPredicate, showFull); 352 OutputSogsToConsole(searchPredicate, showFull);
349 } 353 }
350 354
351 private void HandleShowPartByUuid(string module, string[] cmdparams) 355 private void HandleShowPartById(string module, string[] cmdparams)
352 { 356 {
353 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 357 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
354 return; 358 return;
@@ -361,18 +365,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
361 365
362 if (mainParams.Count < 4) 366 if (mainParams.Count < 4)
363 { 367 {
364 m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); 368 m_console.OutputFormat("Usage: show part id [--full] <UUID-or-localID>");
365 return; 369 return;
366 } 370 }
367 371
368 UUID objectUuid; 372 UUID objectUuid;
369 if (!UUID.TryParse(mainParams[3], out objectUuid)) 373 uint localId;
370 { 374 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out objectUuid, out localId))
371 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
372 return; 375 return;
373 }
374 376
375 SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); 377 SceneObjectPart sop;
378 if (localId == ConsoleUtil.LocalIdNotFound)
379 sop = m_scene.GetSceneObjectPart(objectUuid);
380 else
381 sop = m_scene.GetSceneObjectPart(localId);
376 382
377 if (sop == null) 383 if (sop == null)
378 { 384 {
@@ -460,22 +466,27 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
460 OutputSopsToConsole(searchPredicate, true); 466 OutputSopsToConsole(searchPredicate, true);
461 } 467 }
462 468
463 private void HandleDumpObjectByUuid(string module, string[] cmdparams) 469 private void HandleDumpObjectById(string module, string[] cmdparams)
464 { 470 {
465 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 471 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
466 return; 472 return;
467 473
468 if (cmdparams.Length < 4) 474 if (cmdparams.Length < 4)
469 { 475 {
470 m_console.OutputFormat("Usage: dump object uuid <uuid>"); 476 m_console.OutputFormat("Usage: dump object id <UUID-or-localID>");
471 return; 477 return;
472 } 478 }
473 479
474 UUID objectUuid; 480 UUID objectUuid;
475 if (!ConsoleUtil.TryParseConsoleUuid(m_console, cmdparams[3], out objectUuid)) 481 uint localId;
482 if (!ConsoleUtil.TryParseConsoleId(m_console, cmdparams[3], out objectUuid, out localId))
476 return; 483 return;
477 484
478 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); 485 SceneObjectGroup so;
486 if (localId == ConsoleUtil.LocalIdNotFound)
487 so = m_scene.GetSceneObjectGroup(objectUuid);
488 else
489 so = m_scene.GetSceneObjectGroup(localId);
479 490
480 if (so == null) 491 if (so == null)
481 { 492 {
@@ -483,6 +494,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
483 return; 494 return;
484 } 495 }
485 496
497 // In case we found it via local ID.
498 objectUuid = so.UUID;
499
486 string fileName = string.Format("{0}.xml", objectUuid); 500 string fileName = string.Format("{0}.xml", objectUuid);
487 501
488 if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) 502 if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName))
@@ -661,19 +675,24 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
661 675
662 break; 676 break;
663 677
664 case "uuid": 678 case "id":
665 if (!UUID.TryParse(o, out match)) 679 UUID uuid;
680 uint localId;
681 if (!ConsoleUtil.TryParseConsoleId(m_console, o, out uuid, out localId))
666 return; 682 return;
667 683
668 requireConfirmation = false; 684 requireConfirmation = false;
669 deletes = new List<SceneObjectGroup>(); 685 deletes = new List<SceneObjectGroup>();
670 686
671 m_scene.ForEachSOG(delegate (SceneObjectGroup g) 687 SceneObjectGroup so;
672 { 688 if (localId == ConsoleUtil.LocalIdNotFound)
673 if (g.UUID == match && !g.IsAttachment) 689 so = m_scene.GetSceneObjectGroup(uuid);
674 deletes.Add(g); 690 else
675 }); 691 so = m_scene.GetSceneObjectGroup(localId);
676 692
693 if (!so.IsAttachment)
694 deletes.Add(so);
695
677 // if (deletes.Count == 0) 696 // if (deletes.Count == 0)
678 // m_console.OutputFormat("No objects were found with uuid {0}", match); 697 // m_console.OutputFormat("No objects were found with uuid {0}", match);
679 698