From 7e363b79c7894b8c393ec38ae60ea19f8cb65d5e Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 14 Oct 2010 09:24:15 -0400 Subject: [PATCH] * Tweaked the upload response and now at least uploading the mesh works. * Binary error on downloading the mesh though.. so still not yet working. --- .../Capabilities/LLSDAssetUploadResponse.cs | 14 ++++++++ .../Avatar/Assets/GetMeshModule.cs | 4 +-- ...ewFileAgentInventoryVariablePriceModule.cs | 33 +++++++++++-------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs index 08f14e302f..0d6f7f9423 100644 --- a/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs @@ -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"; + } + } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index c1e9891c15..bae108cdec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.GetCached(meshID.ToString()); 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["content_type"] = "application/vnd.ll.mesh"; @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.Get(meshID.ToString()); 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["content_type"] = "application/vnd.ll.mesh"; diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 0bba7d4497..9029f58c8c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets m_log.Info("[GETMESH]: /CAPS/" + capID); caps.RegisterHandler("NewFileAgentInventoryVariablePrice", - new LLSDStreamhandler("POST", + new LLSDStreamhandler("POST", "/CAPS/" + capID.ToString(), delegate(LLSDAssetUploadRequest req) { @@ -117,8 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } #endregion - - public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + + public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) { //if (llsdRequest.asset_type == "texture" || // llsdRequest.asset_type == "animation" || @@ -138,8 +138,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; errorResponse.state = "error"; return errorResponse; } @@ -170,14 +170,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + uploaderPath; + - LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); - uploadResponse.uploader = uploaderURL; + LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + + + uploadResponse.rsvp = uploaderURL; 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, UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, string passetType) @@ -185,16 +190,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets UploadCompleteHandler(passetName, passetDescription, passetID, pinventoryItem, pparentFolder, pdata, pinventoryType, passetType,agentID); - };*/ + }; return uploadResponse; } public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) + string assetType,UUID AgentID) { - UUID AgentID = UUID.Zero; + sbyte assType = 0; sbyte inType = 0; @@ -223,8 +228,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } else if (inventoryType == "mesh") { - inType = 45; // TODO: Replace with appropriate type - assType = 45;// TODO: Replace with appropriate type + inType = 22; // TODO: Replace with appropriate type + assType = 49;// TODO: Replace with appropriate type } AssetBase asset;