diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 18 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarWearable.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/WearableCacheItem.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 101 |
5 files changed, 92 insertions, 45 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a34c85f..c384336 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -53,7 +53,11 @@ namespace OpenSim.Framework | |||
53 | // should be only used as initial default value ( V1 viewers ) | 53 | // should be only used as initial default value ( V1 viewers ) |
54 | public readonly static int VISUALPARAM_COUNT = 218; | 54 | public readonly static int VISUALPARAM_COUNT = 218; |
55 | 55 | ||
56 | public readonly static int TEXTURE_COUNT = 21; | 56 | // public readonly static int TEXTURE_COUNT = 21 |
57 | // 21 bad, make it be updated as libovm gets update | ||
58 | // also keeping in sync with it | ||
59 | public readonly static int TEXTURE_COUNT = Primitive.TextureEntry.MAX_FACES; | ||
60 | |||
57 | public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | 61 | public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; |
58 | 62 | ||
59 | protected int m_serial = 0; | 63 | protected int m_serial = 0; |
@@ -458,7 +462,10 @@ namespace OpenSim.Framework | |||
458 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); | 462 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
459 | // DEBUG OFF | 463 | // DEBUG OFF |
460 | m_wearables[wearableId].Clear(); | 464 | m_wearables[wearableId].Clear(); |
461 | for (int i = 0; i < wearable.Count; i++) | 465 | int count = wearable.Count; |
466 | if (count > AvatarWearable.MAX_WEARABLES) | ||
467 | count = AvatarWearable.MAX_WEARABLES; | ||
468 | for (int i = 0; i < count; i++) | ||
462 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | 469 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); |
463 | } | 470 | } |
464 | 471 | ||
@@ -751,7 +758,12 @@ namespace OpenSim.Framework | |||
751 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) | 758 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) |
752 | { | 759 | { |
753 | OSDArray wears = (OSDArray)(data["wearables"]); | 760 | OSDArray wears = (OSDArray)(data["wearables"]); |
754 | for (int i = 0; i < wears.Count; i++) | 761 | |
762 | int count = wears.Count; | ||
763 | if (count > AvatarWearable.MAX_WEARABLES) | ||
764 | count = AvatarWearable.MAX_WEARABLES; | ||
765 | |||
766 | for (int i = 0; i < count; i++) | ||
755 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); | 767 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
756 | } | 768 | } |
757 | else | 769 | else |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index aee295a..2d411e3 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -67,10 +67,11 @@ namespace OpenSim.Framework | |||
67 | 67 | ||
68 | public static readonly int ALPHA = 13; | 68 | public static readonly int ALPHA = 13; |
69 | public static readonly int TATTOO = 14; | 69 | public static readonly int TATTOO = 14; |
70 | // public static readonly int PHYSICS = 15; | ||
71 | 70 | ||
72 | // public static readonly int MAX_WEARABLES = 16; | ||
73 | public static readonly int MAX_WEARABLES = 15; | 71 | public static readonly int MAX_WEARABLES = 15; |
72 | // public static readonly int PHYSICS = 15; | ||
73 | // public static readonly int MAX_WEARABLES = 16; | ||
74 | |||
74 | 75 | ||
75 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | 76 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); |
76 | public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 77 | public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 2a8e67d..5beb37d 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -665,7 +665,12 @@ namespace OpenSim.Framework | |||
665 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 665 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
666 | { | 666 | { |
667 | OSDArray wears = (OSDArray)(args["wearables"]); | 667 | OSDArray wears = (OSDArray)(args["wearables"]); |
668 | for (int i = 0; i < wears.Count / 2; i++) | 668 | |
669 | int count = wears.Count; | ||
670 | if (count > AvatarWearable.MAX_WEARABLES) | ||
671 | count = AvatarWearable.MAX_WEARABLES; | ||
672 | |||
673 | for (int i = 0; i < count / 2; i++) | ||
669 | { | 674 | { |
670 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); | 675 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); |
671 | Appearance.SetWearable(i,awear); | 676 | Appearance.SetWearable(i,awear); |
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index cde2862..a890d3b 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs | |||
@@ -43,12 +43,14 @@ namespace OpenSim.Framework | |||
43 | 43 | ||
44 | public static WearableCacheItem[] GetDefaultCacheItem() | 44 | public static WearableCacheItem[] GetDefaultCacheItem() |
45 | { | 45 | { |
46 | int itemmax = 21; | 46 | int itemmax = AvatarAppearance.TEXTURE_COUNT; |
47 | WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; | 47 | WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; |
48 | for (uint i=0;i<itemmax;i++) | 48 | for (uint i=0;i<itemmax;i++) |
49 | retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i}; | 49 | retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i}; |
50 | return retitems; | 50 | return retitems; |
51 | } | 51 | } |
52 | |||
53 | |||
52 | public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) | 54 | public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) |
53 | { | 55 | { |
54 | List<WearableCacheItem> ret = new List<WearableCacheItem>(); | 56 | List<WearableCacheItem> ret = new List<WearableCacheItem>(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 2e5c58a..797ec2b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -417,9 +417,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
417 | { | 417 | { |
418 | wearableCache[idx].CacheId = cacheItems[i].CacheId; | 418 | wearableCache[idx].CacheId = cacheItems[i].CacheId; |
419 | validDirtyBakes++; | 419 | validDirtyBakes++; |
420 | hits++; | 420 | |
421 | //assuming this can only happen if asset is in cache | 421 | //assuming this can only happen if asset is in cache |
422 | } | 422 | } |
423 | hits++; | ||
423 | continue; | 424 | continue; |
424 | } | 425 | } |
425 | 426 | ||
@@ -448,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
448 | 449 | ||
449 | // if we got a full set of baked textures save all in BakedTextureModule | 450 | // if we got a full set of baked textures save all in BakedTextureModule |
450 | 451 | ||
451 | if (validDirtyBakes == cacheItems.Length) | 452 | if (validDirtyBakes > 0 && hits == cacheItems.Length) |
452 | { | 453 | { |
453 | IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | 454 | IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
454 | if (m_BakedTextureModule != null) | 455 | if (m_BakedTextureModule != null) |
@@ -493,7 +494,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
493 | 494 | ||
494 | wearableCache = WearableCacheItem.GetDefaultCacheItem(); | 495 | wearableCache = WearableCacheItem.GetDefaultCacheItem(); |
495 | 496 | ||
496 | int hits = 0; | 497 | int hits = 0; |
498 | bool gotbacked = false; | ||
499 | |||
497 | // Cache wearable data for teleport. | 500 | // Cache wearable data for teleport. |
498 | // 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 |
499 | if (bakedModule != null && cache != null) | 502 | if (bakedModule != null && cache != null) |
@@ -524,8 +527,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
524 | bakedModuleCache[i].TextureAsset.Temporary = true; | 527 | bakedModuleCache[i].TextureAsset.Temporary = true; |
525 | bakedModuleCache[i].TextureAsset.Local = true; | 528 | bakedModuleCache[i].TextureAsset.Local = true; |
526 | cache.Store(bakedModuleCache[i].TextureAsset); | 529 | cache.Store(bakedModuleCache[i].TextureAsset); |
530 | |||
527 | } | 531 | } |
528 | } | 532 | } |
533 | gotbacked = true; | ||
529 | } | 534 | } |
530 | } | 535 | } |
531 | 536 | ||
@@ -535,52 +540,74 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
535 | int idx = AvatarAppearance.BAKE_INDICES[i]; | 540 | int idx = AvatarAppearance.BAKE_INDICES[i]; |
536 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | 541 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; |
537 | 542 | ||
538 | // No face, so lets check our cache | 543 | // on tp viewer assumes servers did the cache work |
539 | if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) | 544 | // and tp propagation of baked textures is broken somewhere |
545 | // so make grid cache be mandatory | ||
546 | if (gotbacked) | ||
540 | { | 547 | { |
541 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); | 548 | // m_log.Debug("[ValidateBakedCache] bakedModule cache override"); |
542 | if (wearableCache[idx].TextureID != UUID.Zero) | 549 | if(sp.Appearance.Texture.FaceTextures[idx] == null) |
543 | { | 550 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); |
544 | sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; | 551 | sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; |
545 | face = sp.Appearance.Texture.FaceTextures[idx]; | 552 | face = sp.Appearance.Texture.FaceTextures[idx]; |
546 | // let run to end of loop to check cache | 553 | |
547 | } | 554 | // this should be removed |
548 | else | 555 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) |
549 | { | 556 | { |
550 | sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; | 557 | defonly = false; // found a non-default texture reference |
551 | face = sp.Appearance.Texture.FaceTextures[idx]; | ||
552 | // lets try not invalidating the cache entry | ||
553 | // wearableCache[idx].CacheId = UUID.Zero; | ||
554 | // wearableCache[idx].TextureAsset = null; | ||
555 | continue; | ||
556 | } | 558 | } |
557 | } | ||
558 | 559 | ||
559 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
560 | { | ||
561 | defonly = false; // found a non-default texture reference | ||
562 | continue; | 560 | continue; |
563 | } | 561 | } |
564 | 562 | else | |
565 | if(wearableCache[idx].TextureID != face.TextureID) | ||
566 | { | 563 | { |
567 | wearableCache[idx].CacheId = UUID.Zero; | 564 | // No face, so lets check our cache |
568 | wearableCache[idx].TextureID = UUID.Zero; | 565 | if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) |
569 | wearableCache[idx].TextureAsset = null; | 566 | { |
570 | continue; | 567 | sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx); |
571 | } | 568 | if (wearableCache[idx].TextureID != UUID.Zero) |
569 | { | ||
570 | sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID; | ||
571 | face = sp.Appearance.Texture.FaceTextures[idx]; | ||
572 | // let run to end of loop to check cache | ||
573 | } | ||
574 | else | ||
575 | { | ||
576 | sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
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; | ||
582 | } | ||
583 | } | ||
572 | 584 | ||
573 | wearableCache[idx].TextureAsset = null; | 585 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) |
574 | if (cache != null) | 586 | { |
575 | { | 587 | defonly = false; // found a non-default texture reference |
576 | wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); | 588 | continue; |
577 | if (wearableCache[idx].TextureAsset == null) | 589 | } |
590 | |||
591 | if (wearableCache[idx].TextureID != face.TextureID) | ||
578 | { | 592 | { |
579 | wearableCache[idx].CacheId = UUID.Zero; | 593 | wearableCache[idx].CacheId = UUID.Zero; |
580 | wearableCache[idx].TextureID = 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 | { | ||
605 | wearableCache[idx].CacheId = UUID.Zero; | ||
606 | wearableCache[idx].TextureID = UUID.Zero; | ||
607 | } | ||
608 | else | ||
609 | hits++; | ||
581 | } | 610 | } |
582 | else | ||
583 | hits++; | ||
584 | } | 611 | } |
585 | } | 612 | } |
586 | 613 | ||