diff options
author | BlueWall | 2012-10-20 05:25:58 -0400 |
---|---|---|
committer | BlueWall | 2012-10-20 05:25:58 -0400 |
commit | 07f1d44174f5e2b4e3d5ffdec3619bb84f357af2 (patch) | |
tree | 83cc0442b2c1b89a5b3dd94cff23d5098415777e /OpenSim/Region/CoreModules/World | |
parent | Merge branch 'master' into connector_plugin (diff) | |
parent | Fix: invinite loading for Viewer3 : parcelinfo request of traffic-value (impl... (diff) | |
download | opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.zip opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.gz opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.bz2 opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.xz |
Merge branch 'master' into connector_plugin
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
3 files changed, 270 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index a6923ef..ea806ec 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -290,7 +290,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
290 | 290 | ||
291 | foreach (DearchiveContext sceneContext in sceneContexts.Values) | 291 | foreach (DearchiveContext sceneContext in sceneContexts.Values) |
292 | { | 292 | { |
293 | m_log.InfoFormat("[ARCHIVER:] Loading region {0}", sceneContext.Scene.RegionInfo.RegionName); | 293 | m_log.InfoFormat("[ARCHIVER]: Loading region {0}", sceneContext.Scene.RegionInfo.RegionName); |
294 | 294 | ||
295 | if (!m_merge) | 295 | if (!m_merge) |
296 | { | 296 | { |
@@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
324 | Util.FireAndForget(delegate(object o) | 324 | Util.FireAndForget(delegate(object o) |
325 | { | 325 | { |
326 | Thread.Sleep(15000); | 326 | Thread.Sleep(15000); |
327 | m_log.Info("Starting scripts in scene objects"); | 327 | m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); |
328 | 328 | ||
329 | foreach (DearchiveContext sceneContext in sceneContexts.Values) | 329 | foreach (DearchiveContext sceneContext in sceneContexts.Values) |
330 | { | 330 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8b7406d..95edf62 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -207,6 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
207 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 207 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
208 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 208 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
209 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | 209 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; |
210 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | ||
210 | 211 | ||
211 | EntityBase presenceEntity; | 212 | EntityBase presenceEntity; |
212 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 213 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
@@ -798,6 +799,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
798 | } | 799 | } |
799 | } | 800 | } |
800 | 801 | ||
802 | private void ClientOnParcelDwellRequest(int localID, IClientAPI client) | ||
803 | { | ||
804 | ILandObject parcel = null; | ||
805 | lock (m_landList) | ||
806 | { | ||
807 | if (!m_landList.TryGetValue(localID, out parcel)) | ||
808 | return; | ||
809 | } | ||
810 | client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell); | ||
811 | } | ||
812 | |||
801 | #endregion | 813 | #endregion |
802 | 814 | ||
803 | #region Parcel Modification | 815 | #region Parcel Modification |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 6e39e9a..87241e1 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
@@ -83,53 +84,87 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
83 | m_console.Commands.AddCommand( | 84 | m_console.Commands.AddCommand( |
84 | "Objects", false, "delete object owner", | 85 | "Objects", false, "delete object owner", |
85 | "delete object owner <UUID>", | 86 | "delete object owner <UUID>", |
86 | "Delete a scene object by owner", HandleDeleteObject); | 87 | "Delete scene objects by owner", |
88 | "Command will ask for confirmation before proceeding.", | ||
89 | HandleDeleteObject); | ||
87 | 90 | ||
88 | m_console.Commands.AddCommand( | 91 | m_console.Commands.AddCommand( |
89 | "Objects", false, "delete object creator", | 92 | "Objects", false, "delete object creator", |
90 | "delete object creator <UUID>", | 93 | "delete object creator <UUID>", |
91 | "Delete a scene object by creator", HandleDeleteObject); | 94 | "Delete scene objects by creator", |
95 | "Command will ask for confirmation before proceeding.", | ||
96 | HandleDeleteObject); | ||
92 | 97 | ||
93 | m_console.Commands.AddCommand( | 98 | m_console.Commands.AddCommand( |
94 | "Objects", false, "delete object uuid", | 99 | "Objects", false, "delete object uuid", |
95 | "delete object uuid <UUID>", | 100 | "delete object uuid <UUID>", |
96 | "Delete a scene object by uuid", HandleDeleteObject); | 101 | "Delete a scene object by uuid", |
102 | HandleDeleteObject); | ||
97 | 103 | ||
98 | m_console.Commands.AddCommand( | 104 | m_console.Commands.AddCommand( |
99 | "Objects", false, "delete object name", | 105 | "Objects", false, "delete object name", |
100 | "delete object name [--regex] <name>", | 106 | "delete object name [--regex] <name>", |
101 | "Delete a scene object by name.", | 107 | "Delete a scene object by name.", |
102 | "If --regex is specified then the name is treatead as a regular expression", | 108 | "Command will ask for confirmation before proceeding.\n" |
109 | + "If --regex is specified then the name is treatead as a regular expression", | ||
103 | HandleDeleteObject); | 110 | HandleDeleteObject); |
104 | 111 | ||
105 | m_console.Commands.AddCommand( | 112 | m_console.Commands.AddCommand( |
106 | "Objects", false, "delete object outside", | 113 | "Objects", false, "delete object outside", |
107 | "delete object outside", | 114 | "delete object outside", |
108 | "Delete all scene objects outside region boundaries", HandleDeleteObject); | 115 | "Delete all scene objects outside region boundaries", |
116 | "Command will ask for confirmation before proceeding.", | ||
117 | HandleDeleteObject); | ||
118 | |||
119 | m_console.Commands.AddCommand( | ||
120 | "Objects", | ||
121 | false, | ||
122 | "delete object pos", | ||
123 | "delete object pos <start-coord> to <end-coord>", | ||
124 | "Delete scene objects within the given area.", | ||
125 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | ||
126 | + "If you don't care about the z component you can simply omit it.\n" | ||
127 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
128 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
129 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
130 | + "e.g.\n" | ||
131 | + "delete object pos 20,20,20 to 40,40,40\n" | ||
132 | + "delete object pos 20,20 to 40,40\n" | ||
133 | + "delete object pos ,20,20 to ,40,40\n" | ||
134 | + "delete object pos ,,30 to ,,~\n" | ||
135 | + "delete object pos ,,-~ to ,,30", | ||
136 | HandleDeleteObject); | ||
109 | 137 | ||
110 | m_console.Commands.AddCommand( | 138 | m_console.Commands.AddCommand( |
111 | "Objects", | 139 | "Objects", |
112 | false, | 140 | false, |
113 | "show object uuid", | 141 | "show object uuid", |
114 | "show object uuid <UUID>", | 142 | "show object uuid [--full] <UUID>", |
115 | "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.\n" | ||
145 | + "For yet more detailed part information, use the \"show part\" commands.", | ||
146 | HandleShowObjectByUuid); | ||
116 | 147 | ||
117 | m_console.Commands.AddCommand( | 148 | m_console.Commands.AddCommand( |
118 | "Objects", | 149 | "Objects", |
119 | false, | 150 | false, |
120 | "show object name", | 151 | "show object name", |
121 | "show object name [--regex] <name>", | 152 | "show object name [--full] [--regex] <name>", |
122 | "Show details of scene objects with the given name.", | 153 | "Show details of scene objects with the given name.", |
123 | "If --regex is specified then the name is treatead as a regular expression", | 154 | "The --full option will print out information on all the parts of the object.\n" |
155 | + "For yet more detailed part information, use the \"show part\" commands.\n" | ||
156 | + "If --regex is specified then the name is treatead as a regular expression.", | ||
124 | HandleShowObjectByName); | 157 | HandleShowObjectByName); |
125 | 158 | ||
126 | m_console.Commands.AddCommand( | 159 | m_console.Commands.AddCommand( |
127 | "Objects", | 160 | "Objects", |
128 | false, | 161 | false, |
129 | "show object pos", | 162 | "show object pos", |
130 | "show object pos <start-coord> to <end-coord>", | 163 | "show object pos [--full] <start-coord> to <end-coord>", |
131 | "Show details of scene objects within the given area.", | 164 | "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" | 165 | "The --full option will print out information on all the parts of the object.\n" |
166 | + "For yet more detailed part information, use the \"show part\" commands.\n" | ||
167 | + "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" | 168 | + "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" | 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" |
135 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | 170 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" |
@@ -188,7 +223,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
188 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 223 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
189 | } | 224 | } |
190 | 225 | ||
191 | private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate) | 226 | /// <summary> |
227 | /// Outputs the sogs to console. | ||
228 | /// </summary> | ||
229 | /// <param name='searchPredicate'></param> | ||
230 | /// <param name='showFull'>If true then output all part details. If false then output summary.</param> | ||
231 | private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate, bool showFull) | ||
192 | { | 232 | { |
193 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); | 233 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); |
194 | 234 | ||
@@ -196,7 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
196 | 236 | ||
197 | foreach (SceneObjectGroup so in sceneObjects) | 237 | foreach (SceneObjectGroup so in sceneObjects) |
198 | { | 238 | { |
199 | AddSceneObjectReport(sb, so); | 239 | AddSceneObjectReport(sb, so, showFull); |
200 | sb.Append("\n"); | 240 | sb.Append("\n"); |
201 | } | 241 | } |
202 | 242 | ||
@@ -205,7 +245,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
205 | m_console.OutputFormat(sb.ToString()); | 245 | m_console.OutputFormat(sb.ToString()); |
206 | } | 246 | } |
207 | 247 | ||
208 | private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate) | 248 | private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate, bool showFull) |
209 | { | 249 | { |
210 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups(); | 250 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups(); |
211 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | 251 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); |
@@ -216,7 +256,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
216 | 256 | ||
217 | foreach (SceneObjectPart part in parts) | 257 | foreach (SceneObjectPart part in parts) |
218 | { | 258 | { |
219 | AddScenePartReport(sb, part); | 259 | AddScenePartReport(sb, part, showFull); |
220 | sb.Append("\n"); | 260 | sb.Append("\n"); |
221 | } | 261 | } |
222 | 262 | ||
@@ -225,21 +265,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
225 | m_console.OutputFormat(sb.ToString()); | 265 | m_console.OutputFormat(sb.ToString()); |
226 | } | 266 | } |
227 | 267 | ||
228 | private void HandleShowObjectByUuid(string module, string[] cmd) | 268 | private void HandleShowObjectByUuid(string module, string[] cmdparams) |
229 | { | 269 | { |
230 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 270 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
231 | return; | 271 | return; |
232 | 272 | ||
233 | if (cmd.Length < 4) | 273 | bool showFull = false; |
274 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null ); | ||
275 | |||
276 | List<string> mainParams = options.Parse(cmdparams); | ||
277 | |||
278 | if (mainParams.Count < 4) | ||
234 | { | 279 | { |
235 | m_console.OutputFormat("Usage: show object uuid <uuid>"); | 280 | m_console.OutputFormat("Usage: show object uuid <uuid>"); |
236 | return; | 281 | return; |
237 | } | 282 | } |
238 | 283 | ||
239 | UUID objectUuid; | 284 | UUID objectUuid; |
240 | if (!UUID.TryParse(cmd[3], out objectUuid)) | 285 | if (!UUID.TryParse(mainParams[3], out objectUuid)) |
241 | { | 286 | { |
242 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); | 287 | m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]); |
243 | return; | 288 | return; |
244 | } | 289 | } |
245 | 290 | ||
@@ -252,7 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
252 | } | 297 | } |
253 | 298 | ||
254 | StringBuilder sb = new StringBuilder(); | 299 | StringBuilder sb = new StringBuilder(); |
255 | AddSceneObjectReport(sb, so); | 300 | AddSceneObjectReport(sb, so, showFull); |
256 | 301 | ||
257 | m_console.OutputFormat(sb.ToString()); | 302 | m_console.OutputFormat(sb.ToString()); |
258 | } | 303 | } |
@@ -262,14 +307,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
262 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 307 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
263 | return; | 308 | return; |
264 | 309 | ||
310 | bool showFull = false; | ||
265 | bool useRegex = false; | 311 | bool useRegex = false; |
266 | OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); | 312 | OptionSet options = new OptionSet(); |
313 | options.Add("full", v => showFull = v != null ); | ||
314 | options.Add("regex", v => useRegex = v != null ); | ||
267 | 315 | ||
268 | List<string> mainParams = options.Parse(cmdparams); | 316 | List<string> mainParams = options.Parse(cmdparams); |
269 | 317 | ||
270 | if (mainParams.Count < 4) | 318 | if (mainParams.Count < 4) |
271 | { | 319 | { |
272 | m_console.OutputFormat("Usage: show object name [--regex] <name>"); | 320 | m_console.OutputFormat("Usage: show object name [--full] [--regex] <name>"); |
273 | return; | 321 | return; |
274 | } | 322 | } |
275 | 323 | ||
@@ -287,7 +335,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
287 | searchPredicate = so => so.Name == name; | 335 | searchPredicate = so => so.Name == name; |
288 | } | 336 | } |
289 | 337 | ||
290 | OutputSogsToConsole(searchPredicate); | 338 | OutputSogsToConsole(searchPredicate, showFull); |
291 | } | 339 | } |
292 | 340 | ||
293 | private void HandleShowObjectByPos(string module, string[] cmdparams) | 341 | private void HandleShowObjectByPos(string module, string[] cmdparams) |
@@ -295,51 +343,49 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
295 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 343 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
296 | return; | 344 | return; |
297 | 345 | ||
298 | if (cmdparams.Length < 5) | 346 | bool showFull = false; |
299 | { | 347 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null ); |
300 | m_console.OutputFormat("Usage: show object pos <start-coord> to <end-coord>"); | ||
301 | return; | ||
302 | } | ||
303 | 348 | ||
304 | string rawConsoleStartVector = cmdparams[3]; | 349 | List<string> mainParams = options.Parse(cmdparams); |
305 | Vector3 startVector; | ||
306 | 350 | ||
307 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) | 351 | if (mainParams.Count < 5) |
308 | { | 352 | { |
309 | m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector); | 353 | m_console.OutputFormat("Usage: show object pos [--full] <start-coord> to <end-coord>"); |
310 | return; | 354 | return; |
311 | } | 355 | } |
312 | 356 | ||
313 | string rawConsoleEndVector = cmdparams[5]; | 357 | Vector3 startVector, endVector; |
314 | Vector3 endVector; | ||
315 | 358 | ||
316 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | 359 | if (!TryParseVectorRange(cmdparams.Skip(3).Take(3), out startVector, out endVector)) |
317 | { | ||
318 | m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector); | ||
319 | return; | 360 | return; |
320 | } | ||
321 | 361 | ||
322 | Predicate<SceneObjectGroup> searchPredicate | 362 | Predicate<SceneObjectGroup> searchPredicate |
323 | = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); | 363 | = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); |
324 | 364 | ||
325 | OutputSogsToConsole(searchPredicate); | 365 | OutputSogsToConsole(searchPredicate, showFull); |
326 | } | 366 | } |
327 | 367 | ||
328 | private void HandleShowPartByUuid(string module, string[] cmd) | 368 | private void HandleShowPartByUuid(string module, string[] cmdparams) |
329 | { | 369 | { |
330 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 370 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
331 | return; | 371 | return; |
332 | 372 | ||
333 | if (cmd.Length < 4) | 373 | // bool showFull = false; |
374 | OptionSet options = new OptionSet(); | ||
375 | // options.Add("full", v => showFull = v != null ); | ||
376 | |||
377 | List<string> mainParams = options.Parse(cmdparams); | ||
378 | |||
379 | if (mainParams.Count < 4) | ||
334 | { | 380 | { |
335 | m_console.OutputFormat("Usage: show part uuid <uuid>"); | 381 | m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); |
336 | return; | 382 | return; |
337 | } | 383 | } |
338 | 384 | ||
339 | UUID objectUuid; | 385 | UUID objectUuid; |
340 | if (!UUID.TryParse(cmd[3], out objectUuid)) | 386 | if (!UUID.TryParse(mainParams[3], out objectUuid)) |
341 | { | 387 | { |
342 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); | 388 | m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]); |
343 | return; | 389 | return; |
344 | } | 390 | } |
345 | 391 | ||
@@ -352,7 +398,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
352 | } | 398 | } |
353 | 399 | ||
354 | StringBuilder sb = new StringBuilder(); | 400 | StringBuilder sb = new StringBuilder(); |
355 | AddScenePartReport(sb, sop); | 401 | AddScenePartReport(sb, sop, true); |
356 | 402 | ||
357 | m_console.OutputFormat(sb.ToString()); | 403 | m_console.OutputFormat(sb.ToString()); |
358 | } | 404 | } |
@@ -362,13 +408,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
362 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 408 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
363 | return; | 409 | return; |
364 | 410 | ||
365 | if (cmdparams.Length < 5) | 411 | // bool showFull = false; |
412 | OptionSet options = new OptionSet(); | ||
413 | // options.Add("full", v => showFull = v != null ); | ||
414 | |||
415 | List<string> mainParams = options.Parse(cmdparams); | ||
416 | |||
417 | if (mainParams.Count < 5) | ||
366 | { | 418 | { |
367 | m_console.OutputFormat("Usage: show part pos <start-coord> to <end-coord>"); | 419 | m_console.OutputFormat("Usage: show part pos [--full] <start-coord> to <end-coord>"); |
368 | return; | 420 | return; |
369 | } | 421 | } |
370 | 422 | ||
371 | string rawConsoleStartVector = cmdparams[3]; | 423 | string rawConsoleStartVector = mainParams[3]; |
372 | Vector3 startVector; | 424 | Vector3 startVector; |
373 | 425 | ||
374 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) | 426 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) |
@@ -377,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
377 | return; | 429 | return; |
378 | } | 430 | } |
379 | 431 | ||
380 | string rawConsoleEndVector = cmdparams[5]; | 432 | string rawConsoleEndVector = mainParams[5]; |
381 | Vector3 endVector; | 433 | Vector3 endVector; |
382 | 434 | ||
383 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | 435 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) |
@@ -386,7 +438,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
386 | return; | 438 | return; |
387 | } | 439 | } |
388 | 440 | ||
389 | OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector)); | 441 | OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector), true); |
390 | } | 442 | } |
391 | 443 | ||
392 | private void HandleShowPartByName(string module, string[] cmdparams) | 444 | private void HandleShowPartByName(string module, string[] cmdparams) |
@@ -394,14 +446,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
394 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 446 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
395 | return; | 447 | return; |
396 | 448 | ||
449 | // bool showFull = false; | ||
397 | bool useRegex = false; | 450 | bool useRegex = false; |
398 | OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); | 451 | OptionSet options = new OptionSet(); |
452 | // options.Add("full", v => showFull = v != null ); | ||
453 | options.Add("regex", v => useRegex = v != null ); | ||
399 | 454 | ||
400 | List<string> mainParams = options.Parse(cmdparams); | 455 | List<string> mainParams = options.Parse(cmdparams); |
401 | 456 | ||
402 | if (mainParams.Count < 4) | 457 | if (mainParams.Count < 4) |
403 | { | 458 | { |
404 | m_console.OutputFormat("Usage: show part name [--regex] <name>"); | 459 | m_console.OutputFormat("Usage: show part name [--full] [--regex] <name>"); |
405 | return; | 460 | return; |
406 | } | 461 | } |
407 | 462 | ||
@@ -419,31 +474,112 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
419 | searchPredicate = sop => sop.Name == name; | 474 | searchPredicate = sop => sop.Name == name; |
420 | } | 475 | } |
421 | 476 | ||
422 | OutputSopsToConsole(searchPredicate); | 477 | OutputSopsToConsole(searchPredicate, true); |
423 | } | 478 | } |
424 | 479 | ||
425 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) | 480 | /// <summary> |
481 | /// Append a scene object report to an input StringBuilder | ||
482 | /// </summary> | ||
483 | /// <returns></returns> | ||
484 | /// <param name='sb'></param> | ||
485 | /// <param name='so'</param> | ||
486 | /// <param name='showFull'> | ||
487 | /// If true then information on all parts of an object is appended. | ||
488 | /// If false then only summary information about an object is appended. | ||
489 | /// </param> | ||
490 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull) | ||
426 | { | 491 | { |
427 | sb.AppendFormat("Name: {0}\n", so.Name); | 492 | if (showFull) |
428 | sb.AppendFormat("Description: {0}\n", so.Description); | 493 | { |
429 | sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); | 494 | foreach (SceneObjectPart sop in so.Parts) |
430 | sb.AppendFormat("Parts: {0}\n", so.PrimCount); | 495 | { |
431 | sb.AppendFormat("Flags: {0}\n", so.RootPart.Flags); | 496 | AddScenePartReport(sb, sop, false); |
497 | sb.Append("\n"); | ||
498 | } | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | AddSummarySceneObjectReport(sb, so); | ||
503 | } | ||
432 | 504 | ||
433 | return sb; | 505 | return sb; |
434 | } | 506 | } |
435 | 507 | ||
436 | private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) | 508 | private StringBuilder AddSummarySceneObjectReport(StringBuilder sb, SceneObjectGroup so) |
437 | { | 509 | { |
438 | sb.AppendFormat("Name: {0}\n", sop.Name); | 510 | ConsoleDisplayList cdl = new ConsoleDisplayList(); |
439 | sb.AppendFormat("Description: {0}\n", sop.Description); | 511 | cdl.AddRow("Name", so.Name); |
440 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); | 512 | cdl.AddRow("Descrition", so.Description); |
441 | sb.AppendFormat("Parent: {0}", | 513 | cdl.AddRow("Local ID", so.LocalId); |
442 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | 514 | cdl.AddRow("UUID", so.UUID); |
443 | sb.AppendFormat("Link number: {0}\n", sop.LinkNum); | 515 | cdl.AddRow("Location", string.Format("{0} @ {1}", so.AbsolutePosition, so.Scene.Name)); |
444 | sb.AppendFormat("Flags: {0}\n", sop.Flags); | 516 | cdl.AddRow("Parts", so.PrimCount); |
517 | cdl.AddRow("Flags", so.RootPart.Flags); | ||
518 | |||
519 | return sb.Append(cdl.ToString()); | ||
520 | } | ||
445 | 521 | ||
446 | return sb; | 522 | /// <summary> |
523 | /// Append a scene object part report to an input StringBuilder | ||
524 | /// </summary> | ||
525 | /// <returns></returns> | ||
526 | /// <param name='sb'></param> | ||
527 | /// <param name='sop'</param> | ||
528 | /// <param name='showFull'> | ||
529 | /// If true then information on each inventory item will be shown. | ||
530 | /// If false then only summary inventory information is shown. | ||
531 | /// </param> | ||
532 | private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop, bool showFull) | ||
533 | { | ||
534 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
535 | cdl.AddRow("Name", sop.Name); | ||
536 | cdl.AddRow("Description", sop.Description); | ||
537 | cdl.AddRow("Local ID", sop.LocalId); | ||
538 | cdl.AddRow("UUID", sop.UUID); | ||
539 | cdl.AddRow("Location", string.Format("{0} @ {1}", sop.AbsolutePosition, sop.ParentGroup.Scene.Name)); | ||
540 | cdl.AddRow( | ||
541 | "Parent", | ||
542 | sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | ||
543 | cdl.AddRow("Link number", sop.LinkNum); | ||
544 | cdl.AddRow("Flags", sop.Flags); | ||
545 | |||
546 | object itemsOutput; | ||
547 | if (showFull) | ||
548 | { | ||
549 | StringBuilder itemsSb = new StringBuilder("\n"); | ||
550 | itemsOutput = AddScenePartItemsReport(itemsSb, sop.Inventory).ToString(); | ||
551 | } | ||
552 | else | ||
553 | { | ||
554 | itemsOutput = sop.Inventory.Count; | ||
555 | } | ||
556 | |||
557 | |||
558 | cdl.AddRow("Items", itemsOutput); | ||
559 | |||
560 | return sb.Append(cdl.ToString()); | ||
561 | } | ||
562 | |||
563 | private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv) | ||
564 | { | ||
565 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
566 | cdt.Indent = 2; | ||
567 | |||
568 | cdt.AddColumn("Name", 50); | ||
569 | cdt.AddColumn("Type", 12); | ||
570 | cdt.AddColumn("Running", 7); | ||
571 | cdt.AddColumn("Item UUID", 36); | ||
572 | cdt.AddColumn("Asset UUID", 36); | ||
573 | |||
574 | foreach (TaskInventoryItem item in inv.GetInventoryItems()) | ||
575 | cdt.AddRow( | ||
576 | item.Name, | ||
577 | ((InventoryType)item.InvType).ToString(), | ||
578 | (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a", | ||
579 | item.ItemID.ToString(), | ||
580 | item.AssetID.ToString()); | ||
581 | |||
582 | return sb.Append(cdt.ToString()); | ||
447 | } | 583 | } |
448 | 584 | ||
449 | private void HandleDeleteObject(string module, string[] cmd) | 585 | private void HandleDeleteObject(string module, string[] cmd) |
@@ -557,6 +693,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
557 | 693 | ||
558 | break; | 694 | break; |
559 | 695 | ||
696 | case "pos": | ||
697 | deletes = GetDeleteCandidatesByPos(module, cmd); | ||
698 | break; | ||
699 | |||
560 | default: | 700 | default: |
561 | m_console.OutputFormat("Unrecognized mode {0}", mode); | 701 | m_console.OutputFormat("Unrecognized mode {0}", mode); |
562 | return; | 702 | return; |
@@ -571,7 +711,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
571 | string.Format( | 711 | string.Format( |
572 | "Are you sure that you want to delete {0} objects from {1}", | 712 | "Are you sure that you want to delete {0} objects from {1}", |
573 | deletes.Count, m_scene.RegionInfo.RegionName), | 713 | deletes.Count, m_scene.RegionInfo.RegionName), |
574 | "n"); | 714 | "y/N"); |
575 | 715 | ||
576 | if (response.ToLower() != "y") | 716 | if (response.ToLower() != "y") |
577 | { | 717 | { |
@@ -593,9 +733,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
593 | 733 | ||
594 | private List<SceneObjectGroup> GetDeleteCandidatesByName(string module, string[] cmdparams) | 734 | private List<SceneObjectGroup> GetDeleteCandidatesByName(string module, string[] cmdparams) |
595 | { | 735 | { |
596 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
597 | return null; | ||
598 | |||
599 | bool useRegex = false; | 736 | bool useRegex = false; |
600 | OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); | 737 | OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null ); |
601 | 738 | ||
@@ -629,5 +766,52 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
629 | 766 | ||
630 | return sceneObjects; | 767 | return sceneObjects; |
631 | } | 768 | } |
769 | |||
770 | /// <summary> | ||
771 | /// Get scene object delete candidates by position | ||
772 | /// </summary> | ||
773 | /// <param name='module'></param> | ||
774 | /// <param name='cmdparams'></param> | ||
775 | /// <returns>null if parsing failed on one of the arguments, otherwise a list of objects to delete. If there | ||
776 | /// are no objects to delete then the list will be empty./returns> | ||
777 | private List<SceneObjectGroup> GetDeleteCandidatesByPos(string module, string[] cmdparams) | ||
778 | { | ||
779 | if (cmdparams.Length < 5) | ||
780 | { | ||
781 | m_console.OutputFormat("Usage: delete object pos <start-coord> to <end-coord>"); | ||
782 | return null; | ||
783 | } | ||
784 | |||
785 | Vector3 startVector, endVector; | ||
786 | |||
787 | if (!TryParseVectorRange(cmdparams.Skip(3).Take(3), out startVector, out endVector)) | ||
788 | return null; | ||
789 | |||
790 | return m_scene.GetSceneObjectGroups().FindAll( | ||
791 | so => !so.IsAttachment && Util.IsInsideBox(so.AbsolutePosition, startVector, endVector)); | ||
792 | } | ||
793 | |||
794 | private bool TryParseVectorRange(IEnumerable<string> rawComponents, out Vector3 startVector, out Vector3 endVector) | ||
795 | { | ||
796 | string rawConsoleStartVector = rawComponents.Take(1).Single(); | ||
797 | |||
798 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) | ||
799 | { | ||
800 | m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector); | ||
801 | endVector = Vector3.Zero; | ||
802 | |||
803 | return false; | ||
804 | } | ||
805 | |||
806 | string rawConsoleEndVector = rawComponents.Skip(1).Take(1).Single(); | ||
807 | |||
808 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | ||
809 | { | ||
810 | m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector); | ||
811 | return false; | ||
812 | } | ||
813 | |||
814 | return true; | ||
815 | } | ||
632 | } | 816 | } |
633 | } \ No newline at end of file | 817 | } \ No newline at end of file |