XbakesModule: allow more textures, older versions will not see

0.9.1.0-post-fixes
UbitUmarov 2019-08-31 15:01:15 +01:00
parent 695821a93a
commit 7cdce3e276
2 changed files with 48 additions and 13 deletions

View File

@ -125,32 +125,49 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
using(XmlTextReader sr = new XmlTextReader(s))
{
sr.ReadStartElement("BakedAppearance");
while(sr.LocalName == "BakedTexture")
while (sr.LocalName == "BakedTexture")
{
string sTextureIndex = sr.GetAttribute("TextureIndex");
int lTextureIndex = Convert.ToInt32(sTextureIndex);
string sCacheId = sr.GetAttribute("CacheId");
UUID lCacheId = UUID.Zero;
if(!(UUID.TryParse(sCacheId,out lCacheId)))
{
// ?? Nothing here
}
UUID.TryParse(sCacheId, out UUID lCacheId);
sr.ReadStartElement("BakedTexture");
if(sr.Name=="AssetBase")
if (sr.Name == "AssetBase")
{
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
ret.Add(new WearableCacheItem()
{
{
CacheId = lCacheId,
TextureIndex = (uint)lTextureIndex,
TextureAsset = a,
TextureID = a.FullID
});
});
sr.ReadEndElement();
}
}
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}",ret.Count,id);
while (sr.LocalName == "BESetA")
{
string sTextureIndex = sr.GetAttribute("TextureIndex");
int lTextureIndex = Convert.ToInt32(sTextureIndex);
string sCacheId = sr.GetAttribute("CacheId");
UUID.TryParse(sCacheId, out UUID lCacheId);
sr.ReadStartElement("BESetA");
if (sr.Name == "AssetBase")
{
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
ret.Add(new WearableCacheItem()
{
CacheId = lCacheId,
TextureIndex = (uint)lTextureIndex,
TextureAsset = a,
TextureID = a.FullID
});
sr.ReadEndElement();
}
}
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}",ret.Count,id);
}
return ret.ToArray();
}
@ -182,22 +199,40 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null))
{
bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty);
List<int> extended = new List<int>();
for (int i = 0; i < data.Length; i++)
{
if (data[i] != null && data[i].TextureAsset != null)
{
if(data[i].TextureIndex > 26)
{
extended.Add(i);
continue;
}
bakeWriter.WriteStartElement(String.Empty, "BakedTexture", String.Empty);
bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
// if (data[i].TextureAsset != null)
m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
// if (data[i].TextureAsset != null)
m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
bakeWriter.WriteEndElement();
numberWears++;
}
}
if(extended.Count > 0)
{
foreach(int i in extended)
{
bakeWriter.WriteStartElement(String.Empty, "BESetA", String.Empty);
bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
bakeWriter.WriteEndElement();
numberWears++;
}
}
bakeWriter.WriteEndElement();
bakeWriter.Flush();

Binary file not shown.