diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 153 |
1 files changed, 38 insertions, 115 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 34a2797..e9a087b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3684,6 +3684,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3684 | avp.Sender.IsTrial = false; | 3684 | avp.Sender.IsTrial = false; |
3685 | avp.Sender.ID = agentID; | 3685 | avp.Sender.ID = agentID; |
3686 | avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; | 3686 | avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; |
3687 | |||
3688 | // this need be use in future | ||
3689 | // avp.AppearanceData[0].AppearanceVersion = 0; | ||
3690 | // avp.AppearanceData[0].CofVersion = 0; | ||
3691 | |||
3687 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); | 3692 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); |
3688 | OutPacket(avp, ThrottleOutPacketType.Task); | 3693 | OutPacket(avp, ThrottleOutPacketType.Task); |
3689 | } | 3694 | } |
@@ -6535,7 +6540,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6535 | 6540 | ||
6536 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; | 6541 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; |
6537 | for (int i=0; i<appear.WearableData.Length;i++) | 6542 | for (int i=0; i<appear.WearableData.Length;i++) |
6538 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; | 6543 | cacheitems[i] = new WearableCacheItem(){ |
6544 | CacheId = appear.WearableData[i].CacheID, | ||
6545 | TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex) | ||
6546 | }; | ||
6539 | 6547 | ||
6540 | 6548 | ||
6541 | 6549 | ||
@@ -12004,150 +12012,65 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12004 | 12012 | ||
12005 | if (cachedtex.AgentData.SessionID != SessionId) | 12013 | if (cachedtex.AgentData.SessionID != SessionId) |
12006 | return false; | 12014 | return false; |
12007 | |||
12008 | 12015 | ||
12009 | // TODO: don't create new blocks if recycling an old packet | 12016 | // TODO: don't create new blocks if recycling an old packet |
12010 | cachedresp.AgentData.AgentID = AgentId; | 12017 | cachedresp.AgentData.AgentID = AgentId; |
12011 | cachedresp.AgentData.SessionID = m_sessionId; | 12018 | cachedresp.AgentData.SessionID = m_sessionId; |
12012 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | 12019 | cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; |
12013 | m_cachedTextureSerial++; | ||
12014 | cachedresp.WearableData = | 12020 | cachedresp.WearableData = |
12015 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | 12021 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; |
12016 | 12022 | ||
12017 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
12018 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
12019 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
12020 | |||
12021 | IAssetService cache = m_scene.AssetService; | ||
12022 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
12023 | //bakedTextureModule = null; | ||
12024 | int maxWearablesLoop = cachedtex.WearableData.Length; | 12023 | int maxWearablesLoop = cachedtex.WearableData.Length; |
12025 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | 12024 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) |
12026 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | 12025 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; |
12027 | 12026 | ||
12028 | if (bakedTextureModule != null && cache != null) | 12027 | int cacheHits = 0; |
12029 | { | ||
12030 | // 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 | ||
12031 | 12028 | ||
12032 | WearableCacheItem[] cacheItems = null; | 12029 | // 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 |
12033 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
12034 | if (p.Appearance != null) | ||
12035 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
12036 | { | ||
12037 | try | ||
12038 | { | ||
12039 | cacheItems = bakedTextureModule.Get(AgentId); | ||
12040 | p.Appearance.WearableCacheItems = cacheItems; | ||
12041 | p.Appearance.WearableCacheItemsDirty = false; | ||
12042 | } | ||
12043 | 12030 | ||
12044 | /* | 12031 | WearableCacheItem[] cacheItems = null; |
12045 | * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! | ||
12046 | * | ||
12047 | catch (System.Net.Sockets.SocketException) | ||
12048 | { | ||
12049 | cacheItems = null; | ||
12050 | } | ||
12051 | catch (WebException) | ||
12052 | { | ||
12053 | cacheItems = null; | ||
12054 | } | ||
12055 | catch (InvalidOperationException) | ||
12056 | { | ||
12057 | cacheItems = null; | ||
12058 | } */ | ||
12059 | catch (Exception) | ||
12060 | { | ||
12061 | cacheItems = null; | ||
12062 | } | ||
12063 | |||
12064 | } | ||
12065 | else if (p.Appearance.WearableCacheItems != null) | ||
12066 | { | ||
12067 | cacheItems = p.Appearance.WearableCacheItems; | ||
12068 | } | ||
12069 | 12032 | ||
12070 | if (cache != null && cacheItems != null) | 12033 | ScenePresence p = m_scene.GetScenePresence(AgentId); |
12071 | { | ||
12072 | foreach (WearableCacheItem item in cacheItems) | ||
12073 | { | ||
12074 | |||
12075 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
12076 | { | ||
12077 | item.TextureAsset.Temporary = true; | ||
12078 | cache.Store(item.TextureAsset); | ||
12079 | } | ||
12080 | 12034 | ||
12035 | if (p != null && p.Appearance != null) | ||
12036 | { | ||
12037 | cacheItems = p.Appearance.WearableCacheItems; | ||
12038 | } | ||
12081 | 12039 | ||
12082 | } | 12040 | if (cacheItems != null) |
12083 | } | 12041 | { |
12084 | 12042 | for (int i = 0; i < maxWearablesLoop; i++) | |
12085 | if (cacheItems != null) | ||
12086 | { | 12043 | { |
12087 | 12044 | int idx = cachedtex.WearableData[i].TextureIndex; | |
12088 | for (int i = 0; i < maxWearablesLoop; i++) | ||
12089 | { | ||
12090 | WearableCacheItem item = | ||
12091 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
12092 | 12045 | ||
12093 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12046 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
12094 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | 12047 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
12095 | cachedresp.WearableData[i].HostName = new byte[0]; | 12048 | cachedresp.WearableData[i].HostName = new byte[0]; |
12096 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | 12049 | if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) |
12097 | { | 12050 | { |
12098 | 12051 | cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; | |
12099 | cachedresp.WearableData[i].TextureID = item.TextureID; | 12052 | cacheHits++; |
12100 | } | ||
12101 | else | ||
12102 | { | ||
12103 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
12104 | } | ||
12105 | } | 12053 | } |
12106 | } | 12054 | else |
12107 | else | ||
12108 | { | ||
12109 | for (int i = 0; i < maxWearablesLoop; i++) | ||
12110 | { | 12055 | { |
12111 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
12112 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
12113 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 12056 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
12114 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12115 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
12116 | } | 12057 | } |
12117 | } | 12058 | } |
12118 | } | 12059 | } |
12119 | else | 12060 | else |
12120 | { | 12061 | { |
12121 | if (cache == null) | 12062 | for (int i = 0; i < maxWearablesLoop; i++) |
12122 | { | 12063 | { |
12123 | for (int i = 0; i < maxWearablesLoop; i++) | 12064 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
12124 | { | 12065 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
12125 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12066 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
12126 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 12067 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); |
12127 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 12068 | cachedresp.WearableData[i].HostName = new byte[0]; |
12128 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12129 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
12130 | } | ||
12131 | } | 12069 | } |
12132 | else | 12070 | } |
12133 | { | ||
12134 | for (int i = 0; i < maxWearablesLoop; i++) | ||
12135 | { | ||
12136 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
12137 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
12138 | |||
12139 | 12071 | ||
12072 | m_log.DebugFormat("texture cached: hits {0}", cacheHits); | ||
12140 | 12073 | ||
12141 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) | ||
12142 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
12143 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12144 | else | ||
12145 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
12146 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12147 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
12148 | } | ||
12149 | } | ||
12150 | } | ||
12151 | cachedresp.Header.Zerocoded = true; | 12074 | cachedresp.Header.Zerocoded = true; |
12152 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | 12075 | OutPacket(cachedresp, ThrottleOutPacketType.Task); |
12153 | 12076 | ||