aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/AvatarFactory
diff options
context:
space:
mode:
authorUbitUmarov2014-08-08 02:22:18 +0100
committerUbitUmarov2014-08-08 02:22:18 +0100
commit9aa6389b8ba37715e0b68071040d2a9c488515ad (patch)
tree05059ed63a6258f9eb27aefa6f5f084b78b31182 /OpenSim/Region/CoreModules/Avatar/AvatarFactory
parentDANGER back to right current max number of wearables ( TP out of regions (diff)
downloadopensim-SC_OLD-9aa6389b8ba37715e0b68071040d2a9c488515ad.zip
opensim-SC_OLD-9aa6389b8ba37715e0b68071040d2a9c488515ad.tar.gz
opensim-SC_OLD-9aa6389b8ba37715e0b68071040d2a9c488515ad.tar.bz2
opensim-SC_OLD-9aa6389b8ba37715e0b68071040d2a9c488515ad.tar.xz
lock set appearence during ValidateBakedTextureCache there seems to be a
overlap in same cases
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs190
1 files changed, 97 insertions, 93 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 797ec2b..9b13a09 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -487,131 +487,135 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
487 public bool ValidateBakedTextureCache(IScenePresence sp) 487 public bool ValidateBakedTextureCache(IScenePresence sp)
488 { 488 {
489 bool defonly = true; // are we only using default textures 489 bool defonly = true; // are we only using default textures
490 IAssetService cache = m_scene.AssetService;
491 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
492 WearableCacheItem[] wearableCache = null;
493 WearableCacheItem[] bakedModuleCache = null;
494 490
495 wearableCache = WearableCacheItem.GetDefaultCacheItem(); 491 lock (m_setAppearanceLock)
492 {
493 IAssetService cache = m_scene.AssetService;
494 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
495 WearableCacheItem[] wearableCache = null;
496 WearableCacheItem[] bakedModuleCache = null;
496 497
497 int hits = 0; 498 wearableCache = WearableCacheItem.GetDefaultCacheItem();
498 bool gotbacked = false;
499 499
500 // Cache wearable data for teleport. 500 int hits = 0;
501 // Only makes sense if there's a bake module and a cache module 501 bool gotbacked = false;
502 if (bakedModule != null && cache != null)
503 {
504 m_log.Debug("[ValidateBakedCache] calling bakedModule");
505 try
506 {
507 bakedModuleCache = bakedModule.Get(sp.UUID);
508 }
509 catch (Exception)
510 {
511 bakedModuleCache = null;
512 }
513 502
514 if (bakedModuleCache != null) 503 // Cache wearable data for teleport.
504 // Only makes sense if there's a bake module and a cache module
505 if (bakedModule != null && cache != null)
515 { 506 {
516 m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length); 507 m_log.Debug("[ValidateBakedCache] calling bakedModule");
508 try
509 {
510 bakedModuleCache = bakedModule.Get(sp.UUID);
511 }
512 catch (Exception)
513 {
514 bakedModuleCache = null;
515 }
517 516
518 for (int i = 0; i < bakedModuleCache.Length; i++) 517 if (bakedModuleCache != null)
519 { 518 {
520 int j = (int)bakedModuleCache[i].TextureIndex; 519 m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length);
521 520
522 if (bakedModuleCache[i].TextureAsset != null) 521 for (int i = 0; i < bakedModuleCache.Length; i++)
523 { 522 {
524 wearableCache[j].TextureID = bakedModuleCache[i].TextureID; 523 int j = (int)bakedModuleCache[i].TextureIndex;
525 wearableCache[j].CacheId = bakedModuleCache[i].CacheId; 524
526 wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; 525 if (bakedModuleCache[i].TextureAsset != null)
527 bakedModuleCache[i].TextureAsset.Temporary = true; 526 {
528 bakedModuleCache[i].TextureAsset.Local = true; 527 wearableCache[j].TextureID = bakedModuleCache[i].TextureID;
529 cache.Store(bakedModuleCache[i].TextureAsset); 528 wearableCache[j].CacheId = bakedModuleCache[i].CacheId;
529 wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
530 bakedModuleCache[i].TextureAsset.Temporary = true;
531 bakedModuleCache[i].TextureAsset.Local = true;
532 cache.Store(bakedModuleCache[i].TextureAsset);
530 533
534 }
531 } 535 }
536 gotbacked = true;
532 } 537 }
533 gotbacked = true;
534 } 538 }
535 }
536 539
537 // Process the baked textures 540 // Process the baked textures
538 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 541 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
539 {
540 int idx = AvatarAppearance.BAKE_INDICES[i];
541 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
542
543 // on tp viewer assumes servers did the cache work
544 // and tp propagation of baked textures is broken somewhere
545 // so make grid cache be mandatory
546 if (gotbacked)
547 { 542 {
548// m_log.Debug("[ValidateBakedCache] bakedModule cache override"); 543 int idx = AvatarAppearance.BAKE_INDICES[i];
549 if(sp.Appearance.Texture.FaceTextures[idx] == null) 544 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
550 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx);
551 sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID;
552 face = sp.Appearance.Texture.FaceTextures[idx];
553 545
554 // this should be removed 546 // on tp viewer assumes servers did the cache work
555 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) 547 // and tp propagation of baked textures is broken somewhere
548 // so make grid cache be mandatory
549 if (gotbacked)
556 { 550 {
557 defonly = false; // found a non-default texture reference 551 // m_log.Debug("[ValidateBakedCache] bakedModule cache override");
558 } 552 if (sp.Appearance.Texture.FaceTextures[idx] == null)
553 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx);
554 sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID;
555 face = sp.Appearance.Texture.FaceTextures[idx];
556
557 // this should be removed
558 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
559 {
560 defonly = false; // found a non-default texture reference
561 }
559 562
560 continue; 563 continue;
561 } 564 }
562 else 565 else
563 {
564 // No face, so lets check our cache
565 if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
566 { 566 {
567 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); 567 // No face, so lets check our cache
568 if (wearableCache[idx].TextureID != UUID.Zero) 568 if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
569 { 569 {
570 sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; 570 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx);
571 face = sp.Appearance.Texture.FaceTextures[idx]; 571 if (wearableCache[idx].TextureID != UUID.Zero)
572 // let run to end of loop to check cache 572 {
573 sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID;
574 face = sp.Appearance.Texture.FaceTextures[idx];
575 // let run to end of loop to check cache
576 }
577 else
578 {
579 sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
580 face = sp.Appearance.Texture.FaceTextures[idx];
581 // lets try not invalidating the cache entry
582 // wearableCache[idx].CacheId = UUID.Zero;
583 // wearableCache[idx].TextureAsset = null;
584 continue;
585 }
573 } 586 }
574 else 587
588 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
575 { 589 {
576 sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; 590 defonly = false; // found a non-default texture reference
577 face = sp.Appearance.Texture.FaceTextures[idx];
578 // lets try not invalidating the cache entry
579 // wearableCache[idx].CacheId = UUID.Zero;
580 // wearableCache[idx].TextureAsset = null;
581 continue; 591 continue;
582 } 592 }
583 }
584 593
585 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) 594 if (wearableCache[idx].TextureID != face.TextureID)
586 {
587 defonly = false; // found a non-default texture reference
588 continue;
589 }
590
591 if (wearableCache[idx].TextureID != face.TextureID)
592 {
593 wearableCache[idx].CacheId = UUID.Zero;
594 wearableCache[idx].TextureID = UUID.Zero;
595 wearableCache[idx].TextureAsset = null;
596 continue;
597 }
598
599 wearableCache[idx].TextureAsset = null;
600 if (cache != null)
601 {
602 wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString());
603 if (wearableCache[idx].TextureAsset == null)
604 { 595 {
605 wearableCache[idx].CacheId = UUID.Zero; 596 wearableCache[idx].CacheId = UUID.Zero;
606 wearableCache[idx].TextureID = UUID.Zero; 597 wearableCache[idx].TextureID = UUID.Zero;
598 wearableCache[idx].TextureAsset = null;
599 continue;
600 }
601
602 wearableCache[idx].TextureAsset = null;
603 if (cache != null)
604 {
605 wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString());
606 if (wearableCache[idx].TextureAsset == null)
607 {
608 wearableCache[idx].CacheId = UUID.Zero;
609 wearableCache[idx].TextureID = UUID.Zero;
610 }
611 else
612 hits++;
607 } 613 }
608 else
609 hits++;
610 } 614 }
611 } 615 }
612 }
613 616
614 sp.Appearance.WearableCacheItems = wearableCache; 617 sp.Appearance.WearableCacheItems = wearableCache;
618 }
615 619
616 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString()); 620 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString());
617 // debug 621 // debug