mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
a few test changes
This commit is contained in:
@@ -334,9 +334,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
oreq = new SimpleOSDMapHandler("POST", GetNewCapPath(), UpdateGestureItemAsset);
|
||||
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureAgentInventory", oreq, true);
|
||||
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureTaskInventory", oreq, false);
|
||||
|
||||
m_HostCapsObj.RegisterSimpleHandler("ModifyMaterialParams",
|
||||
new SimpleStreamHandler(GetNewCapPath(), ModifyMaterialParams), true);
|
||||
}
|
||||
|
||||
if (TaskScriptUpdatedCall != null)
|
||||
@@ -2712,89 +2709,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
}
|
||||
public void ModifyMaterialParams(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.HttpMethod != "POST")
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
OSDArray req;
|
||||
try
|
||||
{
|
||||
req = (OSDArray)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||
OSD tmp;
|
||||
foreach (OSDMap map in req)
|
||||
{
|
||||
if (!map.TryGetValue("object_id", out tmp))
|
||||
continue;
|
||||
|
||||
UUID id = tmp.AsUUID();
|
||||
if (id.IsZero())
|
||||
continue;
|
||||
UUID assetID;
|
||||
int side;
|
||||
if (map.TryGetValue("side", out tmp))
|
||||
side = tmp.AsInteger();
|
||||
else
|
||||
side = 0;
|
||||
|
||||
if (map.TryGetValue("asset_id", out tmp))
|
||||
assetID = tmp.AsUUID();
|
||||
else
|
||||
assetID = UUID.Zero;
|
||||
|
||||
string assetdata = string.Empty;
|
||||
if (map.TryGetValue("gltf_json", out tmp))
|
||||
{
|
||||
assetdata = tmp.AsString();
|
||||
}
|
||||
|
||||
SceneObjectPart sop = m_Scene.GetSceneObjectPart(id);
|
||||
if(sop is null)
|
||||
continue;
|
||||
PrimitiveBaseShape pbs = sop.Shape;
|
||||
if(pbs is null)
|
||||
continue;
|
||||
if(pbs.RenderMaterials is null)
|
||||
{
|
||||
var entries = new Primitive.RenderMaterials.RenderMaterialEntry[1];
|
||||
entries[0].te_index = (byte)side;
|
||||
entries[0].id = assetID;
|
||||
pbs.RenderMaterials = new Primitive.RenderMaterials
|
||||
{
|
||||
entries = entries
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < pbs.RenderMaterials.entries.Length; i++ )
|
||||
{
|
||||
if (pbs.RenderMaterials.entries[i].te_index == side)
|
||||
{
|
||||
pbs.RenderMaterials.entries[i].id = assetID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( i == pbs.RenderMaterials.entries.Length)
|
||||
{
|
||||
Array.Resize(ref pbs.RenderMaterials.entries, i + 1);
|
||||
pbs.RenderMaterials.entries[i].te_index = (byte)side;
|
||||
pbs.RenderMaterials.entries[i].id = assetID;
|
||||
}
|
||||
}
|
||||
sop.ParentGroup.HasGroupChanged = true;
|
||||
sop.ScheduleFullUpdate();
|
||||
}
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user