diff options
author | UbitUmarov | 2019-08-31 15:01:15 +0100 |
---|---|---|
committer | UbitUmarov | 2019-08-31 15:01:15 +0100 |
commit | 7cdce3e276c66de26cd12b9d6bd51976e1e41462 (patch) | |
tree | 4f802c7b648e841a2535dba9226f6a476a1c49ea /OpenSim/Region/CoreModules/Avatar/BakedTextures | |
parent | update httpserver.dll reverting a change win does not seem to like (diff) | |
download | opensim-SC-7cdce3e276c66de26cd12b9d6bd51976e1e41462.zip opensim-SC-7cdce3e276c66de26cd12b9d6bd51976e1e41462.tar.gz opensim-SC-7cdce3e276c66de26cd12b9d6bd51976e1e41462.tar.bz2 opensim-SC-7cdce3e276c66de26cd12b9d6bd51976e1e41462.tar.xz |
XbakesModule: allow more textures, older versions will not see
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/BakedTextures')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index cfa9581..b9f9298 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs | |||
@@ -125,32 +125,49 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
125 | using(XmlTextReader sr = new XmlTextReader(s)) | 125 | using(XmlTextReader sr = new XmlTextReader(s)) |
126 | { | 126 | { |
127 | sr.ReadStartElement("BakedAppearance"); | 127 | sr.ReadStartElement("BakedAppearance"); |
128 | while(sr.LocalName == "BakedTexture") | 128 | while (sr.LocalName == "BakedTexture") |
129 | { | 129 | { |
130 | string sTextureIndex = sr.GetAttribute("TextureIndex"); | 130 | string sTextureIndex = sr.GetAttribute("TextureIndex"); |
131 | int lTextureIndex = Convert.ToInt32(sTextureIndex); | 131 | int lTextureIndex = Convert.ToInt32(sTextureIndex); |
132 | string sCacheId = sr.GetAttribute("CacheId"); | 132 | string sCacheId = sr.GetAttribute("CacheId"); |
133 | UUID lCacheId = UUID.Zero; | 133 | UUID.TryParse(sCacheId, out UUID lCacheId); |
134 | if(!(UUID.TryParse(sCacheId,out lCacheId))) | 134 | |
135 | sr.ReadStartElement("BakedTexture"); | ||
136 | if (sr.Name == "AssetBase") | ||
135 | { | 137 | { |
136 | // ?? Nothing here | 138 | AssetBase a = (AssetBase)m_serializer.Deserialize(sr); |
139 | ret.Add(new WearableCacheItem() | ||
140 | { | ||
141 | CacheId = lCacheId, | ||
142 | TextureIndex = (uint)lTextureIndex, | ||
143 | TextureAsset = a, | ||
144 | TextureID = a.FullID | ||
145 | }); | ||
146 | sr.ReadEndElement(); | ||
137 | } | 147 | } |
148 | } | ||
149 | while (sr.LocalName == "BESetA") | ||
150 | { | ||
151 | string sTextureIndex = sr.GetAttribute("TextureIndex"); | ||
152 | int lTextureIndex = Convert.ToInt32(sTextureIndex); | ||
153 | string sCacheId = sr.GetAttribute("CacheId"); | ||
154 | UUID.TryParse(sCacheId, out UUID lCacheId); | ||
138 | 155 | ||
139 | sr.ReadStartElement("BakedTexture"); | 156 | sr.ReadStartElement("BESetA"); |
140 | if(sr.Name=="AssetBase") | 157 | if (sr.Name == "AssetBase") |
141 | { | 158 | { |
142 | AssetBase a = (AssetBase)m_serializer.Deserialize(sr); | 159 | AssetBase a = (AssetBase)m_serializer.Deserialize(sr); |
143 | ret.Add(new WearableCacheItem() | 160 | ret.Add(new WearableCacheItem() |
144 | { | 161 | { |
145 | CacheId = lCacheId, | 162 | CacheId = lCacheId, |
146 | TextureIndex = (uint)lTextureIndex, | 163 | TextureIndex = (uint)lTextureIndex, |
147 | TextureAsset = a, | 164 | TextureAsset = a, |
148 | TextureID = a.FullID | 165 | TextureID = a.FullID |
149 | }); | 166 | }); |
150 | sr.ReadEndElement(); | 167 | sr.ReadEndElement(); |
151 | } | 168 | } |
152 | } | 169 | } |
153 | m_log.DebugFormat("[XBakes]: read {0} textures for user {1}",ret.Count,id); | 170 | m_log.DebugFormat("[XBakes]: read {0} textures for user {1}",ret.Count,id); |
154 | } | 171 | } |
155 | return ret.ToArray(); | 172 | return ret.ToArray(); |
156 | } | 173 | } |
@@ -182,22 +199,40 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
182 | using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null)) | 199 | using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null)) |
183 | { | 200 | { |
184 | bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty); | 201 | bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty); |
185 | 202 | List<int> extended = new List<int>(); | |
186 | for (int i = 0; i < data.Length; i++) | 203 | for (int i = 0; i < data.Length; i++) |
187 | { | 204 | { |
188 | if (data[i] != null && data[i].TextureAsset != null) | 205 | if (data[i] != null && data[i].TextureAsset != null) |
189 | { | 206 | { |
207 | if(data[i].TextureIndex > 26) | ||
208 | { | ||
209 | extended.Add(i); | ||
210 | continue; | ||
211 | } | ||
190 | bakeWriter.WriteStartElement(String.Empty, "BakedTexture", String.Empty); | 212 | bakeWriter.WriteStartElement(String.Empty, "BakedTexture", String.Empty); |
191 | bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString()); | 213 | bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString()); |
192 | bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString()); | 214 | bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString()); |
193 | // if (data[i].TextureAsset != null) | 215 | // if (data[i].TextureAsset != null) |
194 | m_serializer.Serialize(bakeWriter, data[i].TextureAsset); | 216 | m_serializer.Serialize(bakeWriter, data[i].TextureAsset); |
195 | 217 | ||
196 | bakeWriter.WriteEndElement(); | 218 | bakeWriter.WriteEndElement(); |
197 | numberWears++; | 219 | numberWears++; |
198 | } | 220 | } |
199 | } | 221 | } |
200 | 222 | ||
223 | if(extended.Count > 0) | ||
224 | { | ||
225 | foreach(int i in extended) | ||
226 | { | ||
227 | bakeWriter.WriteStartElement(String.Empty, "BESetA", String.Empty); | ||
228 | bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString()); | ||
229 | bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString()); | ||
230 | m_serializer.Serialize(bakeWriter, data[i].TextureAsset); | ||
231 | bakeWriter.WriteEndElement(); | ||
232 | numberWears++; | ||
233 | } | ||
234 | } | ||
235 | |||
201 | bakeWriter.WriteEndElement(); | 236 | bakeWriter.WriteEndElement(); |
202 | bakeWriter.Flush(); | 237 | bakeWriter.Flush(); |
203 | 238 | ||