XbakesModule: allow more textures, older versions will not see
parent
695821a93a
commit
7cdce3e276
|
@ -125,32 +125,49 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
using(XmlTextReader sr = new XmlTextReader(s))
|
using(XmlTextReader sr = new XmlTextReader(s))
|
||||||
{
|
{
|
||||||
sr.ReadStartElement("BakedAppearance");
|
sr.ReadStartElement("BakedAppearance");
|
||||||
while(sr.LocalName == "BakedTexture")
|
while (sr.LocalName == "BakedTexture")
|
||||||
{
|
{
|
||||||
string sTextureIndex = sr.GetAttribute("TextureIndex");
|
string sTextureIndex = sr.GetAttribute("TextureIndex");
|
||||||
int lTextureIndex = Convert.ToInt32(sTextureIndex);
|
int lTextureIndex = Convert.ToInt32(sTextureIndex);
|
||||||
string sCacheId = sr.GetAttribute("CacheId");
|
string sCacheId = sr.GetAttribute("CacheId");
|
||||||
UUID lCacheId = UUID.Zero;
|
UUID.TryParse(sCacheId, out UUID lCacheId);
|
||||||
if(!(UUID.TryParse(sCacheId,out lCacheId)))
|
|
||||||
{
|
|
||||||
// ?? Nothing here
|
|
||||||
}
|
|
||||||
|
|
||||||
sr.ReadStartElement("BakedTexture");
|
sr.ReadStartElement("BakedTexture");
|
||||||
if(sr.Name=="AssetBase")
|
if (sr.Name == "AssetBase")
|
||||||
{
|
{
|
||||||
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
|
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
|
||||||
ret.Add(new WearableCacheItem()
|
ret.Add(new WearableCacheItem()
|
||||||
{
|
{
|
||||||
CacheId = lCacheId,
|
CacheId = lCacheId,
|
||||||
TextureIndex = (uint)lTextureIndex,
|
TextureIndex = (uint)lTextureIndex,
|
||||||
TextureAsset = a,
|
TextureAsset = a,
|
||||||
TextureID = a.FullID
|
TextureID = a.FullID
|
||||||
});
|
});
|
||||||
sr.ReadEndElement();
|
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();
|
return ret.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -182,22 +199,40 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null))
|
using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null))
|
||||||
{
|
{
|
||||||
bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty);
|
bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty);
|
||||||
|
List<int> extended = new List<int>();
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
if (data[i] != null && data[i].TextureAsset != null)
|
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.WriteStartElement(String.Empty, "BakedTexture", String.Empty);
|
||||||
bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
|
bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
|
||||||
bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
|
bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
|
||||||
// if (data[i].TextureAsset != null)
|
// if (data[i].TextureAsset != null)
|
||||||
m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
|
m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
|
||||||
|
|
||||||
bakeWriter.WriteEndElement();
|
bakeWriter.WriteEndElement();
|
||||||
numberWears++;
|
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.WriteEndElement();
|
||||||
bakeWriter.Flush();
|
bakeWriter.Flush();
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue