diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b4aefce..877231a 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -481,6 +481,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
481 | IAssetService cache = m_scene.AssetService; | 481 | IAssetService cache = m_scene.AssetService; |
482 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | 482 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
483 | WearableCacheItem[] wearableCache = null; | 483 | WearableCacheItem[] wearableCache = null; |
484 | WearableCacheItem[] bakedModuleCache = null; | ||
485 | |||
486 | wearableCache = WearableCacheItem.GetDefaultCacheItem(); | ||
484 | 487 | ||
485 | // debug | 488 | // debug |
486 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) | 489 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) |
@@ -493,46 +496,47 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
493 | m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); | 496 | m_log.Debug("[ValidateBakedCache] {" + iter + "/" + j + " t - No texture"); |
494 | } | 497 | } |
495 | 498 | ||
496 | |||
497 | int hits = 0; | 499 | int hits = 0; |
498 | // Cache wearable data for teleport. | 500 | // Cache wearable data for teleport. |
499 | // Only makes sense if there's a bake module and a cache module | 501 | // Only makes sense if there's a bake module and a cache module |
500 | if (bakedModule != null && cache != null) | 502 | if (bakedModule != null && cache != null) |
501 | { | 503 | { |
504 | m_log.Debug("[ValidateBakedCache] calling bakedModule"); | ||
502 | try | 505 | try |
503 | { | 506 | { |
504 | wearableCache = bakedModule.Get(sp.UUID); | 507 | bakedModuleCache = bakedModule.Get(sp.UUID); |
505 | } | 508 | } |
506 | catch (Exception) | 509 | catch (Exception) |
507 | { | 510 | { |
508 | wearableCache = null; | 511 | bakedModuleCache = null; |
509 | } | 512 | } |
510 | 513 | ||
511 | if (wearableCache != null) | 514 | if (bakedModuleCache != null) |
512 | { | 515 | { |
513 | for (int i = 0; i < wearableCache.Length; i++) | 516 | m_log.Debug("[ValidateBakedCache] got bakedModule cache " + wearableCache.Length); |
514 | { | ||
515 | 517 | ||
516 | m_log.Debug("[ValidateBakedCache] got bakedModule cache"); | 518 | // old store have diferent sizes and index starts at 1 |
519 | int offset = 0; | ||
520 | if (bakedModuleCache[0].TextureIndex == 1) | ||
521 | offset = -1; | ||
522 | int j; | ||
517 | 523 | ||
518 | if (wearableCache[i].TextureAsset != null) | 524 | for (int i = 0; i < bakedModuleCache.Length; i++) |
519 | { | 525 | { |
520 | wearableCache[i].TextureAsset.Temporary = true; | 526 | j = (int)bakedModuleCache[i].TextureIndex + offset; |
521 | wearableCache[i].TextureAsset.Local = true; | 527 | |
522 | cache.Store(wearableCache[i].TextureAsset); | 528 | if (bakedModuleCache[i].TextureAsset != null) |
523 | } | ||
524 | else | ||
525 | { | 529 | { |
526 | wearableCache[i].TextureID = UUID.Zero; | 530 | wearableCache[j].TextureID = bakedModuleCache[i].TextureID; |
527 | wearableCache[i].CacheId = UUID.Zero; | 531 | wearableCache[j].CacheId = bakedModuleCache[i].TextureID; |
532 | bakedModuleCache[i].TextureAsset.Temporary = true; | ||
533 | bakedModuleCache[i].TextureAsset.Local = true; | ||
534 | cache.Store(bakedModuleCache[i].TextureAsset); | ||
528 | } | 535 | } |
529 | } | 536 | } |
530 | } | 537 | } |
531 | } | 538 | } |
532 | 539 | ||
533 | if(wearableCache == null) | ||
534 | wearableCache = WearableCacheItem.GetDefaultCacheItem(); | ||
535 | |||
536 | // Process the baked textures | 540 | // Process the baked textures |
537 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 541 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) |
538 | { | 542 | { |
@@ -540,7 +544,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
540 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | 544 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; |
541 | 545 | ||
542 | // No face, so lets check our baked service cache, teleport or login. | 546 | // No face, so lets check our baked service cache, teleport or login. |
543 | if (face == null) | 547 | if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) |
544 | { | 548 | { |
545 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); | 549 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); |
546 | if (wearableCache[idx].TextureID != UUID.Zero) | 550 | if (wearableCache[idx].TextureID != UUID.Zero) |
@@ -554,24 +558,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
554 | sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; | 558 | sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; |
555 | face = sp.Appearance.Texture.FaceTextures[idx]; | 559 | face = sp.Appearance.Texture.FaceTextures[idx]; |
556 | wearableCache[idx].CacheId = UUID.Zero; | 560 | wearableCache[idx].CacheId = UUID.Zero; |
557 | wearableCache[idx].TextureID = UUID.Zero; | ||
558 | wearableCache[idx].TextureAsset = null; | 561 | wearableCache[idx].TextureAsset = null; |
559 | continue; | 562 | continue; |
560 | } | 563 | } |
561 | } | 564 | } |
562 | |||
563 | 565 | ||
564 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) | 566 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) |
565 | { | 567 | { |
566 | wearableCache[idx].CacheId = UUID.Zero; | 568 | defonly = false; // found a non-default texture reference |
567 | wearableCache[idx].TextureID = UUID.Zero; | ||
568 | wearableCache[idx].TextureAsset = null; | ||
569 | continue; | 569 | continue; |
570 | } | 570 | } |
571 | 571 | ||
572 | defonly = false; // found a non-default texture reference | 572 | if(wearableCache[idx].TextureID != face.TextureID) |
573 | |||
574 | if(wearableCache[idx].TextureID != sp.Appearance.Texture.FaceTextures[idx].TextureID) | ||
575 | { | 573 | { |
576 | wearableCache[idx].CacheId = UUID.Zero; | 574 | wearableCache[idx].CacheId = UUID.Zero; |
577 | wearableCache[idx].TextureID = UUID.Zero; | 575 | wearableCache[idx].TextureID = UUID.Zero; |