aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs65
1 files changed, 25 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 0c9295b..6e39e9a 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -205,6 +205,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
205 m_console.OutputFormat(sb.ToString()); 205 m_console.OutputFormat(sb.ToString());
206 } 206 }
207 207
208 private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate)
209 {
210 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
211 List<SceneObjectPart> parts = new List<SceneObjectPart>();
212
213 sceneObjects.ForEach(so => parts.AddRange(Array.FindAll<SceneObjectPart>(so.Parts, searchPredicate)));
214
215 StringBuilder sb = new StringBuilder();
216
217 foreach (SceneObjectPart part in parts)
218 {
219 AddScenePartReport(sb, part);
220 sb.Append("\n");
221 }
222
223 sb.AppendFormat("{0} parts found in {1}\n", parts.Count, m_scene.Name);
224
225 m_console.OutputFormat(sb.ToString());
226 }
227
208 private void HandleShowObjectByUuid(string module, string[] cmd) 228 private void HandleShowObjectByUuid(string module, string[] cmd)
209 { 229 {
210 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 230 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
@@ -366,28 +386,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
366 return; 386 return;
367 } 387 }
368 388
369 Predicate<SceneObjectGroup> searchPredicate 389 OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector));
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 } 390 }
392 391
393 private void HandleShowPartByName(string module, string[] cmdparams) 392 private void HandleShowPartByName(string module, string[] cmdparams)
@@ -408,33 +407,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
408 407
409 string name = mainParams[3]; 408 string name = mainParams[3];
410 409
411 List<SceneObjectPart> parts = new List<SceneObjectPart>(); 410 Predicate<SceneObjectPart> searchPredicate;
412
413 Action<SceneObjectGroup> searchAction;
414 411
415 if (useRegex) 412 if (useRegex)
416 { 413 {
417 Regex nameRegex = new Regex(name); 414 Regex nameRegex = new Regex(name);
418 searchAction = so => so.ForEachPart(sop => { if (nameRegex.IsMatch(sop.Name)) { parts.Add(sop); } }); 415 searchPredicate = sop => nameRegex.IsMatch(sop.Name);
419 } 416 }
420 else 417 else
421 { 418 {
422 searchAction = so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } }); 419 searchPredicate = sop => sop.Name == name;
423 } 420 }
424 421
425 m_scene.ForEachSOG(searchAction); 422 OutputSopsToConsole(searchPredicate);
426
427 StringBuilder sb = new StringBuilder();
428
429 foreach (SceneObjectPart part in parts)
430 {
431 AddScenePartReport(sb, part);
432 sb.Append("\n");
433 }
434
435 sb.AppendFormat("{0} parts found in {1}\n", parts.Count, m_scene.Name);
436
437 m_console.OutputFormat(sb.ToString());
438 } 423 }
439 424
440 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) 425 private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so)