aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-05 04:22:08 +0100
committerJustin Clark-Casey (justincc)2012-10-05 04:22:08 +0100
commit22f6fa49e3751ce0bf80167e7d4467681faacf89 (patch)
tree4395b29913f4cae67888b7526b60c59b9a305dc1 /OpenSim
parentrefactor: eliminate some now duplicate code in ObjectCommandsModule (diff)
downloadopensim-SC-22f6fa49e3751ce0bf80167e7d4467681faacf89.zip
opensim-SC-22f6fa49e3751ce0bf80167e7d4467681faacf89.tar.gz
opensim-SC-22f6fa49e3751ce0bf80167e7d4467681faacf89.tar.bz2
opensim-SC-22f6fa49e3751ce0bf80167e7d4467681faacf89.tar.xz
Add "show part pos" console command to match "show object pos"
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs72
1 files changed, 72 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index fbc64e3..0c9295b 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -157,6 +157,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
157 "Show details of scene object parts with the given name.", 157 "Show details of scene object parts with the given name.",
158 "If --regex is specified then the name is treatead as a regular expression", 158 "If --regex is specified then the name is treatead as a regular expression",
159 HandleShowPartByName); 159 HandleShowPartByName);
160
161 m_console.Commands.AddCommand(
162 "Objects",
163 false,
164 "show part pos",
165 "show part pos <start-coord> to <end-coord>",
166 "Show details of scene object parts within the given area.",
167 "Each component of the coord is comma separated. There must be no spaces between the commas.\n"
168 + "If you don't care about the z component you can simply omit it.\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"
170 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
171 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
172 + "e.g.\n"
173 + "show object pos 20,20,20 to 40,40,40\n"
174 + "show object pos 20,20 to 40,40\n"
175 + "show object pos ,20,20 to ,40,40\n"
176 + "show object pos ,,30 to ,,~\n"
177 + "show object pos ,,-~ to ,,30",
178 HandleShowPartByPos);
160 } 179 }
161 180
162 public void RemoveRegion(Scene scene) 181 public void RemoveRegion(Scene scene)
@@ -318,6 +337,59 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
318 m_console.OutputFormat(sb.ToString()); 337 m_console.OutputFormat(sb.ToString());
319 } 338 }
320 339
340 private void HandleShowPartByPos(string module, string[] cmdparams)
341 {
342 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
343 return;
344
345 if (cmdparams.Length < 5)
346 {
347 m_console.OutputFormat("Usage: show part pos <start-coord> to <end-coord>");
348 return;
349 }
350
351 string rawConsoleStartVector = cmdparams[3];
352 Vector3 startVector;
353
354 if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector))
355 {
356 m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector);
357 return;
358 }
359
360 string rawConsoleEndVector = cmdparams[5];
361 Vector3 endVector;
362
363 if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector))
364 {
365 m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector);
366 return;
367 }
368
369 Predicate<SceneObjectGroup> searchPredicate
370 = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector);
371
372 List<SceneObjectPart> parts = new List<SceneObjectPart>();
373
374 Action<SceneObjectGroup> searchAction
375 = so
376 => so.ForEachPart(sop => { if (Util.IsInsideBox(so.AbsolutePosition, startVector, endVector)) { parts.Add(sop); }});
377
378 m_scene.ForEachSOG(searchAction);
379
380 StringBuilder sb = new StringBuilder();
381
382 foreach (SceneObjectPart part in parts)
383 {
384 AddScenePartReport(sb, part);
385 sb.Append("\n");
386 }
387
388 sb.AppendFormat("{0} parts found in {1}\n", parts.Count, m_scene.Name);
389
390 m_console.OutputFormat(sb.ToString());
391 }
392
321 private void HandleShowPartByName(string module, string[] cmdparams) 393 private void HandleShowPartByName(string module, string[] cmdparams)
322 { 394 {
323 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 395 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))