diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 90 |
1 files changed, 57 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e8aee3e..8d503bd 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -149,14 +149,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
149 | // Process the baked texture array | 149 | // Process the baked texture array |
150 | if (textureEntry != null) | 150 | if (textureEntry != null) |
151 | { | 151 | { |
152 | m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID); | 152 | m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); |
153 | 153 | ||
154 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); | 154 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); |
155 | 155 | ||
156 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; | 156 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; |
157 | 157 | ||
158 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); | 158 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); |
159 | ValidateBakedTextureCache(sp, false); | 159 | if (!ValidateBakedTextureCache(sp)) |
160 | RequestRebake(sp, true); | ||
160 | 161 | ||
161 | // This appears to be set only in the final stage of the appearance | 162 | // This appears to be set only in the final stage of the appearance |
162 | // update transaction. In theory, we should be able to do an immediate | 163 | // update transaction. In theory, we should be able to do an immediate |
@@ -251,15 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
251 | } | 252 | } |
252 | 253 | ||
253 | /// <summary> | 254 | /// <summary> |
254 | /// Check for the existence of the baked texture assets. | ||
255 | /// </summary> | ||
256 | /// <param name="sp"></param> | ||
257 | public bool ValidateBakedTextureCache(IScenePresence sp) | ||
258 | { | ||
259 | return ValidateBakedTextureCache(sp, true); | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// Queue up a request to send appearance. | 255 | /// Queue up a request to send appearance. |
264 | /// </summary> | 256 | /// </summary> |
265 | /// <remarks> | 257 | /// <remarks> |
@@ -292,17 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
292 | } | 284 | } |
293 | } | 285 | } |
294 | 286 | ||
295 | #endregion | 287 | public bool ValidateBakedTextureCache(IScenePresence sp) |
296 | |||
297 | #region AvatarFactoryModule private methods | ||
298 | |||
299 | /// <summary> | ||
300 | /// Check for the existence of the baked texture assets. Request a rebake | ||
301 | /// unless checkonly is true. | ||
302 | /// </summary> | ||
303 | /// <param name="client"></param> | ||
304 | /// <param name="checkonly"></param> | ||
305 | private bool ValidateBakedTextureCache(IScenePresence sp, bool checkonly) | ||
306 | { | 288 | { |
307 | bool defonly = true; // are we only using default textures | 289 | bool defonly = true; // are we only using default textures |
308 | 290 | ||
@@ -330,24 +312,66 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
330 | defonly = false; // found a non-default texture reference | 312 | defonly = false; // found a non-default texture reference |
331 | 313 | ||
332 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | 314 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) |
333 | { | 315 | return false; |
334 | if (checkonly) | 316 | } |
335 | return false; | 317 | |
318 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); | ||
319 | |||
320 | // If we only found default textures, then the appearance is not cached | ||
321 | return (defonly ? false : true); | ||
322 | } | ||
323 | |||
324 | public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) | ||
325 | { | ||
326 | int texturesRebaked = 0; | ||
327 | |||
328 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | ||
329 | { | ||
330 | int idx = AvatarAppearance.BAKE_INDICES[i]; | ||
331 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | ||
332 | |||
333 | // if there is no texture entry, skip it | ||
334 | if (face == null) | ||
335 | continue; | ||
336 | |||
337 | // m_log.DebugFormat( | ||
338 | // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", | ||
339 | // face.TextureID, idx, client.Name, client.AgentId); | ||
340 | |||
341 | // if the texture is one of the "defaults" then skip it | ||
342 | // this should probably be more intelligent (skirt texture doesnt matter | ||
343 | // if the avatar isnt wearing a skirt) but if any of the main baked | ||
344 | // textures is default then the rest should be as well | ||
345 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
346 | continue; | ||
336 | 347 | ||
348 | if (missingTexturesOnly) | ||
349 | { | ||
350 | if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) | ||
351 | continue; | ||
352 | else | ||
353 | m_log.DebugFormat( | ||
354 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", | ||
355 | face.TextureID, idx, sp.Name); | ||
356 | } | ||
357 | else | ||
358 | { | ||
337 | m_log.DebugFormat( | 359 | m_log.DebugFormat( |
338 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", | 360 | "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.", |
339 | face.TextureID, idx, sp.Name); | 361 | face.TextureID, idx, sp.Name); |
340 | |||
341 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
342 | } | 362 | } |
343 | } | ||
344 | 363 | ||
345 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); | 364 | texturesRebaked++; |
365 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
366 | } | ||
346 | 367 | ||
347 | // If we only found default textures, then the appearance is not cached | 368 | return texturesRebaked; |
348 | return (defonly ? false : true); | ||
349 | } | 369 | } |
350 | 370 | ||
371 | #endregion | ||
372 | |||
373 | #region AvatarFactoryModule private methods | ||
374 | |||
351 | private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) | 375 | private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) |
352 | { | 376 | { |
353 | if (sp.IsChildAgent) | 377 | if (sp.IsChildAgent) |
@@ -602,4 +626,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
602 | outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); | 626 | outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); |
603 | } | 627 | } |
604 | } | 628 | } |
605 | } | 629 | } \ No newline at end of file |