aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorOren Hurvitz2014-07-14 10:55:57 +0300
committerOren Hurvitz2014-07-21 09:27:56 +0100
commit2d034e20c4f0fd7508cdd8780435f362cfc17890 (patch)
tree8fd7e2d334ad63478a5dcc9df87c17276995a7e7 /OpenSim
parentChanged the default XBakes directory to a local path: "./bakes". (diff)
downloadopensim-SC_OLD-2d034e20c4f0fd7508cdd8780435f362cfc17890.zip
opensim-SC_OLD-2d034e20c4f0fd7508cdd8780435f362cfc17890.tar.gz
opensim-SC_OLD-2d034e20c4f0fd7508cdd8780435f362cfc17890.tar.bz2
opensim-SC_OLD-2d034e20c4f0fd7508cdd8780435f362cfc17890.tar.xz
XBakes: store the assets only in the sim's local assets cache; not in the main assets server. Also, some cleanup.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs126
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs3
2 files changed, 39 insertions, 90 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index bd0f5ca..bfdb24f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11848,7 +11848,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11848 /// <returns></returns> 11848 /// <returns></returns>
11849 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 11849 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11850 { 11850 {
11851 //m_log.Debug("texture cached: " + packet.ToString());
11852 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 11851 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11853 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 11852 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11854 11853
@@ -11864,24 +11863,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11864 cachedresp.WearableData = 11863 cachedresp.WearableData =
11865 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; 11864 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11866 11865
11867 //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
11868 // var item = fac.GetBakedTextureFaces(AgentId);
11869 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
11870
11871 IAssetService cache = m_scene.AssetService;
11872 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11873 //bakedTextureModule = null;
11874 int maxWearablesLoop = cachedtex.WearableData.Length; 11866 int maxWearablesLoop = cachedtex.WearableData.Length;
11875 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) 11867 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
11876 maxWearablesLoop = AvatarWearable.MAX_WEARABLES; 11868 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
11877 11869
11870 // Find the cached baked textures for this user, if they're available
11871
11872 IAssetService cache = m_scene.AssetService;
11873 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11874
11875 WearableCacheItem[] cacheItems = null;
11876
11878 if (bakedTextureModule != null && cache != null) 11877 if (bakedTextureModule != null && cache != null)
11879 { 11878 {
11880 // 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
11881
11882 WearableCacheItem[] cacheItems = null;
11883 ScenePresence p = m_scene.GetScenePresence(AgentId); 11879 ScenePresence p = m_scene.GetScenePresence(AgentId);
11884 if (p.Appearance != null) 11880 if (p.Appearance != null)
11881 {
11885 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) 11882 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
11886 { 11883 {
11887 try 11884 try
@@ -11890,22 +11887,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11890 p.Appearance.WearableCacheItems = cacheItems; 11887 p.Appearance.WearableCacheItems = cacheItems;
11891 p.Appearance.WearableCacheItemsDirty = false; 11888 p.Appearance.WearableCacheItemsDirty = false;
11892 } 11889 }
11893
11894 /*
11895 * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
11896 *
11897 catch (System.Net.Sockets.SocketException)
11898 {
11899 cacheItems = null;
11900 }
11901 catch (WebException)
11902 {
11903 cacheItems = null;
11904 }
11905 catch (InvalidOperationException)
11906 {
11907 cacheItems = null;
11908 } */
11909 catch (Exception) 11890 catch (Exception)
11910 { 11891 {
11911 cacheItems = null; 11892 cacheItems = null;
@@ -11916,87 +11897,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11916 { 11897 {
11917 cacheItems = p.Appearance.WearableCacheItems; 11898 cacheItems = p.Appearance.WearableCacheItems;
11918 } 11899 }
11900 }
11901 }
11919 11902
11920 if (cache != null && cacheItems != null) 11903 if (cacheItems != null)
11904 {
11905 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
11906 // Copy the baked textures to the sim's assets cache (local only).
11907 foreach (WearableCacheItem item in cacheItems)
11921 { 11908 {
11922 foreach (WearableCacheItem item in cacheItems) 11909 if (cache.GetCached(item.TextureID.ToString()) == null)
11923 { 11910 {
11924 11911 item.TextureAsset.Temporary = true;
11925 if (cache.GetCached(item.TextureID.ToString()) == null) 11912 item.TextureAsset.Local = true;
11926 { 11913 cache.Store(item.TextureAsset);
11927 item.TextureAsset.Temporary = true;
11928 cache.Store(item.TextureAsset);
11929 }
11930
11931
11932 } 11914 }
11933 } 11915 }
11934 if (cacheItems != null) 11916
11917 // Return the cached textures
11918 for (int i = 0; i < maxWearablesLoop; i++)
11935 { 11919 {
11920 WearableCacheItem item =
11921 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
11936 11922
11937 for (int i = 0; i < maxWearablesLoop; i++) 11923 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11924 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11925 cachedresp.WearableData[i].HostName = new byte[0];
11926 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11938 { 11927 {
11939 WearableCacheItem item = 11928 cachedresp.WearableData[i].TextureID = item.TextureID;
11940 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
11941
11942 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11943 cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
11944 cachedresp.WearableData[i].HostName = new byte[0];
11945 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11946 {
11947
11948 cachedresp.WearableData[i].TextureID = item.TextureID;
11949 }
11950 else
11951 {
11952 cachedresp.WearableData[i].TextureID = UUID.Zero;
11953 }
11954 } 11929 }
11955 } 11930 else
11956 else
11957 {
11958 for (int i = 0; i < maxWearablesLoop; i++)
11959 { 11931 {
11960 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11961 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11962 cachedresp.WearableData[i].TextureID = UUID.Zero; 11932 cachedresp.WearableData[i].TextureID = UUID.Zero;
11963 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11964 cachedresp.WearableData[i].HostName = new byte[0];
11965 } 11933 }
11966 } 11934 }
11967 } 11935 }
11968 else 11936 else
11969 { 11937 {
11970 if (cache == null) 11938 // Cached textures not available
11939 for (int i = 0; i < maxWearablesLoop; i++)
11971 { 11940 {
11972 for (int i = 0; i < maxWearablesLoop; i++) 11941 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11973 { 11942 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11974 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 11943 cachedresp.WearableData[i].TextureID = UUID.Zero;
11975 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 11944 cachedresp.WearableData[i].HostName = new byte[0];
11976 cachedresp.WearableData[i].TextureID = UUID.Zero;
11977 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11978 cachedresp.WearableData[i].HostName = new byte[0];
11979 }
11980 }
11981 else
11982 {
11983 for (int i = 0; i < maxWearablesLoop; i++)
11984 {
11985 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11986 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11987
11988
11989
11990 if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
11991 cachedresp.WearableData[i].TextureID = UUID.Zero;
11992 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11993 else
11994 cachedresp.WearableData[i].TextureID = UUID.Zero;
11995 // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11996 cachedresp.WearableData[i].HostName = new byte[0];
11997 }
11998 } 11945 }
11999 } 11946 }
11947
12000 cachedresp.Header.Zerocoded = true; 11948 cachedresp.Header.Zerocoded = true;
12001 OutPacket(cachedresp, ThrottleOutPacketType.Task); 11949 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12002 11950
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index 780d17b..5725d67 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
135 135
136 sr.ReadEndElement(); 136 sr.ReadEndElement();
137 } 137 }
138 m_log.DebugFormat("[XBakes]: Ended reading"); 138 m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
139 sr.Close(); 139 sr.Close();
140 s.Close(); 140 s.Close();
141 141
@@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
186 delegate 186 delegate
187 { 187 {
188 rc.Request(reqStream, m_Auth); 188 rc.Request(reqStream, m_Auth);
189 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
189 } 190 }
190 ); 191 );
191 } 192 }