diff options
author | Justin Clark-Casey (justincc) | 2012-10-18 23:41:18 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-18 23:41:18 +0100 |
commit | 1f3c9db2b9ba71a84438b53b2a8a6f398137deb0 (patch) | |
tree | 4cfc8afe30121d3765eb88170069d708dd55ca90 /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-1f3c9db2b9ba71a84438b53b2a8a6f398137deb0.zip opensim-SC-1f3c9db2b9ba71a84438b53b2a8a6f398137deb0.tar.gz opensim-SC-1f3c9db2b9ba71a84438b53b2a8a6f398137deb0.tar.bz2 opensim-SC-1f3c9db2b9ba71a84438b53b2a8a6f398137deb0.tar.xz |
Add --full option to "show object name/uuid/pos" to show info on all parts of an object, not just whole object summary information.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 80 |
1 files changed, 60 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 5d0163a..7ceac7e 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -139,25 +139,29 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
139 | "Objects", | 139 | "Objects", |
140 | false, | 140 | false, |
141 | "show object uuid", | 141 | "show object uuid", |
142 | "show object uuid <UUID>", | 142 | "show object uuid [--full] <UUID>", |
143 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); | 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.", | ||
145 | HandleShowObjectByUuid); | ||
144 | 146 | ||
145 | m_console.Commands.AddCommand( | 147 | m_console.Commands.AddCommand( |
146 | "Objects", | 148 | "Objects", |
147 | false, | 149 | false, |
148 | "show object name", | 150 | "show object name", |
149 | "show object name [--regex] <name>", | 151 | "show object name [--full] [--regex] <name>", |
150 | "Show details of scene objects with the given name.", | 152 | "Show details of scene objects with the given name.", |
151 | "If --regex is specified then the name is treatead as a regular expression", | 153 | "The --full option will print out information on all the parts of the object.\n" |
154 | + "If --regex is specified then the name is treatead as a regular expression.", | ||
152 | HandleShowObjectByName); | 155 | HandleShowObjectByName); |
153 | 156 | ||
154 | m_console.Commands.AddCommand( | 157 | m_console.Commands.AddCommand( |
155 | "Objects", | 158 | "Objects", |
156 | false, | 159 | false, |
157 | "show object pos", | 160 | "show object pos", |
158 | "show object pos <start-coord> to <end-coord>", | 161 | "show object pos [--full] <start-coord> to <end-coord>", |
159 | "Show details of scene objects within the given area.", | 162 | "Show details of scene objects within the given area.", |
160 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | 163 | "The --full option will print out information on all the parts of the object.\n" |
164 | + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | ||
161 | + "If you don't care about the z component you can simply omit it.\n" | 165 | + "If you don't care about the z component you can simply omit it.\n" |
162 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\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" |
163 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | 167 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" |
@@ -216,7 +220,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
216 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 220 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
217 | } | 221 | } |
218 | 222 | ||
219 | private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate) | 223 | /// <summary> |
224 | /// Outputs the sogs to console. | ||
225 | /// </summary> | ||
226 | /// <param name='searchPredicate'></param> | ||
227 | /// <param name='showFull'>If true then output all part details. If false then output summary.</param> | ||
228 | private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate, bool showFull) | ||
220 | { | 229 | { |
221 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); | 230 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); |
222 | 231 | ||
@@ -224,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
224 | 233 | ||
225 | foreach (SceneObjectGroup so in sceneObjects) | 234 | foreach (SceneObjectGroup so in sceneObjects) |
226 | { | 235 | { |
227 | AddSceneObjectReport(sb, so); | 236 | AddSceneObjectReport(sb, so, showFull); |
228 | sb.Append("\n"); | 237 | sb.Append("\n"); |
229 | } | 238 | } |
230 | 239 | ||
@@ -253,21 +262,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
253 | m_console.OutputFormat(sb.ToString()); | 262 | m_console.OutputFormat(sb.ToString()); |
254 | } | 263 | } |
255 | 264 | ||
256 | private void HandleShowObjectByUuid(string module, string[] cmd) | 265 | private void HandleShowObjectByUuid(string module, string[] cmdparams) |
257 | { | 266 | { |
258 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 267 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
259 | return; | 268 | return; |
260 | 269 | ||
261 | if (cmd.Length < 4) | 270 | bool showFull = false; |
271 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null ); | ||
272 | |||
273 | List<string> mainParams = options.Parse(cmdparams); | ||
274 | |||
275 | if (mainParams.Count < 4) | ||
262 | { | 276 | { |
263 | m_console.OutputFormat("Usage: show object uuid <uuid>"); | 277 | m_console.OutputFormat("Usage: show object uuid <uuid>"); |
264 | return; | 278 | return; |
265 | } | 279 | } |
266 | 280 | ||
267 | UUID objectUuid; | 281 | UUID objectUuid; |
268 | if (!UUID.TryParse(cmd[3], out objectUuid)) | 282 | if (!UUID.TryParse(mainParams[3], out objectUuid)) |
269 | { | 283 | { |
270 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); | 284 | m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]); |
271 | return; | 285 | return; |
272 | } | 286 | } |
273 | 287 | ||
@@ -280,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
280 | } | 294 | } |
281 | 295 | ||
282 | StringBuilder sb = new StringBuilder(); | 296 | StringBuilder sb = new StringBuilder(); |
283 | AddSceneObjectReport(sb, so); | 297 | AddSceneObjectReport(sb, so, showFull); |
284 | 298 | ||
285 | m_console.OutputFormat(sb.ToString()); | 299 | m_console.OutputFormat(sb.ToString()); |
286 | } | 300 | } |
@@ -290,14 +304,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
290 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 304 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
291 | return; | 305 | return; |
292 | 306 | ||
307 | bool showFull = false; | ||
293 | bool useRegex = false; | 308 | bool useRegex = false; |
294 | OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); | 309 | OptionSet options = new OptionSet(); |
310 | options.Add("full", v => showFull = v != null ); | ||
311 | options.Add("regex", v => useRegex = v != null ); | ||
295 | 312 | ||
296 | List<string> mainParams = options.Parse(cmdparams); | 313 | List<string> mainParams = options.Parse(cmdparams); |
297 | 314 | ||
298 | if (mainParams.Count < 4) | 315 | if (mainParams.Count < 4) |
299 | { | 316 | { |
300 | m_console.OutputFormat("Usage: show object name [--regex] <name>"); | 317 | m_console.OutputFormat("Usage: show object name [--full] [--regex] <name>"); |
301 | return; | 318 | return; |
302 | } | 319 | } |
303 | 320 | ||
@@ -315,7 +332,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
315 | searchPredicate = so => so.Name == name; | 332 | searchPredicate = so => so.Name == name; |
316 | } | 333 | } |
317 | 334 | ||
318 | OutputSogsToConsole(searchPredicate); | 335 | OutputSogsToConsole(searchPredicate, showFull); |
319 | } | 336 | } |
320 | 337 | ||
321 | private void HandleShowObjectByPos(string module, string[] cmdparams) | 338 | private void HandleShowObjectByPos(string module, string[] cmdparams) |
@@ -323,9 +340,14 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
323 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 340 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
324 | return; | 341 | return; |
325 | 342 | ||
326 | if (cmdparams.Length < 5) | 343 | bool showFull = false; |
344 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null ); | ||
345 | |||
346 | List<string> mainParams = options.Parse(cmdparams); | ||
347 | |||
348 | if (mainParams.Count < 5) | ||
327 | { | 349 | { |
328 | m_console.OutputFormat("Usage: show object pos <start-coord> to <end-coord>"); | 350 | m_console.OutputFormat("Usage: show object pos [--full] <start-coord> to <end-coord>"); |
329 | return; | 351 | return; |
330 | } | 352 | } |
331 | 353 | ||
@@ -337,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
337 | Predicate<SceneObjectGroup> searchPredicate | 359 | Predicate<SceneObjectGroup> searchPredicate |
338 | = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); | 360 | = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); |
339 | 361 | ||
340 | OutputSogsToConsole(searchPredicate); | 362 | OutputSogsToConsole(searchPredicate, showFull); |
341 | } | 363 | } |
342 | 364 | ||
343 | private void HandleShowPartByUuid(string module, string[] cmd) | 365 | private void HandleShowPartByUuid(string module, string[] cmd) |
@@ -437,7 +459,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
437 | OutputSopsToConsole(searchPredicate); | 459 | OutputSopsToConsole(searchPredicate); |
438 | } | 460 | } |
439 | 461 | ||
440 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) | 462 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull) |
463 | { | ||
464 | if (showFull) | ||
465 | { | ||
466 | foreach (SceneObjectPart sop in so.Parts) | ||
467 | { | ||
468 | AddScenePartReport(sb, sop); | ||
469 | sb.Append("\n"); | ||
470 | } | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | AddSummarySceneObjectReport(sb, so); | ||
475 | } | ||
476 | |||
477 | return sb; | ||
478 | } | ||
479 | |||
480 | private StringBuilder AddSummarySceneObjectReport(StringBuilder sb, SceneObjectGroup so) | ||
441 | { | 481 | { |
442 | sb.AppendFormat("Name: {0}\n", so.Name); | 482 | sb.AppendFormat("Name: {0}\n", so.Name); |
443 | sb.AppendFormat("Description: {0}\n", so.Description); | 483 | sb.AppendFormat("Description: {0}\n", so.Description); |