diff options
author | Justin Clark-Casey (justincc) | 2012-01-31 23:35:13 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-31 23:35:13 +0000 |
commit | f028dca711c7ebcda32e4b035eb667455e3bc29d (patch) | |
tree | 79bcc2adde4154b3a4b0cd2b31285f3488781bcd /OpenSim | |
parent | Implement "show object name <name>" console command to show details of an obj... (diff) | |
download | opensim-SC_OLD-f028dca711c7ebcda32e4b035eb667455e3bc29d.zip opensim-SC_OLD-f028dca711c7ebcda32e4b035eb667455e3bc29d.tar.gz opensim-SC_OLD-f028dca711c7ebcda32e4b035eb667455e3bc29d.tar.bz2 opensim-SC_OLD-f028dca711c7ebcda32e4b035eb667455e3bc29d.tar.xz |
Add "show part uuid" and "show part name" console commands.
These commands will display part/prim details for a given uuid or name
The "show object uuid" and "show object name" commands will now only display details for objects (i.e. not child parts in a linkset).
This is for consistency with the "delete object" commands which only delete objects, not parts.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 104 |
1 files changed, 97 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index d1ae4dc..e3d04cd 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -107,6 +107,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
107 | "show object name", | 107 | "show object name", |
108 | "show object name <name>", | 108 | "show object name <name>", |
109 | "Show details of scene objects with the given name", HandleShowObjectByName); | 109 | "Show details of scene objects with the given name", HandleShowObjectByName); |
110 | |||
111 | m_console.Commands.AddCommand( | ||
112 | "region", | ||
113 | false, | ||
114 | "show part uuid", | ||
115 | "show part uuid <UUID>", | ||
116 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | ||
117 | |||
118 | m_console.Commands.AddCommand( | ||
119 | "region", | ||
120 | false, | ||
121 | "show part name", | ||
122 | "show part name <name>", | ||
123 | "Show details of scene object parts with the given name", HandleShowPartByName); | ||
110 | } | 124 | } |
111 | 125 | ||
112 | public void RemoveRegion(Scene scene) | 126 | public void RemoveRegion(Scene scene) |
@@ -137,16 +151,16 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
137 | return; | 151 | return; |
138 | } | 152 | } |
139 | 153 | ||
140 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); | 154 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); |
141 | 155 | ||
142 | if (sop == null) | 156 | if (so == null) |
143 | { | 157 | { |
144 | // m_console.OutputFormat("No object found with uuid {0}", objectUuid); | 158 | // m_console.OutputFormat("No part found with uuid {0}", objectUuid); |
145 | return; | 159 | return; |
146 | } | 160 | } |
147 | 161 | ||
148 | StringBuilder sb = new StringBuilder(); | 162 | StringBuilder sb = new StringBuilder(); |
149 | AddPartReport(sb, sop); | 163 | AddSceneObjectReport(sb, so); |
150 | 164 | ||
151 | m_console.OutputFormat(sb.ToString()); | 165 | m_console.OutputFormat(sb.ToString()); |
152 | } | 166 | } |
@@ -164,6 +178,72 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
164 | 178 | ||
165 | string name = cmd[3]; | 179 | string name = cmd[3]; |
166 | 180 | ||
181 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | ||
182 | |||
183 | m_scene.ForEachSOG(so => { if (so.Name == name) { sceneObjects.Add(so); }}); | ||
184 | |||
185 | if (sceneObjects.Count == 0) | ||
186 | { | ||
187 | m_console.OutputFormat("No objects with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | StringBuilder sb = new StringBuilder(); | ||
192 | |||
193 | foreach (SceneObjectGroup so in sceneObjects) | ||
194 | { | ||
195 | AddSceneObjectReport(sb, so); | ||
196 | sb.Append("\n"); | ||
197 | } | ||
198 | |||
199 | m_console.OutputFormat(sb.ToString()); | ||
200 | } | ||
201 | |||
202 | private void HandleShowPartByUuid(string module, string[] cmd) | ||
203 | { | ||
204 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
205 | return; | ||
206 | |||
207 | if (cmd.Length < 4) | ||
208 | { | ||
209 | m_console.OutputFormat("Usage: show part uuid <uuid>"); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | UUID objectUuid; | ||
214 | if (!UUID.TryParse(cmd[3], out objectUuid)) | ||
215 | { | ||
216 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); | ||
217 | return; | ||
218 | } | ||
219 | |||
220 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); | ||
221 | |||
222 | if (sop == null) | ||
223 | { | ||
224 | // m_console.OutputFormat("No part found with uuid {0}", objectUuid); | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | StringBuilder sb = new StringBuilder(); | ||
229 | AddScenePartReport(sb, sop); | ||
230 | |||
231 | m_console.OutputFormat(sb.ToString()); | ||
232 | } | ||
233 | |||
234 | private void HandleShowPartByName(string module, string[] cmd) | ||
235 | { | ||
236 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
237 | return; | ||
238 | |||
239 | if (cmd.Length < 4) | ||
240 | { | ||
241 | m_console.OutputFormat("Usage: show part name <name>"); | ||
242 | return; | ||
243 | } | ||
244 | |||
245 | string name = cmd[3]; | ||
246 | |||
167 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | 247 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); |
168 | 248 | ||
169 | m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } })); | 249 | m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } })); |
@@ -178,21 +258,31 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
178 | 258 | ||
179 | foreach (SceneObjectPart part in parts) | 259 | foreach (SceneObjectPart part in parts) |
180 | { | 260 | { |
181 | AddPartReport(sb, part); | 261 | AddScenePartReport(sb, part); |
182 | sb.Append("\n"); | 262 | sb.Append("\n"); |
183 | } | 263 | } |
184 | 264 | ||
185 | m_console.OutputFormat(sb.ToString()); | 265 | m_console.OutputFormat(sb.ToString()); |
186 | } | 266 | } |
187 | 267 | ||
188 | private StringBuilder AddPartReport(StringBuilder sb, SceneObjectPart sop) | 268 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) |
269 | { | ||
270 | sb.AppendFormat("Name: {0}\n", so.Name); | ||
271 | sb.AppendFormat("Description: {0}\n", so.Description); | ||
272 | sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); | ||
273 | sb.AppendFormat("Parts: {0}\n", so.PrimCount); | ||
274 | |||
275 | return sb; | ||
276 | } | ||
277 | |||
278 | private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) | ||
189 | { | 279 | { |
190 | sb.AppendFormat("Name: {0}\n", sop.Name); | 280 | sb.AppendFormat("Name: {0}\n", sop.Name); |
191 | sb.AppendFormat("Description: {0}\n", sop.Description); | 281 | sb.AppendFormat("Description: {0}\n", sop.Description); |
192 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); | 282 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); |
193 | sb.AppendFormat("Parent: {0}", | 283 | sb.AppendFormat("Parent: {0}", |
194 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | 284 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); |
195 | sb.AppendFormat("Parts: {0}\n", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; | 285 | sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; |
196 | 286 | ||
197 | return sb; | 287 | return sb; |
198 | } | 288 | } |