Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
eed15703ed
|
@ -173,11 +173,14 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
OSDMap GetMaterial(UUID id)
|
OSDMap GetMaterial(UUID id)
|
||||||
{
|
{
|
||||||
OSDMap map = null;
|
OSDMap map = null;
|
||||||
if (m_knownMaterials.ContainsKey(id))
|
lock (m_knownMaterials)
|
||||||
{
|
{
|
||||||
map = new OSDMap();
|
if (m_knownMaterials.ContainsKey(id))
|
||||||
map["ID"] = OSD.FromBinary(id.GetBytes());
|
{
|
||||||
map["Material"] = m_knownMaterials[id];
|
map = new OSDMap();
|
||||||
|
map["ID"] = OSD.FromBinary(id.GetBytes());
|
||||||
|
map["Material"] = m_knownMaterials[id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +230,8 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"];
|
lock (m_knownMaterials)
|
||||||
|
m_knownMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"];
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -251,8 +255,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
|
|
||||||
if (te.DefaultTexture != null)
|
if (te.DefaultTexture != null)
|
||||||
{
|
{
|
||||||
if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID))
|
lock (m_knownMaterials)
|
||||||
mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID];
|
{
|
||||||
|
if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID))
|
||||||
|
mats[te.DefaultTexture.MaterialID] = m_knownMaterials[te.DefaultTexture.MaterialID];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (te.FaceTextures != null)
|
if (te.FaceTextures != null)
|
||||||
|
@ -261,8 +268,11 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
{
|
{
|
||||||
if (face != null)
|
if (face != null)
|
||||||
{
|
{
|
||||||
if (m_knownMaterials.ContainsKey(face.MaterialID))
|
lock (m_knownMaterials)
|
||||||
mats[face.MaterialID] = m_knownMaterials[face.MaterialID];
|
{
|
||||||
|
if (m_knownMaterials.ContainsKey(face.MaterialID))
|
||||||
|
mats[face.MaterialID] = m_knownMaterials[face.MaterialID];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,17 +334,20 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
{
|
{
|
||||||
UUID id = new UUID(elem.AsBinary(), 0);
|
UUID id = new UUID(elem.AsBinary(), 0);
|
||||||
|
|
||||||
if (m_knownMaterials.ContainsKey(id))
|
lock (m_knownMaterials)
|
||||||
{
|
{
|
||||||
m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString());
|
if (m_knownMaterials.ContainsKey(id))
|
||||||
OSDMap matMap = new OSDMap();
|
{
|
||||||
matMap["ID"] = OSD.FromBinary(id.GetBytes());
|
m_log.Info("[MaterialsDemoModule]: request for known material ID: " + id.ToString());
|
||||||
|
OSDMap matMap = new OSDMap();
|
||||||
|
matMap["ID"] = OSD.FromBinary(id.GetBytes());
|
||||||
|
|
||||||
matMap["Material"] = m_knownMaterials[id];
|
matMap["Material"] = m_knownMaterials[id];
|
||||||
respArr.Add(matMap);
|
respArr.Add(matMap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
m_log.Info("[MaterialsDemoModule]: request for UNKNOWN material ID: " + id.ToString());
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -372,7 +385,8 @@ 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);
|
||||||
m_knownMaterials[id] = mat;
|
lock (m_knownMaterials)
|
||||||
|
m_knownMaterials[id] = mat;
|
||||||
|
|
||||||
|
|
||||||
var sop = m_scene.GetSceneObjectPart(matLocalID);
|
var sop = m_scene.GetSceneObjectPart(matLocalID);
|
||||||
|
@ -480,24 +494,22 @@ 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();
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, OSDMap> kvp in m_knownMaterials)
|
lock (m_knownMaterials)
|
||||||
{
|
{
|
||||||
OSDMap matMap = new OSDMap();
|
foreach (KeyValuePair<UUID, OSDMap> kvp in m_knownMaterials)
|
||||||
|
{
|
||||||
|
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