aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs67
1 files changed, 35 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index f8bb435..878d2fa 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -202,14 +202,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
202 202
203// WriteBakedTexturesReport(sp, m_log.DebugFormat); 203// WriteBakedTexturesReport(sp, m_log.DebugFormat);
204 204
205
206 // If bake textures are missing and this is not an NPC, request a rebake from client
207 // rebake may messup caching, and should not be needed
208
209
210// if (!UpdateBakedTextureCache(sp,cacheItems) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
211// RequestRebake(sp, true);
212
213 UpdateBakedTextureCache(sp, cacheItems); 205 UpdateBakedTextureCache(sp, cacheItems);
214 206
215 // This appears to be set only in the final stage of the appearance 207 // This appears to be set only in the final stage of the appearance
@@ -372,6 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
372 364
373 // uploaded baked textures will be in assets local cache 365 // uploaded baked textures will be in assets local cache
374 IAssetService cache = m_scene.AssetService; 366 IAssetService cache = m_scene.AssetService;
367 IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
375 368
376 int validDirtyBakes = 0; 369 int validDirtyBakes = 0;
377 int hits = 0; 370 int hits = 0;
@@ -384,6 +377,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
384 wearableCache = WearableCacheItem.GetDefaultCacheItem(); 377 wearableCache = WearableCacheItem.GetDefaultCacheItem();
385 } 378 }
386 379
380 List<UUID> missing = new List<UUID>();
381
387 // Process received baked textures 382 // Process received baked textures
388 for (int i = 0; i < cacheItems.Length; i++) 383 for (int i = 0; i < cacheItems.Length; i++)
389 { 384 {
@@ -411,19 +406,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
411 continue; 406 continue;
412 } 407 }
413 408
414 if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID) 409/*
410 if (face.TextureID == wearableCache[idx].TextureID && m_BakedTextureModule != null)
415 { 411 {
416 if(wearableCache[idx].CacheId != cacheItems[i].CacheId) 412 if (wearableCache[idx].CacheId != cacheItems[i].CacheId)
417 { 413 {
418 wearableCache[idx].CacheId = cacheItems[i].CacheId; 414 wearableCache[idx].CacheId = cacheItems[i].CacheId;
419 validDirtyBakes++; 415 validDirtyBakes++;
420 416
421 //assuming this can only happen if asset is in cache 417 //assuming this can only happen if asset is in cache
422 } 418 }
423 hits++; 419 hits++;
424 continue; 420 continue;
425 } 421 }
426 422*/
423
427 wearableCache[idx].TextureAsset = null; 424 wearableCache[idx].TextureAsset = null;
428 if (cache != null) 425 if (cache != null)
429 wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); 426 wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString());
@@ -431,7 +428,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
431 if (wearableCache[idx].TextureAsset != null) 428 if (wearableCache[idx].TextureAsset != null)
432 { 429 {
433 wearableCache[idx].CacheId = cacheItems[i].CacheId; 430 wearableCache[idx].CacheId = cacheItems[i].CacheId;
434 wearableCache[idx].TextureID = sp.Appearance.Texture.FaceTextures[idx].TextureID; 431 wearableCache[idx].TextureID = face.TextureID;
435 validDirtyBakes++; 432 validDirtyBakes++;
436 hits++; 433 hits++;
437 } 434 }
@@ -440,6 +437,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
440 wearableCache[idx].CacheId = UUID.Zero; 437 wearableCache[idx].CacheId = UUID.Zero;
441 wearableCache[idx].TextureID = UUID.Zero; 438 wearableCache[idx].TextureID = UUID.Zero;
442 wearableCache[idx].TextureAsset = null; 439 wearableCache[idx].TextureAsset = null;
440 missing.Add(face.TextureID);
443 continue; 441 continue;
444 } 442 }
445 } 443 }
@@ -451,7 +449,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
451 449
452 if (validDirtyBakes > 0 && hits == cacheItems.Length) 450 if (validDirtyBakes > 0 && hits == cacheItems.Length)
453 { 451 {
454 IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
455 if (m_BakedTextureModule != null) 452 if (m_BakedTextureModule != null)
456 { 453 {
457 m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); 454 m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache");
@@ -469,8 +466,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
469 } 466 }
470 } 467 }
471 468
469 if(missing.Count > 0)
470 {
471 foreach(UUID id in missing)
472 sp.ControllingClient.SendRebakeAvatarTextures(id);
473 }
474
472 // debug 475 // debug
473 m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString()); 476 m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count);
474/* 477/*
475 for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) 478 for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
476 { 479 {
@@ -548,25 +551,26 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
548 { 551 {
549 int idx = AvatarAppearance.BAKE_INDICES[i]; 552 int idx = AvatarAppearance.BAKE_INDICES[i];
550 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; 553 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
551 if (face != null && face.TextureID == wearableCache[idx].TextureID) 554 if (face != null)
552 { 555 {
553 if (wearableCache[idx].TextureAsset != null) 556 if (face.TextureID == wearableCache[idx].TextureID &&
557 face.TextureID != UUID.Zero)
554 { 558 {
555 hits++; 559 if (wearableCache[idx].TextureAsset != null)
556 wearableCache[idx].TextureAsset.Temporary = true; 560 {
557 wearableCache[idx].TextureAsset.Local = true; 561 hits++;
558 cache.Store(wearableCache[idx].TextureAsset); 562 wearableCache[idx].TextureAsset.Temporary = true;
559 563 wearableCache[idx].TextureAsset.Local = true;
560 } 564 cache.Store(wearableCache[idx].TextureAsset);
561 else if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) 565 continue;
562 { 566 }
563 hits++; 567 if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null)
564 } 568 {
565 else 569 hits++;
566 { 570 continue;
567 wearableCacheValid = false; 571 }
568 break;
569 } 572 }
573 wearableCacheValid = false;
570 } 574 }
571 } 575 }
572 576
@@ -623,7 +627,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
623 bakedModuleCache[i].TextureAsset.Temporary = true; 627 bakedModuleCache[i].TextureAsset.Temporary = true;
624 bakedModuleCache[i].TextureAsset.Local = true; 628 bakedModuleCache[i].TextureAsset.Local = true;
625 cache.Store(bakedModuleCache[i].TextureAsset); 629 cache.Store(bakedModuleCache[i].TextureAsset);
626
627 } 630 }
628 } 631 }
629 gotbacked = true; 632 gotbacked = true;