Don't need to try both AssetService.Get and GetCached in GetMesh since Get always calls GetCached and code paths were identical
parent
49258350e8
commit
3146f4bae0
|
@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||||
{
|
{
|
||||||
|
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
responsedata["int_response_code"] = 400; //501; //410; //404;
|
responsedata["int_response_code"] = 400; //501; //410; //404;
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
|
@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (request.ContainsKey("mesh_id"))
|
if (request.ContainsKey("mesh_id"))
|
||||||
meshStr = request["mesh_id"].ToString();
|
meshStr = request["mesh_id"].ToString();
|
||||||
|
|
||||||
|
|
||||||
UUID meshID = UUID.Zero;
|
UUID meshID = UUID.Zero;
|
||||||
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
|
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
|
||||||
{
|
{
|
||||||
|
@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase mesh;
|
AssetBase mesh = m_assetService.Get(meshID.ToString());
|
||||||
// Only try to fetch locally cached textures. Misses are redirected
|
|
||||||
mesh = m_assetService.GetCached(meshID.ToString());
|
|
||||||
if (mesh != null)
|
if (mesh != null)
|
||||||
{
|
{
|
||||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||||
{
|
{
|
||||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||||
|
@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mesh = m_assetService.Get(meshID.ToString());
|
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||||
if (mesh != null)
|
responsedata["content_type"] = "text/plain";
|
||||||
{
|
responsedata["keepalive"] = false;
|
||||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||||
{
|
return responsedata;
|
||||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
|
||||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
|
||||||
responsedata["int_response_code"] = 200;
|
|
||||||
}
|
|
||||||
// Optionally add additional mesh types here
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
|
||||||
responsedata["content_type"] = "text/plain";
|
|
||||||
responsedata["keepalive"] = false;
|
|
||||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
|
||||||
return responsedata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
|
||||||
responsedata["content_type"] = "text/plain";
|
|
||||||
responsedata["keepalive"] = false;
|
|
||||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
|
||||||
return responsedata;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
byte[] GetData(string id);
|
byte[] GetData(string id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Synchronously fetches an asset from the local cache only
|
/// Synchronously fetches an asset from the local cache only.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Asset ID</param>
|
/// <param name="id">Asset ID</param>
|
||||||
/// <returns>The fetched asset, or null if it did not exist in the local cache</returns>
|
/// <returns>The fetched asset, or null if it did not exist in the local cache</returns>
|
||||||
|
@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new asset
|
/// Creates a new asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// Returns a random ID if none is passed into it
|
/// <remarks>
|
||||||
|
/// Returns a random ID if none is passed via the asset argument.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="asset"></param>
|
/// <param name="asset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
string Store(AssetBase asset);
|
string Store(AssetBase asset);
|
||||||
|
@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an asset's content
|
/// Update an asset's content
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
/// Attachments and bare scripts need this!!
|
/// Attachments and bare scripts need this!!
|
||||||
|
/// </remarks>
|
||||||
/// <param name="id"> </param>
|
/// <param name="id"> </param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
Loading…
Reference in New Issue