Rename file + more testing and tweaking

viewer-2-initial-appearance
Teravus Ovares (Dan Olivares) 2010-10-14 03:22:14 -04:00
parent 3384f643eb
commit b4a5ce148c
1 changed files with 17 additions and 9 deletions

View File

@ -48,7 +48,7 @@ using OpenSim.Framework.Capabilities;
namespace OpenSim.Region.CoreModules.Avatar.Assets namespace OpenSim.Region.CoreModules.Avatar.Assets
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class UploadObjectAssetModule : INonSharedRegionModule public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
public void Close() { } public void Close() { }
public string Name { get { return "UploadObjectAssetModule"; } } public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } }
public void RegisterCaps(UUID agentID, Caps caps) public void RegisterCaps(UUID agentID, Caps caps)
@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
UUID capID = UUID.Random(); UUID capID = UUID.Random();
m_log.Info("[GETMESH]: /CAPS/" + capID); m_log.Info("[GETMESH]: /CAPS/" + capID);
caps.RegisterHandler("UploadObjectAsset", caps.RegisterHandler("NewFileAgentInventoryVariablePrice",
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
"/CAPS/" + capID.ToString(), "/CAPS/" + capID.ToString(),
@ -151,11 +151,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
string assetName = llsdRequest.name; string assetName = llsdRequest.name;
string assetDes = llsdRequest.description; string assetDes = llsdRequest.description;
string capsBase = "/CAPS/UploadObjectAsset/"; string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/";
UUID newAsset = UUID.Random(); UUID newAsset = UUID.Random();
UUID newInvItem = UUID.Random(); UUID newInvItem = UUID.Random();
UUID parentFolder = llsdRequest.folder_id; UUID parentFolder = llsdRequest.folder_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/";
Caps.AssetUploader uploader = Caps.AssetUploader uploader =
new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
@ -174,8 +174,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL; uploadResponse.uploader = uploaderURL;
uploadResponse.state = "upload"; uploadResponse.state = "upload";
uploader.OnUpLoad += delegate( uploader.OnUpLoad += UploadCompleteHandler;
/*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)
@ -183,15 +185,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,UUID AgentID) string assetType)
{ {
UUID AgentID = UUID.Zero;
sbyte assType = 0; sbyte assType = 0;
sbyte inType = 0; sbyte inType = 0;
@ -218,6 +221,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
break; break;
} }
} }
else if (inventoryType == "mesh")
{
inType = 45; // TODO: Replace with appropriate type
assType = 45;// TODO: Replace with appropriate type
}
AssetBase asset; AssetBase asset;
asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); asset = new AssetBase(assetID, assetName, assType, AgentID.ToString());