aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-31 23:21:02 +0000
committerJustin Clark-Casey (justincc)2012-01-31 23:21:02 +0000
commit996cc6097e7d5bbccd1a0b85a1d901686037e19b (patch)
tree55a668f5f286956959c8aa247ce8125d6f3f01a4
parentGet rid of the "no objects found" feedback for now - this doesn't work well i... (diff)
downloadopensim-SC_OLD-996cc6097e7d5bbccd1a0b85a1d901686037e19b.zip
opensim-SC_OLD-996cc6097e7d5bbccd1a0b85a1d901686037e19b.tar.gz
opensim-SC_OLD-996cc6097e7d5bbccd1a0b85a1d901686037e19b.tar.bz2
opensim-SC_OLD-996cc6097e7d5bbccd1a0b85a1d901686037e19b.tar.xz
Implement "show object name <name>" console command to show details of an object with the given name
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs57
1 files changed, 49 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index d5a3e77..d1ae4dc 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -101,12 +101,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
101 "show object uuid <UUID>", 101 "show object uuid <UUID>",
102 "Show details of a scene object with the given UUID", HandleShowObjectByUuid); 102 "Show details of a scene object with the given UUID", HandleShowObjectByUuid);
103 103
104// m_console.Commands.AddCommand( 104 m_console.Commands.AddCommand(
105// "region", 105 "region",
106// false, 106 false,
107// "show object name <UUID>", 107 "show object name",
108// "show object name <UUID>", 108 "show object name <name>",
109// "Show details of scene objects with the given name", HandleShowObjectName); 109 "Show details of scene objects with the given name", HandleShowObjectByName);
110 } 110 }
111 111
112 public void RemoveRegion(Scene scene) 112 public void RemoveRegion(Scene scene)
@@ -146,14 +146,55 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
146 } 146 }
147 147
148 StringBuilder sb = new StringBuilder(); 148 StringBuilder sb = new StringBuilder();
149 AddPartReport(sb, sop);
150
151 m_console.OutputFormat(sb.ToString());
152 }
153
154 private void HandleShowObjectByName(string module, string[] cmd)
155 {
156 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
157 return;
158
159 if (cmd.Length < 4)
160 {
161 m_console.OutputFormat("Usage: show object name <name>");
162 return;
163 }
164
165 string name = cmd[3];
166
167 List<SceneObjectPart> parts = new List<SceneObjectPart>();
168
169 m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } }));
170
171 if (parts.Count == 0)
172 {
173 m_console.OutputFormat("No parts with name {0} found in {1}", name, m_scene.RegionInfo.RegionName);
174 return;
175 }
176
177 StringBuilder sb = new StringBuilder();
178
179 foreach (SceneObjectPart part in parts)
180 {
181 AddPartReport(sb, part);
182 sb.Append("\n");
183 }
184
185 m_console.OutputFormat(sb.ToString());
186 }
187
188 private StringBuilder AddPartReport(StringBuilder sb, SceneObjectPart sop)
189 {
149 sb.AppendFormat("Name: {0}\n", sop.Name); 190 sb.AppendFormat("Name: {0}\n", sop.Name);
150 sb.AppendFormat("Description: {0}\n", sop.Description); 191 sb.AppendFormat("Description: {0}\n", sop.Description);
151 sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); 192 sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName);
152 sb.AppendFormat("Parent: {0}", 193 sb.AppendFormat("Parent: {0}",
153 sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); 194 sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID));
154 sb.AppendFormat("Parts: {0}", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString()); 195 sb.AppendFormat("Parts: {0}\n", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());;
155 196
156 m_console.OutputFormat(sb.ToString()); 197 return sb;
157 } 198 }
158 199
159 private void HandleDeleteObject(string module, string[] cmd) 200 private void HandleDeleteObject(string module, string[] cmd)