* Tweaked the upload response and now at least uploading the mesh works.

* Binary error on downloading the mesh though..   so still not yet working.
viewer-2-initial-appearance
Teravus Ovares (Dan Olivares) 2010-10-14 09:24:15 -04:00
parent 9c5f8a6802
commit 7e363b79c7
3 changed files with 35 additions and 16 deletions

View File

@ -39,4 +39,18 @@ namespace OpenSim.Framework.Capabilities
{ {
} }
} }
[OSDMap]
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
{
public int resource_cost;
public string state;
public int upload_price;
public string rsvp;
public LLSDNewFileAngentInventoryVariablePriceReplyResponse()
{
state = "confirm_upload";
}
}
} }

View File

@ -145,7 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
mesh = m_assetService.GetCached(meshID.ToString()); mesh = m_assetService.GetCached(meshID.ToString());
if (mesh != null) if (mesh != null)
{ {
if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated!
{ {
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";
@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
mesh = m_assetService.Get(meshID.ToString()); mesh = m_assetService.Get(meshID.ToString());
if (mesh != null) if (mesh != null)
{ {
if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated!
{ {
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";

View File

@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
m_log.Info("[GETMESH]: /CAPS/" + capID); m_log.Info("[GETMESH]: /CAPS/" + capID);
caps.RegisterHandler("NewFileAgentInventoryVariablePrice", caps.RegisterHandler("NewFileAgentInventoryVariablePrice",
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST",
"/CAPS/" + capID.ToString(), "/CAPS/" + capID.ToString(),
delegate(LLSDAssetUploadRequest req) delegate(LLSDAssetUploadRequest req)
{ {
@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
#endregion #endregion
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID)
{ {
//if (llsdRequest.asset_type == "texture" || //if (llsdRequest.asset_type == "texture" ||
// llsdRequest.asset_type == "animation" || // llsdRequest.asset_type == "animation" ||
@ -138,8 +138,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
if (client != null) if (client != null)
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
errorResponse.uploader = ""; errorResponse.rsvp = "";
errorResponse.state = "error"; errorResponse.state = "error";
return errorResponse; return errorResponse;
} }
@ -171,13 +171,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase +
uploaderPath; uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL; LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
uploadResponse.rsvp = uploaderURL;
uploadResponse.state = "upload"; uploadResponse.state = "upload";
uploadResponse.resource_cost = 0;
uploadResponse.upload_price = 0;
uploader.OnUpLoad += UploadCompleteHandler; uploader.OnUpLoad += //UploadCompleteHandler;
/*delegate( delegate(
string passetName, string passetDescription, UUID passetID, string passetName, string passetDescription, UUID passetID,
UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType,
string passetType) string passetType)
@ -185,16 +190,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
UploadCompleteHandler(passetName, passetDescription, passetID, UploadCompleteHandler(passetName, passetDescription, passetID,
pinventoryItem, pparentFolder, pdata, pinventoryType, pinventoryItem, pparentFolder, pdata, pinventoryType,
passetType,agentID); passetType,agentID);
};*/ };
return uploadResponse; return uploadResponse;
} }
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
string assetType) string assetType,UUID AgentID)
{ {
UUID AgentID = UUID.Zero;
sbyte assType = 0; sbyte assType = 0;
sbyte inType = 0; sbyte inType = 0;
@ -223,8 +228,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
} }
else if (inventoryType == "mesh") else if (inventoryType == "mesh")
{ {
inType = 45; // TODO: Replace with appropriate type inType = 22; // TODO: Replace with appropriate type
assType = 45;// TODO: Replace with appropriate type assType = 49;// TODO: Replace with appropriate type
} }
AssetBase asset; AssetBase asset;