aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Util.cs13
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs67
2 files changed, 80 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 1b9777f..5c7797a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -534,6 +534,19 @@ namespace OpenSim.Framework
534 } 534 }
535 535
536 /// <summary> 536 /// <summary>
537 /// Determines whether a point is inside a bounding box.
538 /// </summary>
539 /// <param name='v'>/param>
540 /// <param name='min'></param>
541 /// <param name='max'></param>
542 /// <returns></returns>
543 public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max)
544 {
545 return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z
546 && v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z;
547 }
548
549 /// <summary>
537 /// Are the co-ordinates of the new region visible from the old region? 550 /// Are the co-ordinates of the new region visible from the old region?
538 /// </summary> 551 /// </summary>
539 /// <param name="oldx">Old region x-coord</param> 552 /// <param name="oldx">Old region x-coord</param>
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index e96dc3e..5ecf5a1 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -126,6 +126,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
126 m_console.Commands.AddCommand( 126 m_console.Commands.AddCommand(
127 "Objects", 127 "Objects",
128 false, 128 false,
129 "show object pos",
130 "show object pos <start-coord> to <end-coord>",
131 "Show details of scene objects within the given area.",
132 "Each component of the coord is comma separated. There must be no spaces between the commas.\n"
133 + "If you don't care about the z component you can simply omit it.\n"
134 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
135 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
136 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
137 + "e.g.\n"
138 + "show object pos 20,20,20 to 40,40,40\n"
139 + "show object pos 20,20 to 40,40\n"
140 + "show object pos ,20,20 to ,40,40\n"
141 + "show object pos ,,30 to ,,~\n"
142 + "show object pos ,,-~ to ,,30\n",
143 HandleShowObjectByPos);
144
145 m_console.Commands.AddCommand(
146 "Objects",
147 false,
129 "show part uuid", 148 "show part uuid",
130 "show part uuid <UUID>", 149 "show part uuid <UUID>",
131 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 150 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid);
@@ -228,6 +247,54 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
228 m_console.OutputFormat(sb.ToString()); 247 m_console.OutputFormat(sb.ToString());
229 } 248 }
230 249
250 private void HandleShowObjectByPos(string module, string[] cmdparams)
251 {
252 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
253 return;
254
255 if (cmdparams.Length < 5)
256 {
257 m_console.OutputFormat("Usage: show object pos <start-coord> to <end-coord>");
258 return;
259 }
260
261 string rawConsoleStartVector = cmdparams[3];
262 Vector3 startVector;
263
264 if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector))
265 {
266 m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector);
267 return;
268 }
269
270 string rawConsoleEndVector = cmdparams[5];
271 Vector3 endVector;
272
273 if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector))
274 {
275 m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector);
276 return;
277 }
278
279 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
280 Action<SceneObjectGroup> searchAction
281 = so => { if (Util.IsInsideBox(so.AbsolutePosition, startVector, endVector)) { sceneObjects.Add(so); }};
282
283 m_scene.ForEachSOG(searchAction);
284
285 StringBuilder sb = new StringBuilder();
286
287 foreach (SceneObjectGroup so in sceneObjects)
288 {
289 AddSceneObjectReport(sb, so);
290 sb.Append("\n");
291 }
292
293 sb.AppendFormat("{0} objects found in {1}\n", sceneObjects.Count, m_scene.Name);
294
295 m_console.OutputFormat(sb.ToString());
296 }
297
231 private void HandleShowPartByUuid(string module, string[] cmd) 298 private void HandleShowPartByUuid(string module, string[] cmd)
232 { 299 {
233 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 300 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))