diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 146 |
1 files changed, 128 insertions, 18 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 28f04b3..89704d5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |||
@@ -48,10 +48,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AppearanceInfoModule")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AppearanceInfoModule")] |
49 | public class AppearanceInfoModule : ISharedRegionModule | 49 | public class AppearanceInfoModule : ISharedRegionModule |
50 | { | 50 | { |
51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 53 | public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}"; |
54 | protected IAvatarFactoryModule m_avatarFactory; | 54 | |
55 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | ||
56 | private IAvatarFactoryModule m_avatarFactory; | ||
55 | 57 | ||
56 | public string Name { get { return "Appearance Information Module"; } } | 58 | public string Name { get { return "Appearance Information Module"; } } |
57 | 59 | ||
@@ -90,46 +92,154 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
90 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 92 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
91 | 93 | ||
92 | lock (m_scenes) | 94 | lock (m_scenes) |
93 | m_scenes[scene.RegionInfo.RegionID] = scene; | 95 | m_scenes[scene.RegionInfo.RegionID] = scene; |
96 | |||
97 | scene.AddCommand( | ||
98 | this, "show appearance", | ||
99 | "show appearance [<first-name> <last-name>]", | ||
100 | "Synonym for 'appearance show'", | ||
101 | HandleShowAppearanceCommand); | ||
94 | 102 | ||
95 | scene.AddCommand( | 103 | scene.AddCommand( |
96 | this, "appearance show", | 104 | this, "appearance show", |
97 | "appearance show", | 105 | "appearance show [<first-name> <last-name>]", |
98 | "Show appearance information for each avatar in the simulator.", | 106 | "Show appearance information for each avatar in the simulator.", |
99 | "At the moment this actually just checks that we have all the required baked textures. If not, then appearance is 'corrupt' and other avatars will continue to see a cloud.", | 107 | "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " |
100 | ShowAppearanceInfo); | 108 | + "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud." |
109 | + "\nOptionally, you can view just a particular avatar's appearance information." | ||
110 | + "\nIn this case, the texture UUID for each bake type is also shown and whether the simulator can find the referenced texture.", | ||
111 | HandleShowAppearanceCommand); | ||
101 | 112 | ||
102 | scene.AddCommand( | 113 | scene.AddCommand( |
103 | this, "appearance send", | 114 | this, "appearance send", |
104 | "appearance send", | 115 | "appearance send [<first-name> <last-name>]", |
105 | "Send appearance data for each avatar in the simulator to viewers.", | 116 | "Send appearance data for each avatar in the simulator to other viewers.", |
106 | SendAppearance); | 117 | "Optionally, you can specify that only a particular avatar's appearance data is sent.", |
118 | HandleSendAppearanceCommand); | ||
107 | } | 119 | } |
108 | 120 | ||
109 | private void SendAppearance(string module, string[] cmd) | 121 | private void HandleSendAppearanceCommand(string module, string[] cmd) |
110 | { | 122 | { |
123 | if (cmd.Length != 2 && cmd.Length < 4) | ||
124 | { | ||
125 | MainConsole.Instance.OutputFormat("Usage: appearance send [<first-name> <last-name>]"); | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | bool targetNameSupplied = false; | ||
130 | string optionalTargetFirstName = null; | ||
131 | string optionalTargetLastName = null; | ||
132 | |||
133 | if (cmd.Length >= 4) | ||
134 | { | ||
135 | targetNameSupplied = true; | ||
136 | optionalTargetFirstName = cmd[2]; | ||
137 | optionalTargetLastName = cmd[3]; | ||
138 | } | ||
139 | |||
111 | lock (m_scenes) | 140 | lock (m_scenes) |
112 | { | 141 | { |
113 | foreach (Scene scene in m_scenes.Values) | 142 | foreach (Scene scene in m_scenes.Values) |
114 | { | 143 | { |
115 | scene.ForEachRootScenePresence(sp => scene.AvatarFactory.SendAppearance(sp.UUID)); | 144 | if (targetNameSupplied) |
145 | { | ||
146 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
147 | if (sp != null && !sp.IsChildAgent) | ||
148 | { | ||
149 | MainConsole.Instance.OutputFormat( | ||
150 | "Sending appearance information for {0} to all other avatars in {1}", | ||
151 | sp.Name, scene.RegionInfo.RegionName); | ||
152 | |||
153 | scene.AvatarFactory.SendAppearance(sp.UUID); | ||
154 | } | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | scene.ForEachRootScenePresence( | ||
159 | sp => | ||
160 | { | ||
161 | MainConsole.Instance.OutputFormat( | ||
162 | "Sending appearance information for {0} to all other avatars in {1}", | ||
163 | sp.Name, scene.RegionInfo.RegionName); | ||
164 | |||
165 | scene.AvatarFactory.SendAppearance(sp.UUID); | ||
166 | } | ||
167 | ); | ||
168 | } | ||
116 | } | 169 | } |
117 | } | 170 | } |
118 | } | 171 | } |
119 | 172 | ||
120 | protected void ShowAppearanceInfo(string module, string[] cmd) | 173 | protected void HandleShowAppearanceCommand(string module, string[] cmd) |
121 | { | 174 | { |
175 | if (cmd.Length != 2 && cmd.Length < 4) | ||
176 | { | ||
177 | MainConsole.Instance.OutputFormat("Usage: appearance show [<first-name> <last-name>]"); | ||
178 | return; | ||
179 | } | ||
180 | |||
181 | bool targetNameSupplied = false; | ||
182 | string optionalTargetFirstName = null; | ||
183 | string optionalTargetLastName = null; | ||
184 | |||
185 | if (cmd.Length >= 4) | ||
186 | { | ||
187 | targetNameSupplied = true; | ||
188 | optionalTargetFirstName = cmd[2]; | ||
189 | optionalTargetLastName = cmd[3]; | ||
190 | } | ||
191 | |||
122 | lock (m_scenes) | 192 | lock (m_scenes) |
123 | { | 193 | { |
124 | foreach (Scene scene in m_scenes.Values) | 194 | foreach (Scene scene in m_scenes.Values) |
125 | { | 195 | { |
126 | scene.ForEachRootScenePresence( | 196 | if (targetNameSupplied) |
127 | delegate(ScenePresence sp) | 197 | { |
198 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
199 | if (sp != null && !sp.IsChildAgent) | ||
128 | { | 200 | { |
201 | MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName); | ||
202 | MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID"); | ||
203 | |||
204 | Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures | ||
205 | = scene.AvatarFactory.GetBakedTextureFaces(sp.UUID); | ||
206 | foreach (BakeType bt in bakedTextures.Keys) | ||
207 | { | ||
208 | string rawTextureID; | ||
209 | |||
210 | if (bakedTextures[bt] == null) | ||
211 | { | ||
212 | rawTextureID = "not set"; | ||
213 | } | ||
214 | else | ||
215 | { | ||
216 | rawTextureID = bakedTextures[bt].TextureID.ToString(); | ||
217 | |||
218 | if (scene.AssetService.Get(rawTextureID) == null) | ||
219 | rawTextureID += " (not found)"; | ||
220 | else | ||
221 | rawTextureID += " (uploaded)"; | ||
222 | } | ||
223 | |||
224 | MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, bt, rawTextureID); | ||
225 | } | ||
226 | |||
129 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); | 227 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); |
130 | MainConsole.Instance.OutputFormat( | 228 | MainConsole.Instance.OutputFormat( |
131 | "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); | 229 | "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); |
132 | }); | 230 | } |
231 | } | ||
232 | else | ||
233 | { | ||
234 | scene.ForEachRootScenePresence( | ||
235 | sp => | ||
236 | { | ||
237 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); | ||
238 | MainConsole.Instance.OutputFormat( | ||
239 | "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); | ||
240 | } | ||
241 | ); | ||
242 | } | ||
133 | } | 243 | } |
134 | } | 244 | } |
135 | } | 245 | } |