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