Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
80a81896b6
|
@ -30,12 +30,14 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
|
||||
[LLSDType("MAP")]
|
||||
public class LLSDAssetUploadComplete
|
||||
{
|
||||
public string new_asset = String.Empty;
|
||||
public UUID new_inventory_item = UUID.Zero;
|
||||
public string state = String.Empty;
|
||||
public LLSDAssetUploadError error = null;
|
||||
//public bool success = false;
|
||||
|
||||
public LLSDAssetUploadComplete()
|
||||
|
|
|
@ -26,9 +26,17 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadError
|
||||
{
|
||||
public string message = String.Empty;
|
||||
public UUID identifier = UUID.Zero;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadResponsePricebrkDown
|
||||
{
|
||||
|
@ -56,11 +64,13 @@ namespace OpenSim.Framework.Capabilities
|
|||
public string state = String.Empty;
|
||||
public int upload_price = 0;
|
||||
public LLSDAssetUploadResponseData data = null;
|
||||
public LLSDAssetUploadError error = null;
|
||||
public LLSDAssetUploadResponse()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
public delegate void UpLoadedAsset(
|
||||
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
|
||||
byte[] data, string inventoryType, string assetType, int cost);
|
||||
byte[] data, string inventoryType, string assetType, int cost, ref string error);
|
||||
|
||||
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
||||
|
||||
|
@ -455,11 +455,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
case FileAgentInventoryState.processRequest:
|
||||
case FileAgentInventoryState.processUpload:
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false);
|
||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||
resperror.message = "Uploader busy processing previus request";
|
||||
resperror.identifier = UUID.Zero;
|
||||
|
||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||
errorResponse.uploader = "";
|
||||
errorResponse.state = "error";
|
||||
errorResponse.error = resperror;
|
||||
return errorResponse;
|
||||
break;
|
||||
case FileAgentInventoryState.waitUpload:
|
||||
|
@ -489,12 +492,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
if (avatar.UserLevel < m_levelUpload)
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false);
|
||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||
resperror.message = "Insufficient permissions to upload";
|
||||
resperror.identifier = UUID.Zero;
|
||||
|
||||
|
||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||
errorResponse.uploader = "";
|
||||
errorResponse.state = "error";
|
||||
errorResponse.error = resperror;
|
||||
lock (m_ModelCost)
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
return errorResponse;
|
||||
|
@ -518,11 +524,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
|
||||
meshcostdata, out error))
|
||||
{
|
||||
client.SendAgentAlertMessage(error, false);
|
||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||
resperror.message = error;
|
||||
resperror.identifier = UUID.Zero;
|
||||
|
||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||
errorResponse.uploader = "";
|
||||
errorResponse.state = "error";
|
||||
errorResponse.error = resperror;
|
||||
|
||||
lock (m_ModelCost)
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
return errorResponse;
|
||||
|
@ -539,11 +549,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
if (!mm.UploadCovered(client.AgentId, (int)cost))
|
||||
{
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||
resperror.message = "Insuficient funds";
|
||||
resperror.identifier = UUID.Zero;
|
||||
|
||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||
errorResponse.uploader = "";
|
||||
errorResponse.state = "error";
|
||||
errorResponse.error = resperror;
|
||||
lock (m_ModelCost)
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
return errorResponse;
|
||||
|
@ -607,8 +620,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
/// <param name="data"></param>
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType, int cost)
|
||||
string assetType, int cost, ref string error)
|
||||
{
|
||||
|
||||
lock (m_ModelCost)
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.processUpload;
|
||||
|
||||
|
@ -619,17 +633,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
IClientAPI client = null;
|
||||
|
||||
IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>();
|
||||
if (mm != null)
|
||||
{
|
||||
// make sure client still has enougth credit
|
||||
if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost))
|
||||
{
|
||||
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
error = "Insufficient funds.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -668,6 +678,25 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
List<Vector3> positions = new List<Vector3>();
|
||||
List<Quaternion> rotations = new List<Quaternion>();
|
||||
OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
|
||||
|
||||
// compare and get updated information
|
||||
|
||||
bool mismatchError = true;
|
||||
|
||||
while (mismatchError)
|
||||
{
|
||||
mismatchError = false;
|
||||
}
|
||||
|
||||
if (mismatchError)
|
||||
{
|
||||
error = "Upload and fee estimation information don't match";
|
||||
lock (m_ModelCost)
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSDArray instance_list = (OSDArray)request["instance_list"];
|
||||
OSDArray mesh_list = (OSDArray)request["mesh_list"];
|
||||
OSDArray texture_list = (OSDArray)request["texture_list"];
|
||||
|
@ -1240,7 +1269,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private string m_invType = String.Empty;
|
||||
private string m_assetType = String.Empty;
|
||||
private int m_cost;
|
||||
|
||||
private string m_error = String.Empty;
|
||||
|
||||
private Timer m_timeoutTimer = new Timer();
|
||||
|
||||
|
||||
|
@ -1278,12 +1308,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
UUID inv = inventoryItemID;
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
/*
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = inv;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
*/
|
||||
m_timeoutTimer.Stop();
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
|
@ -1301,8 +1332,25 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
handlerUpLoad = OnUpLoad;
|
||||
if (handlerUpLoad != null)
|
||||
{
|
||||
handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost);
|
||||
handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost, ref m_error);
|
||||
}
|
||||
if(m_error == String.Empty)
|
||||
{
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = inv;
|
||||
uploadComplete.state = "complete";
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||
resperror.message = m_error;
|
||||
resperror.identifier = inv;
|
||||
|
||||
uploadComplete.error = resperror;
|
||||
uploadComplete.state = "failed";
|
||||
}
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
resources.instance_list == null ||
|
||||
resources.instance_list.Array.Count == 0)
|
||||
{
|
||||
error = "Unable to upload mesh model. missing information.";
|
||||
error = "missing model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if( numberInstances > ObjectLinkedPartsMax )
|
||||
{
|
||||
error = "upload failed: Model whould have two many linked prims";
|
||||
error = "Model whould have more than " + ObjectLinkedPartsMax.ToString() + " linked prims";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -186,15 +186,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
|
||||
{
|
||||
// error = " upload fail: Model contains parts with a dimension lower than 0.001. Please adjust scaling";
|
||||
// return false;
|
||||
skipedSmall++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax)
|
||||
{
|
||||
error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling";
|
||||
error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -204,7 +202,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (mesh >= numberMeshs)
|
||||
{
|
||||
error = "Unable to upload mesh model. incoerent information.";
|
||||
error = "Incoerent model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -233,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (skipedSmall >0 && skipedSmall > numberInstances / 2)
|
||||
{
|
||||
error = "Upload failed: Model contains too much prims smaller than minimum size to ignore";
|
||||
error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + "m";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -279,14 +277,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (data == null || data.Length == 0)
|
||||
{
|
||||
error = "Unable to upload mesh model. missing information.";
|
||||
error = "Missing model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
OSD meshOsd = null;
|
||||
int start = 0;
|
||||
|
||||
error = "Unable to upload mesh model. Invalid data";
|
||||
error = "Invalid model data";
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(data))
|
||||
{
|
||||
|
@ -334,13 +332,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (submesh_offset < 0 || hulls_size == 0)
|
||||
{
|
||||
error = "Unable to upload mesh model. missing physics_convex block";
|
||||
error = "Missing physics_convex block";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls))
|
||||
{
|
||||
error = "Unable to upload mesh model. bad physics_convex block";
|
||||
error = "Bad physics_convex block";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -360,7 +358,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (submesh_offset < 0 || highlod_size <= 0)
|
||||
{
|
||||
error = "Unable to upload mesh model. missing high_lod";
|
||||
error = "Missing high_lod block";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -418,7 +416,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles))
|
||||
{
|
||||
error = "Unable to upload mesh model. parsing error";
|
||||
error = "Model data parsing error";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue