diff options
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 27cf204..7ec2860 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -373,6 +373,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
373 | { | 373 | { |
374 | bool defonly = true; // are we only using default textures | 374 | bool defonly = true; // are we only using default textures |
375 | IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | 375 | IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); |
376 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
377 | WearableCacheItem[] wearableCache = null; | ||
378 | |||
379 | // Cache wearable data for teleport. | ||
380 | // Only makes sense if there's a bake module and a cache module | ||
381 | if (bakedModule != null && cache != null) | ||
382 | { | ||
383 | try | ||
384 | { | ||
385 | wearableCache = bakedModule.Get(sp.UUID); | ||
386 | } | ||
387 | catch (Exception) | ||
388 | { | ||
389 | |||
390 | } | ||
391 | if (wearableCache != null) | ||
392 | { | ||
393 | for (int i = 0; i < wearableCache.Length; i++) | ||
394 | { | ||
395 | cache.Cache(wearableCache[i].TextureAsset); | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | /* | ||
400 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
401 | if (invService.GetRootFolder(userID) != null) | ||
402 | { | ||
403 | WearableCacheItem[] wearableCache = null; | ||
404 | if (bakedModule != null) | ||
405 | { | ||
406 | try | ||
407 | { | ||
408 | wearableCache = bakedModule.Get(userID); | ||
409 | appearance.WearableCacheItems = wearableCache; | ||
410 | appearance.WearableCacheItemsDirty = false; | ||
411 | foreach (WearableCacheItem item in wearableCache) | ||
412 | { | ||
413 | appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID; | ||
414 | } | ||
415 | } | ||
416 | catch (Exception) | ||
417 | { | ||
418 | |||
419 | } | ||
420 | } | ||
421 | */ | ||
376 | 422 | ||
377 | // Process the texture entry | 423 | // Process the texture entry |
378 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 424 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) |
@@ -380,9 +426,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
380 | int idx = AvatarAppearance.BAKE_INDICES[i]; | 426 | int idx = AvatarAppearance.BAKE_INDICES[i]; |
381 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | 427 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; |
382 | 428 | ||
383 | // if there is no texture entry, skip it | 429 | // No face, so lets check our baked service cache, teleport or login. |
384 | if (face == null) | 430 | if (face == null) |
385 | continue; | 431 | { |
432 | if (wearableCache != null) | ||
433 | { | ||
434 | // If we find the an appearance item, set it as the textureentry and the face | ||
435 | WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache); | ||
436 | if (searchitem != null) | ||
437 | { | ||
438 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx); | ||
439 | sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID; | ||
440 | face = sp.Appearance.Texture.FaceTextures[idx]; | ||
441 | } | ||
442 | else | ||
443 | { | ||
444 | // if there is no texture entry and no baked cache, skip it | ||
445 | continue; | ||
446 | } | ||
447 | } | ||
448 | else | ||
449 | { | ||
450 | //No texture entry face and no cache. Skip this face. | ||
451 | continue; | ||
452 | } | ||
453 | } | ||
454 | |||
386 | 455 | ||
387 | // m_log.DebugFormat( | 456 | // m_log.DebugFormat( |
388 | // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", | 457 | // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", |