diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/World/Objects/Commands | |
parent | Add a build script. (diff) | |
download | opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Objects/Commands')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 120 |
1 files changed, 79 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index e77f0aa..3d786dd 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -53,30 +53,30 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")] | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")] |
54 | public class ObjectCommandsModule : INonSharedRegionModule | 54 | public class ObjectCommandsModule : INonSharedRegionModule |
55 | { | 55 | { |
56 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 57 | ||
58 | private Scene m_scene; | 58 | private Scene m_scene; |
59 | private ICommandConsole m_console; | 59 | private ICommandConsole m_console; |
60 | 60 | ||
61 | public string Name { get { return "Object Commands Module"; } } | 61 | public string Name { get { return "Object Commands Module"; } } |
62 | 62 | ||
63 | public Type ReplaceableInterface { get { return null; } } | 63 | public Type ReplaceableInterface { get { return null; } } |
64 | 64 | ||
65 | public void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
66 | { | 66 | { |
67 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE"); | 67 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE"); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void PostInitialise() | 70 | public void PostInitialise() |
71 | { | 71 | { |
72 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE"); | 72 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE"); |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Close() | 75 | public void Close() |
76 | { | 76 | { |
77 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE"); | 77 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE"); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void AddRegion(Scene scene) | 80 | public void AddRegion(Scene scene) |
81 | { | 81 | { |
82 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 82 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
@@ -123,8 +123,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
123 | "Objects", | 123 | "Objects", |
124 | false, | 124 | false, |
125 | "delete object pos", | 125 | "delete object pos", |
126 | "delete object pos <start-coord> to <end-coord>", | 126 | "delete object pos <start x, start y , start z> <end x, end y, end z>", |
127 | "Delete scene objects within the given area.", | 127 | "Delete scene objects within the given volume.", |
128 | ConsoleUtil.CoordHelp, | 128 | ConsoleUtil.CoordHelp, |
129 | HandleDeleteObject); | 129 | HandleDeleteObject); |
130 | 130 | ||
@@ -152,9 +152,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
152 | m_console.Commands.AddCommand( | 152 | m_console.Commands.AddCommand( |
153 | "Objects", | 153 | "Objects", |
154 | false, | 154 | false, |
155 | "show object owner", | ||
156 | "show object owner [--full] <OwnerID>", | ||
157 | "Show details of scene objects with given owner.", | ||
158 | "The --full option will print out information on all the parts of the object.\n", | ||
159 | HandleShowObjectByOwnerID); | ||
160 | |||
161 | m_console.Commands.AddCommand( | ||
162 | "Objects", | ||
163 | false, | ||
155 | "show object pos", | 164 | "show object pos", |
156 | "show object pos [--full] <start-coord> to <end-coord>", | 165 | "show object pos [--full] <start x, start y , start z> <end x, end y, end z>", |
157 | "Show details of scene objects within the given area.", | 166 | "Show details of scene objects within give volume", |
158 | "The --full option will print out information on all the parts of the object.\n" | 167 | "The --full option will print out information on all the parts of the object.\n" |
159 | + "For yet more detailed part information, use the \"show part\" commands.\n" | 168 | + "For yet more detailed part information, use the \"show part\" commands.\n" |
160 | + ConsoleUtil.CoordHelp, | 169 | + ConsoleUtil.CoordHelp, |
@@ -180,8 +189,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
180 | "Objects", | 189 | "Objects", |
181 | false, | 190 | false, |
182 | "show part pos", | 191 | "show part pos", |
183 | "show part pos <start-coord> to <end-coord>", | 192 | "show part pos <start x, start y , start z> <end x, end y, end z>", |
184 | "Show details of scene object parts within the given area.", | 193 | "Show details of scene object parts within the given volume.", |
185 | ConsoleUtil.CoordHelp, | 194 | ConsoleUtil.CoordHelp, |
186 | HandleShowPartByPos); | 195 | HandleShowPartByPos); |
187 | 196 | ||
@@ -325,6 +334,32 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
325 | OutputSogsToConsole(searchPredicate, showFull); | 334 | OutputSogsToConsole(searchPredicate, showFull); |
326 | } | 335 | } |
327 | 336 | ||
337 | private void HandleShowObjectByOwnerID(string module, string[] cmdparams) | ||
338 | { | ||
339 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
340 | return; | ||
341 | |||
342 | bool showFull = false; | ||
343 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null); | ||
344 | |||
345 | List<string> mainParams = options.Parse(cmdparams); | ||
346 | |||
347 | if (mainParams.Count < 4) | ||
348 | { | ||
349 | m_console.OutputFormat("Usage: show object owner <OwnerID>"); | ||
350 | return; | ||
351 | } | ||
352 | |||
353 | UUID ownerID; | ||
354 | if (!ConsoleUtil.TryParseConsoleUuid(m_console, mainParams[3], out ownerID)) | ||
355 | return; | ||
356 | |||
357 | Predicate<SceneObjectGroup> searchPredicate | ||
358 | = so => so.OwnerID == ownerID && !so.IsAttachment; | ||
359 | |||
360 | OutputSogsToConsole(searchPredicate, showFull); | ||
361 | } | ||
362 | |||
328 | private void HandleShowObjectByPos(string module, string[] cmdparams) | 363 | private void HandleShowObjectByPos(string module, string[] cmdparams) |
329 | { | 364 | { |
330 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 365 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
@@ -504,13 +539,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
504 | 539 | ||
505 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) | 540 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) |
506 | return; | 541 | return; |
507 | 542 | ||
508 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) | 543 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) |
509 | { | 544 | { |
510 | xtw.Formatting = Formatting.Indented; | 545 | xtw.Formatting = Formatting.Indented; |
511 | SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true); | 546 | SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true); |
512 | } | 547 | } |
513 | 548 | ||
514 | m_console.OutputFormat("Object dumped to file {0}", fileName); | 549 | m_console.OutputFormat("Object dumped to file {0}", fileName); |
515 | } | 550 | } |
516 | 551 | ||
@@ -590,7 +625,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
590 | cdl.AddRow("FlexiSoftness", s.FlexiSoftness); | 625 | cdl.AddRow("FlexiSoftness", s.FlexiSoftness); |
591 | cdl.AddRow("HollowShape", s.HollowShape); | 626 | cdl.AddRow("HollowShape", s.HollowShape); |
592 | cdl.AddRow( | 627 | cdl.AddRow( |
593 | "LightColor", | 628 | "LightColor", |
594 | string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA)); | 629 | string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA)); |
595 | cdl.AddRow("LightCutoff", s.LightCutoff); | 630 | cdl.AddRow("LightCutoff", s.LightCutoff); |
596 | cdl.AddRow("LightEntry", s.LightEntry); | 631 | cdl.AddRow("LightEntry", s.LightEntry); |
@@ -624,7 +659,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
624 | cdl.AddRow("Rotation (World)", sop.GetWorldRotation()); | 659 | cdl.AddRow("Rotation (World)", sop.GetWorldRotation()); |
625 | cdl.AddRow("Scale", s.Scale); | 660 | cdl.AddRow("Scale", s.Scale); |
626 | cdl.AddRow( | 661 | cdl.AddRow( |
627 | "SculptData", | 662 | "SculptData", |
628 | string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a")); | 663 | string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a")); |
629 | cdl.AddRow("SculptEntry", s.SculptEntry); | 664 | cdl.AddRow("SculptEntry", s.SculptEntry); |
630 | cdl.AddRow("SculptTexture", s.SculptTexture); | 665 | cdl.AddRow("SculptTexture", s.SculptTexture); |
@@ -633,7 +668,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
633 | 668 | ||
634 | // TODO, need to display more information about textures but in a compact format | 669 | // TODO, need to display more information about textures but in a compact format |
635 | // to stop output becoming huge. | 670 | // to stop output becoming huge. |
636 | for (int i = 0; i < sop.GetNumberOfSides(); i++) | 671 | for (int i = 0; i < sop.GetNumberOfSides(); i++) |
637 | { | 672 | { |
638 | Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i]; | 673 | Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i]; |
639 | 674 | ||
@@ -730,12 +765,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
730 | if (g.OwnerID == match && !g.IsAttachment) | 765 | if (g.OwnerID == match && !g.IsAttachment) |
731 | deletes.Add(g); | 766 | deletes.Add(g); |
732 | }); | 767 | }); |
733 | 768 | ||
734 | // if (deletes.Count == 0) | 769 | // if (deletes.Count == 0) |
735 | // m_console.OutputFormat("No objects were found with owner {0}", match); | 770 | // m_console.OutputFormat("No objects were found with owner {0}", match); |
736 | 771 | ||
737 | break; | 772 | break; |
738 | 773 | ||
739 | case "creator": | 774 | case "creator": |
740 | if (!UUID.TryParse(o, out match)) | 775 | if (!UUID.TryParse(o, out match)) |
741 | return; | 776 | return; |
@@ -747,12 +782,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
747 | if (g.RootPart.CreatorID == match && !g.IsAttachment) | 782 | if (g.RootPart.CreatorID == match && !g.IsAttachment) |
748 | deletes.Add(g); | 783 | deletes.Add(g); |
749 | }); | 784 | }); |
750 | 785 | ||
751 | // if (deletes.Count == 0) | 786 | // if (deletes.Count == 0) |
752 | // m_console.OutputFormat("No objects were found with creator {0}", match); | 787 | // m_console.OutputFormat("No objects were found with creator {0}", match); |
753 | 788 | ||
754 | break; | 789 | break; |
755 | 790 | ||
756 | case "id": | 791 | case "id": |
757 | UUID uuid; | 792 | UUID uuid; |
758 | uint localId; | 793 | uint localId; |
@@ -768,18 +803,21 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
768 | else | 803 | else |
769 | so = m_scene.GetSceneObjectGroup(localId); | 804 | so = m_scene.GetSceneObjectGroup(localId); |
770 | 805 | ||
771 | if (!so.IsAttachment) | 806 | if (so!= null) |
772 | deletes.Add(so); | 807 | { |
773 | 808 | deletes.Add(so); | |
774 | // if (deletes.Count == 0) | 809 | if(so.IsAttachment) |
775 | // m_console.OutputFormat("No objects were found with uuid {0}", match); | 810 | { |
776 | 811 | requireConfirmation = true; | |
812 | m_console.OutputFormat("Warning: object with uuid {0} is a attachment", uuid); | ||
813 | } | ||
814 | } | ||
777 | break; | 815 | break; |
778 | 816 | ||
779 | case "name": | 817 | case "name": |
780 | deletes = GetDeleteCandidatesByName(module, cmd); | 818 | deletes = GetDeleteCandidatesByName(module, cmd); |
781 | break; | 819 | break; |
782 | 820 | ||
783 | case "outside": | 821 | case "outside": |
784 | deletes = new List<SceneObjectGroup>(); | 822 | deletes = new List<SceneObjectGroup>(); |
785 | 823 | ||
@@ -787,7 +825,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
787 | { | 825 | { |
788 | SceneObjectPart rootPart = g.RootPart; | 826 | SceneObjectPart rootPart = g.RootPart; |
789 | bool delete = false; | 827 | bool delete = false; |
790 | 828 | ||
791 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | 829 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) |
792 | { | 830 | { |
793 | delete = true; | 831 | delete = true; |
@@ -796,18 +834,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
796 | { | 834 | { |
797 | ILandObject parcel | 835 | ILandObject parcel |
798 | = m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | 836 | = m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); |
799 | 837 | ||
800 | if (parcel == null || parcel.LandData.Name == "NO LAND") | 838 | if (parcel == null || parcel.LandData.Name == "NO LAND") |
801 | delete = true; | 839 | delete = true; |
802 | } | 840 | } |
803 | 841 | ||
804 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | 842 | if (delete && !g.IsAttachment && !deletes.Contains(g)) |
805 | deletes.Add(g); | 843 | deletes.Add(g); |
806 | }); | 844 | }); |
807 | 845 | ||
808 | if (deletes.Count == 0) | 846 | if (deletes.Count == 0) |
809 | m_console.OutputFormat("No objects were found outside region bounds"); | 847 | m_console.OutputFormat("No objects were found outside region bounds"); |
810 | 848 | ||
811 | break; | 849 | break; |
812 | 850 | ||
813 | case "pos": | 851 | case "pos": |
@@ -829,7 +867,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
829 | "Are you sure that you want to delete {0} objects from {1}", | 867 | "Are you sure that you want to delete {0} objects from {1}", |
830 | deletes.Count, m_scene.RegionInfo.RegionName), | 868 | deletes.Count, m_scene.RegionInfo.RegionName), |
831 | "y/N"); | 869 | "y/N"); |
832 | 870 | ||
833 | if (response.ToLower() != "y") | 871 | if (response.ToLower() != "y") |
834 | { | 872 | { |
835 | MainConsole.Instance.OutputFormat( | 873 | MainConsole.Instance.OutputFormat( |
@@ -869,11 +907,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
869 | if (useRegex) | 907 | if (useRegex) |
870 | { | 908 | { |
871 | Regex nameRegex = new Regex(name); | 909 | Regex nameRegex = new Regex(name); |
872 | searchAction = so => { if (nameRegex.IsMatch(so.Name)) { sceneObjects.Add(so); }}; | 910 | searchAction = so => { if (nameRegex.IsMatch(so.Name)) {if(!so.IsAttachment) sceneObjects.Add(so);}}; |
873 | } | 911 | } |
874 | else | 912 | else |
875 | { | 913 | { |
876 | searchAction = so => { if (so.Name == name) { sceneObjects.Add(so); }}; | 914 | searchAction = so => { if (so.Name == name) {if(!so.IsAttachment) sceneObjects.Add(so);}}; |
877 | } | 915 | } |
878 | 916 | ||
879 | m_scene.ForEachSOG(searchAction); | 917 | m_scene.ForEachSOG(searchAction); |
@@ -916,11 +954,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
916 | { | 954 | { |
917 | m_console.OutputFormat("Error: Start vector '{0}' does not have a valid format", rawConsoleStartVector); | 955 | m_console.OutputFormat("Error: Start vector '{0}' does not have a valid format", rawConsoleStartVector); |
918 | endVector = Vector3.Zero; | 956 | endVector = Vector3.Zero; |
919 | 957 | ||
920 | return false; | 958 | return false; |
921 | } | 959 | } |
922 | 960 | ||
923 | string rawConsoleEndVector = rawComponents.Skip(2).Take(1).Single(); | 961 | string rawConsoleEndVector = rawComponents.Skip(1).Take(1).Single(); |
924 | 962 | ||
925 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | 963 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) |
926 | { | 964 | { |