Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

cpu-performance
Justin Clark-Casey (justincc) 2013-06-28 23:35:44 +01:00
commit eed15703ed
1 changed files with 43 additions and 31 deletions

View File

@ -173,12 +173,15 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
OSDMap GetMaterial(UUID id)
{
OSDMap map = null;
lock (m_knownMaterials)
{
if (m_knownMaterials.ContainsKey(id))
{
map = new OSDMap();
map["ID"] = OSD.FromBinary(id.GetBytes());
map["Material"] = m_knownMaterials[id];
}
}
return map;
}
@ -227,6 +230,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
{
try
{
lock (m_knownMaterials)
m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"];
}
catch (Exception e)
@ -250,22 +254,28 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
Primitive.TextureEntry te = part.Shape.Textures;
if (te.DefaultTexture != null)
{
lock (m_knownMaterials)
{
if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID))
mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID];
}
}
if (te.FaceTextures != null)
{
foreach (var face in te.FaceTextures)
{
if (face != null)
{
lock (m_knownMaterials)
{
if (m_knownMaterials.ContainsKey(face.MaterialID))
mats[face.MaterialID] = m_knownMaterials[face.MaterialID];
}
}
}
}
if (mats.Count == 0)
return;
@ -324,6 +334,8 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
{
UUID id = new UUID(elem.AsBinary(), 0);
lock (m_knownMaterials)
{
if (m_knownMaterials.ContainsKey(id))
{
m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString());
@ -336,6 +348,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
else
m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString());
}
}
catch (Exception e)
{
// report something here?
@ -372,6 +385,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
m_log.Debug("[MaterialsDemoModule]: mat: " + OSDParser.SerializeJsonString(mat));
UUID id = HashOsd(mat);
lock (m_knownMaterials)
m_knownMaterials[id] = mat;
@ -480,23 +494,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
m_log.Debug("[MaterialsDemoModule]: GET cap handler");
OSDMap resp = new OSDMap();
int matsCount = 0;
OSDArray allOsd = new OSDArray();
lock (m_knownMaterials)
{
foreach (KeyValuePair<UUID, OSDMap> kvp in m_knownMaterials)
{
OSDMap matMap = new OSDMap();
matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes());
matMap["Material"] = kvp.Value;
allOsd.Add(matMap);
matsCount++;
}
}
resp["Zipped"] = ZCompressOSD(allOsd, false);
m_log.Debug("[MaterialsDemoModule]: matsCount: " + matsCount.ToString());