make bakes reception handle empty BakedTexture elements. But at same time stop sending them, only sending to Xbakes server items that do have a texture, like master does
parent
2abe1ccc59
commit
6bc479fecd
|
@ -101,8 +101,6 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
if (m_URL == String.Empty)
|
if (m_URL == String.Empty)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int size = 0;
|
|
||||||
|
|
||||||
using (RestClient rc = new RestClient(m_URL))
|
using (RestClient rc = new RestClient(m_URL))
|
||||||
{
|
{
|
||||||
List<WearableCacheItem> ret = new List<WearableCacheItem>();
|
List<WearableCacheItem> ret = new List<WearableCacheItem>();
|
||||||
|
@ -113,35 +111,34 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Stream s = rc.Request(m_Auth);
|
using(Stream s = rc.Request(m_Auth))
|
||||||
|
|
||||||
using (XmlTextReader sr = new XmlTextReader(s))
|
|
||||||
{
|
{
|
||||||
sr.ReadStartElement("BakedAppearance");
|
using(XmlTextReader sr = new XmlTextReader(s))
|
||||||
while (sr.LocalName == "BakedTexture")
|
|
||||||
{
|
{
|
||||||
string sTextureIndex = sr.GetAttribute("TextureIndex");
|
sr.ReadStartElement("BakedAppearance");
|
||||||
int lTextureIndex = Convert.ToInt32(sTextureIndex);
|
while(sr.LocalName == "BakedTexture")
|
||||||
string sCacheId = sr.GetAttribute("CacheId");
|
|
||||||
UUID lCacheId = UUID.Zero;
|
|
||||||
if (!(UUID.TryParse(sCacheId, out lCacheId)))
|
|
||||||
{
|
{
|
||||||
|
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
|
// ?? Nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
sr.ReadStartElement("BakedTexture");
|
||||||
|
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);
|
||||||
++size;
|
|
||||||
|
|
||||||
sr.ReadStartElement("BakedTexture");
|
|
||||||
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
|
|
||||||
ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
|
|
||||||
|
|
||||||
sr.ReadEndElement();
|
|
||||||
}
|
}
|
||||||
|
return ret.ToArray();
|
||||||
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
}
|
||||||
catch (XmlException)
|
catch (XmlException)
|
||||||
{
|
{
|
||||||
|
@ -153,16 +150,17 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
public void Store(UUID agentId)
|
public void Store(UUID agentId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateMeshAvatar(UUID agentId)
|
public void UpdateMeshAvatar(UUID agentId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Store(UUID agentId, WearableCacheItem[] data)
|
public void Store(UUID agentId, WearableCacheItem[] data)
|
||||||
{
|
{
|
||||||
if (m_URL == String.Empty)
|
if (m_URL == String.Empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int numberWears = 0;
|
||||||
MemoryStream reqStream;
|
MemoryStream reqStream;
|
||||||
|
|
||||||
using (MemoryStream bakeStream = new MemoryStream())
|
using (MemoryStream bakeStream = new MemoryStream())
|
||||||
|
@ -172,15 +170,16 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
|
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
if (data[i] != null)
|
if (data[i] != null && data[i].TextureAsset != null)
|
||||||
{
|
{
|
||||||
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,17 +189,18 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
reqStream = new MemoryStream(bakeStream.ToArray());
|
reqStream = new MemoryStream(bakeStream.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
RestClient rc = new RestClient(m_URL);
|
|
||||||
rc.AddResourcePath("bakes");
|
|
||||||
rc.AddResourcePath(agentId.ToString());
|
|
||||||
|
|
||||||
rc.RequestMethod = "POST";
|
|
||||||
|
|
||||||
Util.FireAndForget(
|
Util.FireAndForget(
|
||||||
delegate
|
delegate
|
||||||
{
|
{
|
||||||
rc.Request(reqStream, m_Auth);
|
using(RestClient rc = new RestClient(m_URL))
|
||||||
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
|
{
|
||||||
|
rc.AddResourcePath("bakes");
|
||||||
|
rc.AddResourcePath(agentId.ToString());
|
||||||
|
rc.RequestMethod = "POST";
|
||||||
|
|
||||||
|
rc.Request(reqStream, m_Auth);
|
||||||
|
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
|
||||||
|
}
|
||||||
}, null, "XBakesModule.Store"
|
}, null, "XBakesModule.Store"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue