diff options
author | Justin Clark-Casey (justincc) | 2012-10-05 03:52:42 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-05 03:52:42 +0100 |
commit | 130768b16a35e307389e88d902f6e3a785dfb8ee (patch) | |
tree | 5a6e91997c9b5e4ac48a1b8eafba2ab7be74244d /OpenSim/Region | |
parent | minor: Add missing license information from the top of IUserManagement (diff) | |
download | opensim-SC-130768b16a35e307389e88d902f6e3a785dfb8ee.zip opensim-SC-130768b16a35e307389e88d902f6e3a785dfb8ee.tar.gz opensim-SC-130768b16a35e307389e88d902f6e3a785dfb8ee.tar.bz2 opensim-SC-130768b16a35e307389e88d902f6e3a785dfb8ee.tar.xz |
Add "show object pos <start-coord> to <end-coord>" command to simulator console.
This allows you to display details of all objects in a given bounding box.
Values parts of the co-ord can be left out as appropriate (e.g. to get all objects between the ground and z=30.
See "help show object pos" for more details.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 67 |
1 files changed, 67 insertions, 0 deletions
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)) |