diff options
author | teravus | 2012-12-29 08:53:58 -0500 |
---|---|---|
committer | teravus | 2012-12-29 08:53:58 -0500 |
commit | 6797ac14741851efa5ba60a00891e18cf7755c80 (patch) | |
tree | b2b9b4870100f12d59d3bcd257349051fdede2d4 /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |
parent | bug fix, cleanup... (diff) | |
download | opensim-SC-6797ac14741851efa5ba60a00891e18cf7755c80.zip opensim-SC-6797ac14741851efa5ba60a00891e18cf7755c80.tar.gz opensim-SC-6797ac14741851efa5ba60a00891e18cf7755c80.tar.bz2 opensim-SC-6797ac14741851efa5ba60a00891e18cf7755c80.tar.xz |
* This finishes the implementation of AgentCachedTexture. Requires the XBakes Module and service for full functionality. Previous no-cache functionality works without the service and module. In some ways, I would have been happier not putting an AssetBase in WearableCacheItem.. but turns out it was probably unavoidable. No additional locks, yay.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 110 |
1 files changed, 94 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d18b026..9e39699 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3629,7 +3629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3629 | 3629 | ||
3630 | avp.Sender.IsTrial = false; | 3630 | avp.Sender.IsTrial = false; |
3631 | avp.Sender.ID = agentID; | 3631 | avp.Sender.ID = agentID; |
3632 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); | 3632 | m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); |
3633 | OutPacket(avp, ThrottleOutPacketType.State); | 3633 | OutPacket(avp, ThrottleOutPacketType.State); |
3634 | } | 3634 | } |
3635 | 3635 | ||
@@ -11725,32 +11725,110 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11725 | // var item = fac.GetBakedTextureFaces(AgentId); | 11725 | // var item = fac.GetBakedTextureFaces(AgentId); |
11726 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | 11726 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); |
11727 | 11727 | ||
11728 | IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | 11728 | IAssetService cache = m_scene.AssetService; |
11729 | if (cache == null) | 11729 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
11730 | if (bakedTextureModule != null && cache != null) | ||
11730 | { | 11731 | { |
11731 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | 11732 | // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid |
11733 | |||
11734 | WearableCacheItem[] cacheItems = null; | ||
11735 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
11736 | if (p.Appearance != null) | ||
11737 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
11738 | { | ||
11739 | try | ||
11740 | { | ||
11741 | cacheItems = bakedTextureModule.Get(AgentId); | ||
11742 | p.Appearance.WearableCacheItems = cacheItems; | ||
11743 | p.Appearance.WearableCacheItemsDirty = false; | ||
11744 | } | ||
11745 | catch (InvalidOperationException) | ||
11746 | { | ||
11747 | cacheItems = null; | ||
11748 | } | ||
11749 | } | ||
11750 | else if (p.Appearance.WearableCacheItems != null) | ||
11751 | { | ||
11752 | cacheItems = p.Appearance.WearableCacheItems; | ||
11753 | } | ||
11754 | |||
11755 | if (cache != null && cacheItems != null) | ||
11756 | { | ||
11757 | foreach (WearableCacheItem item in cacheItems) | ||
11758 | { | ||
11759 | |||
11760 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
11761 | { | ||
11762 | item.TextureAsset.Temporary = true; | ||
11763 | cache.Store(item.TextureAsset); | ||
11764 | } | ||
11765 | |||
11766 | |||
11767 | } | ||
11768 | } | ||
11769 | if (cacheItems != null) | ||
11770 | { | ||
11771 | |||
11772 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | ||
11773 | { | ||
11774 | WearableCacheItem item = | ||
11775 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
11776 | |||
11777 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11778 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | ||
11779 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11780 | if (item != null) | ||
11781 | { | ||
11782 | cachedresp.WearableData[i].TextureID = item.TextureID; | ||
11783 | } | ||
11784 | else | ||
11785 | { | ||
11786 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11787 | } | ||
11788 | } | ||
11789 | } | ||
11790 | else | ||
11732 | { | 11791 | { |
11733 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 11792 | for (int i = 0; i < cachedtex.WearableData.Length; i++) |
11734 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 11793 | { |
11735 | cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | 11794 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
11736 | cachedresp.WearableData[i].HostName = new byte[0]; | 11795 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
11796 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11797 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11798 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11799 | } | ||
11737 | } | 11800 | } |
11738 | } | 11801 | } |
11739 | else | 11802 | else |
11740 | { | 11803 | { |
11741 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | 11804 | if (cache == null) |
11805 | { | ||
11806 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | ||
11807 | { | ||
11808 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11809 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11810 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11811 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11812 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11813 | } | ||
11814 | } | ||
11815 | else | ||
11742 | { | 11816 | { |
11743 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 11817 | for (int i = 0; i < cachedtex.WearableData.Length; i++) |
11744 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 11818 | { |
11819 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11820 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11745 | 11821 | ||
11746 | 11822 | ||
11747 | 11823 | ||
11748 | if (cache.Check(cachedtex.WearableData[i].ID.ToString())) | 11824 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) |
11749 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 11825 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
11750 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | 11826 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); |
11751 | else | 11827 | else |
11752 | cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | 11828 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
11753 | cachedresp.WearableData[i].HostName = new byte[0]; | 11829 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); |
11830 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11831 | } | ||
11754 | } | 11832 | } |
11755 | } | 11833 | } |
11756 | cachedresp.Header.Zerocoded = true; | 11834 | cachedresp.Header.Zerocoded = true; |