From f415eb84e17772a997e8b40ec2d7469cac40b55d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 20:06:39 +0100 Subject: Implement the cap to send extra physics params to the viewer. Not functional yet because the parameters are not actually stored anywhere yet. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 35cb575..2974058 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -96,6 +96,7 @@ namespace OpenSim.Region.ClientStack.Linden // private static readonly string m_fetchInventoryPath = "0006/"; private static readonly string m_copyFromNotecardPath = "0007/"; // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. + private static readonly string m_getObjectPhysicsDataPath = "0101/"; // These are callbacks which will be setup by the scene so that we can update scene data when we @@ -182,6 +183,8 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); + IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); + m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); // As of RC 1.22.9 of the Linden client this is // supported @@ -799,6 +802,41 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 200; return LLSDHelpers.SerialiseLLSDReply(response); } + + public string GetObjectPhysicsData(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + OSDArray object_ids = (OSDArray)req["object_ids"]; + + for (int i = 0 ; i < object_ids.Count ; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + OSDMap object_data = new OSDMap(); + + object_data["PhysicsShapeType"] = OSD.FromInteger(1); + if (false) // Check whether to include the rest + { + object_data["Density"] = OSD.FromReal(1); + object_data["Friction"] = OSD.FromReal(1); + object_data["Restitution"] = OSD.FromReal(1); + object_data["GravityMultiplier"] = OSD.FromReal(1); + } + + resp[uuid.ToString()] = object_data; + } + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } } public class AssetUploader -- cgit v1.1 From d4e6834f99db25ad0461cec72b58876fa299844b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 20:49:16 +0100 Subject: Hook up the new cap to the SOP changes --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2974058..df65af9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -820,14 +820,11 @@ namespace OpenSim.Region.ClientStack.Linden { OSDMap object_data = new OSDMap(); - object_data["PhysicsShapeType"] = OSD.FromInteger(1); - if (false) // Check whether to include the rest - { - object_data["Density"] = OSD.FromReal(1); - object_data["Friction"] = OSD.FromReal(1); - object_data["Restitution"] = OSD.FromReal(1); - object_data["GravityMultiplier"] = OSD.FromReal(1); - } + object_data["PhysicsShapeType"] = obj.PhysicsShapeType; + object_data["Density"] = obj.Density; + object_data["Friction"] = obj.Friction; + object_data["Restitution"] = obj.Bounciness; + object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; } -- cgit v1.1 From 15ad5f492b8150ff81d969a389e32edb35227b19 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 10:25:18 +0000 Subject: Playing with object costs CAPS ... --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 120 ++++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index df65af9..5542680 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -97,7 +97,9 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_copyFromNotecardPath = "0007/"; // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. private static readonly string m_getObjectPhysicsDataPath = "0101/"; - + private static readonly string m_getObjectCostPath = "0102/"; + private static readonly string m_ResourceCostSelectedPath = "0103/"; + // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls @@ -185,7 +187,12 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); - + IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); + m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); + IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + + // As of RC 1.22.9 of the Linden client this is // supported @@ -834,6 +841,115 @@ namespace OpenSim.Region.ClientStack.Linden Console.WriteLine(response); return response; } + + public string GetObjectCost(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + // see being triggered but see no efect .. have something wrong ?? + // + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + OSDArray object_ids = (OSDArray)req["object_ids"]; + + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + // only see root parts .. so guess should go by SOG only + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + OSDMap object_data = new OSDMap(); + + object_data["linked_set_resource_cost"] = 1.0f; + object_data["resource_cost"] = 1.0f; + object_data["physics_cost"] = 1.0f; + object_data["linked_set_physics_cost"] = 1.0f; + + resp[uuid.ToString()] = object_data; + } + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } + + public string ResourceCostSelected(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + + float phys=0; + float stream=0; + float simul=0; + + if (req.ContainsKey("selected_roots")) + { + OSDArray object_ids = (OSDArray)req["selected_roots"]; + + // should go by SOG suming costs for all parts + // ll v3 works ok with several objects select we get the list and adds ok + // FS calls per object so results are wrong guess fs bug + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + phys += 0.1f; // just to see... + stream += 0.2f; + simul += 0.5f; + } + } + } + else if (req.ContainsKey("selected_prims")) + { + OSDArray object_ids = (OSDArray)req["selected_prims"]; + + // don't see in use in any of the 2 viewers + // guess it should be for edit linked but... nothing + // should go to SOP per part + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + phys += 0.1f; + stream += 0.2f; + simul += 0.5f; + } + } + } + + if (simul != 0) + { + OSDMap object_data = new OSDMap(); + + object_data["physics"] = phys; + object_data["streaming"] = stream; + object_data["simulation"] = simul; + + resp["selected"] = object_data; + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } + + + + + } public class AssetUploader -- cgit v1.1 From ae8e089b9c73a6a675038759e3e3f9491819eb72 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Mar 2012 15:33:49 +0000 Subject: some more work on costs --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 56 +++++++++++++--------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 5542680..dfd5c98 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -845,9 +845,7 @@ namespace OpenSim.Region.ClientStack.Linden public string GetObjectCost(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - // see being triggered but see no efect .. have something wrong ?? - // + { OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); OSDMap resp = new OSDMap(); @@ -856,19 +854,29 @@ namespace OpenSim.Region.ClientStack.Linden for (int i = 0; i < object_ids.Count; i++) { UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); - // only see root parts .. so guess should go by SOG only - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + if (part != null) { - OSDMap object_data = new OSDMap(); + SceneObjectGroup grp = part.ParentGroup; + if (grp != null) + { + float linksetCost; + float linksetPhysCost; + float partCost; + float partPhysCost; - object_data["linked_set_resource_cost"] = 1.0f; - object_data["resource_cost"] = 1.0f; - object_data["physics_cost"] = 1.0f; - object_data["linked_set_physics_cost"] = 1.0f; + grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); - resp[uuid.ToString()] = object_data; + OSDMap object_data = new OSDMap(); + object_data["linked_set_resource_cost"] = linksetCost; + object_data["resource_cost"] = partCost; + object_data["physics_cost"] = partPhysCost; + object_data["linked_set_physics_cost"] = linksetPhysCost; + + resp[uuid.ToString()] = object_data; + } } } @@ -899,13 +907,17 @@ namespace OpenSim.Region.ClientStack.Linden for (int i = 0; i < object_ids.Count; i++) { UUID uuid = object_ids[i].AsUUID(); + float Physc; + float simulc; + float streamc; - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); + if (grp != null) { - phys += 0.1f; // just to see... - stream += 0.2f; - simul += 0.5f; + grp.GetSelectedCosts(out Physc, out streamc, out simulc); + phys += Physc; + stream += streamc; + simul += simulc; } } } @@ -920,12 +932,12 @@ namespace OpenSim.Region.ClientStack.Linden { UUID uuid = object_ids[i].AsUUID(); - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); + if (part != null) { - phys += 0.1f; - stream += 0.2f; - simul += 0.5f; + phys += part.PhysicsCost; + stream += part.StreamingCost; + simul += part.SimulationCost; } } } -- cgit v1.1 From 618244f285a521971808bc649be538cf831f3e66 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 19 Mar 2012 14:39:19 +0100 Subject: Remove debug output using Console.WriteLine and trim excessive whitespace --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index dfd5c98..6c44175 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -838,7 +838,6 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } @@ -881,7 +880,6 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } @@ -954,14 +952,8 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } - - - - - } public class AssetUploader -- cgit v1.1 From bd1d9a214b7f8750427d670566c8f99ff62f33c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:28:13 +0200 Subject: Add the option to have variable costing for uploads --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 51 +++++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 88c4d7f..097e224 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); - public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); + public delegate void NewInventoryItem(UUID userID, InventoryItemBase item, uint cost); public delegate void NewAsset(AssetBase asset); @@ -386,6 +386,38 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } + private delegate void UploadWithCostCompleteDelegate(string assetName, + string assetDescription, UUID assetID, UUID inventoryItem, + UUID parentFolder, byte[] data, string inventoryType, + string assetType, uint cost); + + private class AssetUploaderWithCost : AssetUploader + { + private uint m_cost; + + public event UploadWithCostCompleteDelegate OnUpLoad; + + public AssetUploaderWithCost(string assetName, string description, UUID assetID, + UUID inventoryItem, UUID parentFolderID, string invType, string assetType, + string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : + base(assetName, description, assetID, inventoryItem, parentFolderID, + invType, assetType, path, httpServer, dumpAssetsToFile) + { + m_cost = cost; + + base.OnUpLoad += UploadCompleteHandler; + } + + private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType) + { + OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, + data, inventoryType, assetType, m_cost); + } + } + + /// /// /// @@ -396,6 +428,8 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); + uint cost = 0; + if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "sound") @@ -428,7 +462,10 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { - if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) + // XPTO: The cost should be calculated about here + cost = (uint)mm.UploadCharge; + + if (!mm.UploadCovered(client.AgentId, (int)cost)) { client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); @@ -449,9 +486,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = - new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); + AssetUploaderWithCost uploader = + new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -484,7 +521,7 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) + string assetType, uint cost) { m_log.DebugFormat( "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", @@ -703,7 +740,7 @@ namespace OpenSim.Region.ClientStack.Linden if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item); + AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } } -- cgit v1.1 From a6928a479eb84b14e949c5f589b9ce753edf457a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:50:55 +0200 Subject: Add cost calculation suppor tto the VariablePrice one as well --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 097e224..328dc75 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -417,7 +417,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - /// /// /// -- cgit v1.1 From 245763b1b08d667aede3be7c092fa4c7200549c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Sep 2012 20:30:30 +0100 Subject: let LLSDAssetUploadRequest include asset_resources information plus let NewAgentInventoryRequest know about mesh (does nothing with it still) --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 328dc75..df43991 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -431,6 +431,7 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || + llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { ScenePresence avatar = null; -- cgit v1.1 From 013e94af5d45a7c99e46e01d9c5965a79ac1b231 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Sep 2012 23:06:29 +0100 Subject: report mesh upload costs ( fake values) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 48 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index df43991..90ac8ce 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -463,7 +463,26 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { // XPTO: The cost should be calculated about here - cost = (uint)mm.UploadCharge; + + if (llsdRequest.asset_type == "mesh") + { + if (llsdRequest.asset_resources == null) + { + client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); + + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + } + + uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; + textures_cost *= (uint)mm.UploadCharge; + + cost = textures_cost; + } + else + cost = (uint)mm.UploadCharge; if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -486,9 +505,14 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + uint uploadCost = cost; + // don't charge for meshs until we done them + if (llsdRequest.asset_type == "mesh") + uploadCost = 0; + AssetUploaderWithCost uploader = new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -506,11 +530,31 @@ namespace OpenSim.Region.ClientStack.Linden string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; + LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; + uploadResponse.upload_price = (int)cost; + + // use fake values for now + if (llsdRequest.asset_type == "mesh") + { + uploadResponse.data = new LLSDAssetUploadResponseData(); + uploadResponse.data.model_streaming_cost = 1.0; + uploadResponse.data.simulation_cost = 1.5; + + uploadResponse.data.physics_cost = 2.0; + uploadResponse.data.resource_cost = 3.0; + uploadResponse.data.upload_price_breakdown.mesh_instance = 1; + uploadResponse.data.upload_price_breakdown.mesh_physics = 2; + uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; + uploadResponse.data.upload_price_breakdown.texture = 5; + uploadResponse.data.upload_price_breakdown.model = 4; + } + uploader.OnUpLoad += UploadCompleteHandler; return uploadResponse; + } /// -- cgit v1.1 From fd1ee58f87dfbad96e89675bf5ab002d2d3a347f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 22:52:11 +0200 Subject: Add a missing brace, remove a useless temp variable, enable charging. --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 90ac8ce..9982556 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -482,7 +482,9 @@ namespace OpenSim.Region.ClientStack.Linden cost = textures_cost; } else + { cost = (uint)mm.UploadCharge; + } if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -505,14 +507,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - uint uploadCost = cost; - // don't charge for meshs until we done them - if (llsdRequest.asset_type == "mesh") - uploadCost = 0; - AssetUploaderWithCost uploader = new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( -- cgit v1.1 From 5139db2638fcee945961ea8d5635def581b54a4d Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 12:56:59 +0200 Subject: Add a timer to time out upload caps handlers that are not used. --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 9982556..c4a9a19 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -26,6 +26,7 @@ */ using System; +using System.Timers; using System.Collections; using System.Collections.Generic; using System.IO; @@ -1106,6 +1107,7 @@ namespace OpenSim.Region.ClientStack.Linden private string m_invType = String.Empty; private string m_assetType = String.Empty; + private Timer m_timeoutTimer = new Timer(); public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, @@ -1121,6 +1123,11 @@ namespace OpenSim.Region.ClientStack.Linden m_assetType = assetType; m_invType = invType; m_dumpAssetsToFile = dumpAssetsToFile; + + m_timeoutTimer.Elapsed += TimedOut; + m_timeoutTimer.Interval = 120000; + m_timeoutTimer.AutoReset = false; + m_timeoutTimer.Start(); } /// @@ -1163,6 +1170,11 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + private void TimedOut(object sender, ElapsedEventArgs args) + { + httpListener.RemoveStreamHandler("POST", uploaderPath); + } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ -- cgit v1.1 From d8e9188908bd1f6ab505e5424f02071b44f0fab1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 21:14:55 +0200 Subject: Stop expiry timer when upload is complete. Log if timeout is reached. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index c4a9a19..116055a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1149,6 +1149,7 @@ namespace OpenSim.Region.ClientStack.Linden res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); httpListener.RemoveStreamHandler("POST", uploaderPath); + m_timeoutTimer.Stop(); // TODO: probably make this a better set of extensions here string extension = ".jp2"; @@ -1172,6 +1173,7 @@ namespace OpenSim.Region.ClientStack.Linden private void TimedOut(object sender, ElapsedEventArgs args) { + m_log.InfoFormat("[CAPS]: Removing URL and handler for timed out mesh upload"); httpListener.RemoveStreamHandler("POST", uploaderPath); } -- cgit v1.1 From e7932682a2405dab69cb6b4447dde952c2a5c080 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 21:24:09 +0200 Subject: Add a logger so the prior commit will work --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 116055a..88957ff 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1093,6 +1093,9 @@ namespace OpenSim.Region.ClientStack.Linden public class AssetUploader { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event UpLoadedAsset OnUpLoad; private UpLoadedAsset handlerUpLoad = null; -- cgit v1.1 From 45fe25de0d9636690114091565775d264a0ca96f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:14:39 +0200 Subject: Allow some more connections to try to ease lag. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 88957ff..580c005 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -467,6 +467,8 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "mesh") { + cost += 20; // Constant for now to test showing a price + if (llsdRequest.asset_resources == null) { client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); @@ -480,7 +482,7 @@ namespace OpenSim.Region.ClientStack.Linden uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; textures_cost *= (uint)mm.UploadCharge; - cost = textures_cost; + cost += textures_cost; } else { -- cgit v1.1 From 5915dfc26f0fe02411588ddea2791d69cb67d1ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 15:37:05 +0100 Subject: Make use of mesh cost functions --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 580c005..ce3ca8b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -429,6 +429,7 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); uint cost = 0; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || @@ -467,11 +468,15 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "mesh") { - cost += 20; // Constant for now to test showing a price + string error; + int modelcost; + ModelCost mc = new ModelCost(); - if (llsdRequest.asset_resources == null) + if (!mc.MeshModelCost(llsdRequest.asset_resources, mm.UploadCharge, out modelcost, + meshcostdata, out error)) { - client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); + + client.SendAgentAlertMessage(error, false); LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; @@ -479,10 +484,7 @@ namespace OpenSim.Region.ClientStack.Linden return errorResponse; } - uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; - textures_cost *= (uint)mm.UploadCharge; - - cost += textures_cost; + cost = (uint)modelcost; } else { @@ -536,20 +538,9 @@ namespace OpenSim.Region.ClientStack.Linden uploadResponse.state = "upload"; uploadResponse.upload_price = (int)cost; - // use fake values for now if (llsdRequest.asset_type == "mesh") { - uploadResponse.data = new LLSDAssetUploadResponseData(); - uploadResponse.data.model_streaming_cost = 1.0; - uploadResponse.data.simulation_cost = 1.5; - - uploadResponse.data.physics_cost = 2.0; - uploadResponse.data.resource_cost = 3.0; - uploadResponse.data.upload_price_breakdown.mesh_instance = 1; - uploadResponse.data.upload_price_breakdown.mesh_physics = 2; - uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; - uploadResponse.data.upload_price_breakdown.texture = 5; - uploadResponse.data.upload_price_breakdown.model = 4; + uploadResponse.data = meshcostdata; } uploader.OnUpLoad += UploadCompleteHandler; -- cgit v1.1 From df77724bbc30ab03f95508bd1b2f4539ed1206e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 15:50:59 +0100 Subject: let mesh model estimator work even without money module, so other estimations can work --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ce3ca8b..ddb69c4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -462,35 +462,35 @@ namespace OpenSim.Region.ClientStack.Linden { IMoneyModule mm = m_Scene.RequestModuleInterface(); + int baseCost = 0; if (mm != null) + baseCost = mm.UploadCharge; + + if (llsdRequest.asset_type == "mesh") { - // XPTO: The cost should be calculated about here + string error; + int modelcost; + ModelCost mc = new ModelCost(); - if (llsdRequest.asset_type == "mesh") + if (!mc.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, + meshcostdata, out error)) { - string error; - int modelcost; - ModelCost mc = new ModelCost(); - - if (!mc.MeshModelCost(llsdRequest.asset_resources, mm.UploadCharge, out modelcost, - meshcostdata, out error)) - { - - client.SendAgentAlertMessage(error, false); + client.SendAgentAlertMessage(error, false); - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; - errorResponse.state = "error"; - return errorResponse; - } - - cost = (uint)modelcost; - } - else - { - cost = (uint)mm.UploadCharge; + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; } + cost = (uint)modelcost; + } + else + { + cost = (uint)baseCost; + } + if (mm != null) + { if (!mm.UploadCovered(client.AgentId, (int)cost)) { client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); -- cgit v1.1 From c3666c9ec3f0e32443094fbcb683dec7b457a3e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 19:38:05 +0100 Subject: make sure client still has money at upload --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ddb69c4..4ba8254 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -489,6 +489,7 @@ namespace OpenSim.Region.ClientStack.Linden cost = (uint)baseCost; } + // check funds if (mm != null) { if (!mm.UploadCovered(client.AgentId, (int)cost)) @@ -565,6 +566,21 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + IClientAPI client = null; + + IMoneyModule mm = m_Scene.RequestModuleInterface(); + 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); + return; + } + } + if (inventoryType == "sound") { inType = 1; -- cgit v1.1 From c1eec3b82818f91f66580cecc32c2ac9a9d2d968 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 21:15:07 +0100 Subject: on upload store mesh list contents as mesh assets. Build prims by instances not meshs. (some prims can have same mesh) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 4ba8254..ace188c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -617,6 +617,7 @@ namespace OpenSim.Region.ClientStack.Linden OSDArray texture_list = (OSDArray)request["texture_list"]; SceneObjectGroup grp = null; + // create and store texture assets List textures = new List(); for (int i = 0; i < texture_list.Count; i++) { @@ -624,14 +625,28 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + textureAsset = null; } + // create and store meshs assets + List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + meshAsset.Data = mesh_list[i].AsBinary(); + m_assetService.Store(meshAsset); + meshAssets.Add(meshAsset.FullID); + meshAsset = null; + } + + // build prims from instances + for (int i = 0; i < instance_list.Count; i++) + { PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); Primitive.TextureEntry textureEntry = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); + OSDMap inner_instance_list = (OSDMap)instance_list[i]; OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; @@ -676,14 +691,14 @@ namespace OpenSim.Region.ClientStack.Linden pbs.TextureEntry = textureEntry.GetBytes(); - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); - meshAsset.Data = mesh_list[i].AsBinary(); - m_assetService.Store(meshAsset); - - pbs.SculptEntry = true; - pbs.SculptTexture = meshAsset.FullID; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptData = meshAsset.Data; + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + } Vector3 position = inner_instance_list["position"].AsVector3(); Vector3 scale = inner_instance_list["scale"].AsVector3(); -- cgit v1.1 From e8ba26eac8fdc438ffb72391d00c852ec1fc9950 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Sep 2012 01:07:44 +0100 Subject: ***TEST*** still bad... create inventory itens for model textures and meshs. Issues: meshs get into root folder, viewer and viewer does not update inventory until relog ( the upload funtion needs to return more information) ,etc. Droping a mesh into a prim, makes viewer think we dropped a sculpt map, but it does work, viewer displays the mesh and physics work (as physics is stored at the sculpt information fields). Textures show up in Textures folder, just its to costly to find that default folder as is.. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 83 ++++++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ace188c..3789ee9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -583,24 +583,24 @@ namespace OpenSim.Region.ClientStack.Linden if (inventoryType == "sound") { - inType = 1; - assType = 1; + inType = (sbyte)InventoryType.Sound; + assType = (sbyte)AssetType.Sound; } else if (inventoryType == "animation") { - inType = 19; - assType = 20; + inType = (sbyte)InventoryType.Animation; + assType = (sbyte)AssetType.Animation; } else if (inventoryType == "wearable") { - inType = 18; + inType = (sbyte)InventoryType.Wearable; switch (assetType) { case "bodypart": - assType = 13; + assType = (sbyte)AssetType.Bodypart; break; case "clothing": - assType = 5; + assType = (sbyte)AssetType.Clothing; break; } } @@ -625,7 +625,42 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + + // save it to inventory + if (AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + } + textureAsset = null; + } // create and store meshs assets @@ -636,6 +671,40 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); + + // save it to inventory + if (AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); + meshitem = null; + } + meshAsset = null; } -- cgit v1.1 From ac2380bbfa5f7f2be8a5a9197f099a88988bce22 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 18 Sep 2012 02:12:07 +0200 Subject: Add booleans to control whether we actually crete inventory items --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3789ee9..cb6f7a1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -116,6 +116,8 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; + private bool m_addNewTextures = false; + private bool m_addNewMeshes = false; public BunchOfCaps(Scene scene, Caps caps) { @@ -627,7 +629,7 @@ namespace OpenSim.Region.ClientStack.Linden textures.Add(textureAsset.FullID); // save it to inventory - if (AddNewInventoryItem != null) + if (m_addNewTextures && AddNewInventoryItem != null) { string name = assetName; if (name.Length > 25) @@ -673,7 +675,7 @@ namespace OpenSim.Region.ClientStack.Linden meshAssets.Add(meshAsset.FullID); // save it to inventory - if (AddNewInventoryItem != null) + if (m_addNewMeshes && AddNewInventoryItem != null) { string name = assetName; if (name.Length > 25) -- cgit v1.1 From 51ca84afdfc8a4c3c884b5ab9bd4dffe662087a6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 00:29:16 +0100 Subject: coment out mesh model upload code to add textures and individual meshs assets to inventory, since it may actually be a bad ideia since good model textures are deply related to it and there is no current use for independent mesh assets. Added the option to have a reduced free for textures (2.5 C$ as is, total textures cost rounded to nearest int) compensating for the fact that they can't be used outside the model or its parts. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 380 +++++++++++---------- 1 file changed, 198 insertions(+), 182 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index cb6f7a1..073f175 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -116,8 +116,8 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; - private bool m_addNewTextures = false; - private bool m_addNewMeshes = false; +// private bool m_addNewTextures = false; +// private bool m_addNewMeshes = false; public BunchOfCaps(Scene scene, Caps caps) { @@ -608,172 +608,181 @@ namespace OpenSim.Region.ClientStack.Linden } else if (inventoryType == "object") { - inType = (sbyte)InventoryType.Object; - assType = (sbyte)AssetType.Object; - - List positions = new List(); - List rotations = new List(); - OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); - OSDArray instance_list = (OSDArray)request["instance_list"]; - OSDArray mesh_list = (OSDArray)request["mesh_list"]; - OSDArray texture_list = (OSDArray)request["texture_list"]; - SceneObjectGroup grp = null; - - // create and store texture assets - List textures = new List(); - for (int i = 0; i < texture_list.Count; i++) + if (assetType == "mesh") // this code for now is for mesh models uploads only { - AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); - textureAsset.Data = texture_list[i].AsBinary(); - m_assetService.Store(textureAsset); - textures.Add(textureAsset.FullID); - - // save it to inventory - if (m_addNewTextures && AddNewInventoryItem != null) + inType = (sbyte)InventoryType.Object; + assType = (sbyte)AssetType.Object; + + List positions = new List(); + List rotations = new List(); + OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); + OSDArray instance_list = (OSDArray)request["instance_list"]; + OSDArray mesh_list = (OSDArray)request["mesh_list"]; + OSDArray texture_list = (OSDArray)request["texture_list"]; + SceneObjectGroup grp = null; + + // create and store texture assets + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Texture#" + i.ToString(); - InventoryItemBase texitem = new InventoryItemBase(); - texitem.Owner = m_HostCapsObj.AgentID; - texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - texitem.CreatorData = String.Empty; - texitem.ID = UUID.Random(); - texitem.AssetID = textureAsset.FullID; - texitem.Description = "mesh model texture"; - texitem.Name = name; - texitem.AssetType = (int)AssetType.Texture; - texitem.InvType = (int)InventoryType.Texture; - texitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - texitem.BasePermissions = (uint)PermissionMask.All; - texitem.EveryOnePermissions = 0; - texitem.NextPermissions = (uint)PermissionMask.All; - texitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); - texitem = null; + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + textureAsset.Data = texture_list[i].AsBinary(); + m_assetService.Store(textureAsset); + textures.Add(textureAsset.FullID); + /* + don't do this + replace it by optionaly making model textures cost less than if individually uploaded + since they can't be used for other purpuses + + // save it to inventory + if (m_addNewTextures && AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + } + */ + textureAsset = null; } - textureAsset = null; - - } - - // create and store meshs assets - List meshAssets = new List(); - for (int i = 0; i < mesh_list.Count; i++) - { - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); - meshAsset.Data = mesh_list[i].AsBinary(); - m_assetService.Store(meshAsset); - meshAssets.Add(meshAsset.FullID); - - // save it to inventory - if (m_addNewMeshes && AddNewInventoryItem != null) + // create and store meshs assets + List meshAssets = new List(); + for (int i = 0; i < mesh_list.Count; i++) { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Mesh#" + i.ToString(); - InventoryItemBase meshitem = new InventoryItemBase(); - meshitem.Owner = m_HostCapsObj.AgentID; - meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - meshitem.CreatorData = String.Empty; - meshitem.ID = UUID.Random(); - meshitem.AssetID = meshAsset.FullID; - meshitem.Description = "mesh "; - meshitem.Name = name; - meshitem.AssetType = (int)AssetType.Mesh; - meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - meshitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - meshitem.BasePermissions = (uint)PermissionMask.All; - meshitem.EveryOnePermissions = 0; - meshitem.NextPermissions = (uint)PermissionMask.All; - meshitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); - meshitem = null; + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + meshAsset.Data = mesh_list[i].AsBinary(); + m_assetService.Store(meshAsset); + meshAssets.Add(meshAsset.FullID); + + /* this was a test, funny and showed viewers deal with mesh inventory itens + * nut also same reason as for textures + * let integrated in a model cost eventually less than hipotetical independent meshs assets + * that will be in inventory + // save it to inventory + if (m_addNewMeshes && AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); + meshitem = null; + } + */ + meshAsset = null; } - meshAsset = null; - } - - // build prims from instances - for (int i = 0; i < instance_list.Count; i++) - { - PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); + // build prims from instances + for (int i = 0; i < instance_list.Count; i++) + { + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); - Primitive.TextureEntry textureEntry - = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); + Primitive.TextureEntry textureEntry + = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); - OSDMap inner_instance_list = (OSDMap)instance_list[i]; + OSDMap inner_instance_list = (OSDMap)instance_list[i]; - OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; - for (uint face = 0; face < face_list.Count; face++) - { - OSDMap faceMap = (OSDMap)face_list[(int)face]; - Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); - if(faceMap.ContainsKey("fullbright")) - f.Fullbright = faceMap["fullbright"].AsBoolean(); - if (faceMap.ContainsKey ("diffuse_color")) - f.RGBA = faceMap["diffuse_color"].AsColor4(); + OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; + for (uint face = 0; face < face_list.Count; face++) + { + OSDMap faceMap = (OSDMap)face_list[(int)face]; + Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); + if (faceMap.ContainsKey("fullbright")) + f.Fullbright = faceMap["fullbright"].AsBoolean(); + if (faceMap.ContainsKey("diffuse_color")) + f.RGBA = faceMap["diffuse_color"].AsColor4(); - int textureNum = faceMap["image"].AsInteger(); - float imagerot = faceMap["imagerot"].AsInteger(); - float offsets = (float)faceMap["offsets"].AsReal(); - float offsett = (float)faceMap["offsett"].AsReal(); - float scales = (float)faceMap["scales"].AsReal(); - float scalet = (float)faceMap["scalet"].AsReal(); + int textureNum = faceMap["image"].AsInteger(); + float imagerot = faceMap["imagerot"].AsInteger(); + float offsets = (float)faceMap["offsets"].AsReal(); + float offsett = (float)faceMap["offsett"].AsReal(); + float scales = (float)faceMap["scales"].AsReal(); + float scalet = (float)faceMap["scalet"].AsReal(); - if(imagerot != 0) - f.Rotation = imagerot; + if (imagerot != 0) + f.Rotation = imagerot; - if(offsets != 0) - f.OffsetU = offsets; + if (offsets != 0) + f.OffsetU = offsets; - if (offsett != 0) - f.OffsetV = offsett; + if (offsett != 0) + f.OffsetV = offsett; - if (scales != 0) - f.RepeatU = scales; + if (scales != 0) + f.RepeatU = scales; - if (scalet != 0) - f.RepeatV = scalet; + if (scalet != 0) + f.RepeatV = scalet; - if (textures.Count > textureNum) - f.TextureID = textures[textureNum]; - else - f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; + if (textures.Count > textureNum) + f.TextureID = textures[textureNum]; + else + f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; - textureEntry.FaceTextures[face] = f; - } + textureEntry.FaceTextures[face] = f; + } - pbs.TextureEntry = textureEntry.GetBytes(); + pbs.TextureEntry = textureEntry.GetBytes(); - int meshindx = inner_instance_list["mesh"].AsInteger(); - if (meshAssets.Count > meshindx) - { - pbs.SculptEntry = true; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction - // data will be requested from asset on rez (i hope) - } + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + } - Vector3 position = inner_instance_list["position"].AsVector3(); - Vector3 scale = inner_instance_list["scale"].AsVector3(); - Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); + Vector3 position = inner_instance_list["position"].AsVector3(); + Vector3 scale = inner_instance_list["scale"].AsVector3(); + Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); // no longer used - begin ------------------------ // int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); @@ -793,23 +802,23 @@ namespace OpenSim.Region.ClientStack.Linden // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - UUID owner_id = m_HostCapsObj.AgentID; + UUID owner_id = m_HostCapsObj.AgentID; - SceneObjectPart prim - = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); + SceneObjectPart prim + = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); - prim.Scale = scale; - prim.OffsetPosition = position; - rotations.Add(rotation); - positions.Add(position); - prim.UUID = UUID.Random(); - prim.CreatorID = owner_id; - prim.OwnerID = owner_id; - prim.GroupID = UUID.Zero; - prim.LastOwnerID = prim.OwnerID; - prim.CreationDate = Util.UnixTimeSinceEpoch(); - prim.Name = assetName; - prim.Description = ""; + prim.Scale = scale; + prim.OffsetPosition = position; + rotations.Add(rotation); + positions.Add(position); + prim.UUID = UUID.Random(); + prim.CreatorID = owner_id; + prim.OwnerID = owner_id; + prim.GroupID = UUID.Zero; + prim.LastOwnerID = prim.OwnerID; + prim.CreationDate = Util.UnixTimeSinceEpoch(); + prim.Name = assetName; + prim.Description = ""; // prim.BaseMask = (uint)base_mask; // prim.EveryoneMask = (uint)everyone_mask; @@ -817,32 +826,39 @@ namespace OpenSim.Region.ClientStack.Linden // prim.NextOwnerMask = (uint)next_owner_mask; // prim.OwnerMask = (uint)owner_mask; - if (grp == null) - grp = new SceneObjectGroup(prim); - else - grp.AddPart(prim); - } + if (grp == null) + grp = new SceneObjectGroup(prim); + else + grp.AddPart(prim); + } - // Fix first link number - if (grp.Parts.Length > 1) - grp.RootPart.LinkNum++; + // Fix first link number + if (grp.Parts.Length > 1) + grp.RootPart.LinkNum++; - Vector3 rootPos = positions[0]; - grp.AbsolutePosition = rootPos; - for (int i = 0; i < positions.Count; i++) - { - Vector3 offset = positions[i] - rootPos; - grp.Parts[i].OffsetPosition = offset; + Vector3 rootPos = positions[0]; + grp.AbsolutePosition = rootPos; + for (int i = 0; i < positions.Count; i++) + { + Vector3 offset = positions[i] - rootPos; + grp.Parts[i].OffsetPosition = offset; + } + + for (int i = 0; i < rotations.Count; i++) + { + if (i != 0) + grp.Parts[i].RotationOffset = rotations[i]; + } + + grp.UpdateGroupRotationR(rotations[0]); + data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } - for (int i = 0; i < rotations.Count; i++) + else // not a mesh model { - if (i != 0) - grp.Parts[i].RotationOffset = rotations[i]; + m_log.ErrorFormat("[CAPS Asset Upload] got unsuported assetType for object upload"); + return; } - - grp.UpdateGroupRotationR(rotations[0]); - data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } AssetBase asset; -- cgit v1.1 From fb32604b413052ddedccba36247e676427c48824 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 01:33:16 +0100 Subject: create a single ModelCost provider for the caps instance. Let it know and check scene prim size limits. --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 073f175..0fb6c99 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -87,6 +87,7 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_Scene; private Caps m_HostCapsObj; + private ModelCost m_ModelCost; private static readonly string m_requestPath = "0000/"; // private static readonly string m_mapLayerPath = "0001/"; @@ -123,6 +124,15 @@ namespace OpenSim.Region.ClientStack.Linden { m_Scene = scene; m_HostCapsObj = caps; + + // create a model upload cost provider + m_ModelCost = new ModelCost(); + // tell it about scene object limits + m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; + m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; +// m_ModelCost.PrimScaleMin = ?? +// m_ModelCost.ObjectLinkedPartsMax = ?? + IConfigSource config = m_Scene.Config; if (config != null) { @@ -193,7 +203,6 @@ namespace OpenSim.Region.ClientStack.Linden { try { - // I don't think this one works... m_HostCapsObj.RegisterHandler( "NewFileAgentInventory", new LLSDStreamhandler( @@ -472,9 +481,8 @@ namespace OpenSim.Region.ClientStack.Linden { string error; int modelcost; - ModelCost mc = new ModelCost(); - if (!mc.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, + if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, meshcostdata, out error)) { client.SendAgentAlertMessage(error, false); -- cgit v1.1 From 5317b1053f2b8fd81f71c0b95c79aaa03efb47e4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 03:53:51 +0100 Subject: be more tolerant to small prims, skipping them, only failing if they are more than half of total. Add a state control to NewFileAgentInventory to avoid more than one at a time per client. ( Incomplete and possible not that good) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 81 ++++++++++++++++++---- 1 file changed, 69 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0fb6c99..d66076d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -117,6 +117,17 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; + private float m_PrimScaleMin = 0.001f; + + private enum FileAgentInventoryState : int + { + idle = 0, + processRequest = 1, + waitUpload = 2, + processUpload = 3 + } + private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; + // private bool m_addNewTextures = false; // private bool m_addNewMeshes = false; @@ -132,6 +143,7 @@ namespace OpenSim.Region.ClientStack.Linden m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; // m_ModelCost.PrimScaleMin = ?? // m_ModelCost.ObjectLinkedPartsMax = ?? +// m_PrimScaleMin = ?? IConfigSource config = m_Scene.Config; if (config != null) @@ -158,6 +170,8 @@ namespace OpenSim.Region.ClientStack.Linden ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; GetClient = m_Scene.SceneGraph.GetControllingClient; + + m_FileAgentInventoryState = FileAgentInventoryState.idle; } /// @@ -224,9 +238,7 @@ namespace OpenSim.Region.ClientStack.Linden IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); - m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); - - + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); m_HostCapsObj.RegisterHandler( "CopyInventoryFromNotecard", @@ -439,6 +451,35 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); + // start by getting the client + IClientAPI client = null; + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + + // check current state so we only have one service at a time + lock (m_ModelCost) + { + switch (m_FileAgentInventoryState) + { + case FileAgentInventoryState.processRequest: + case FileAgentInventoryState.processUpload: + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false); + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + break; + case FileAgentInventoryState.waitUpload: + // todo stop current uploader server + break; + case FileAgentInventoryState.idle: + default: + break; + } + + m_FileAgentInventoryState = FileAgentInventoryState.processRequest; + } + uint cost = 0; LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); @@ -447,15 +488,12 @@ namespace OpenSim.Region.ClientStack.Linden llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { - ScenePresence avatar = null; - IClientAPI client = null; + ScenePresence avatar = null; m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); // check user level if (avatar != null) { - client = avatar.ControllingClient; - if (avatar.UserLevel < m_levelUpload) { if (client != null) @@ -464,6 +502,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } } @@ -490,6 +530,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } cost = (uint)modelcost; @@ -509,6 +551,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } } @@ -555,8 +599,11 @@ namespace OpenSim.Region.ClientStack.Linden } uploader.OnUpLoad += UploadCompleteHandler; - return uploadResponse; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.waitUpload; + + return uploadResponse; } /// @@ -569,6 +616,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, uint cost) { + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.processUpload; + m_log.DebugFormat( "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", assetID, inventoryItem, inventoryType, assetType); @@ -730,12 +780,19 @@ namespace OpenSim.Region.ClientStack.Linden // build prims from instances for (int i = 0; i < instance_list.Count; i++) { + OSDMap inner_instance_list = (OSDMap)instance_list[i]; + + // skip prims that are 2 small + Vector3 scale = inner_instance_list["scale"].AsVector3(); + + if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin) + continue; + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); Primitive.TextureEntry textureEntry = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); - OSDMap inner_instance_list = (OSDMap)instance_list[i]; OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; for (uint face = 0; face < face_list.Count; face++) @@ -789,7 +846,6 @@ namespace OpenSim.Region.ClientStack.Linden } Vector3 position = inner_instance_list["position"].AsVector3(); - Vector3 scale = inner_instance_list["scale"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); // no longer used - begin ------------------------ @@ -903,6 +959,8 @@ namespace OpenSim.Region.ClientStack.Linden { AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; } /// @@ -1270,8 +1328,8 @@ namespace OpenSim.Region.ClientStack.Linden res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); - httpListener.RemoveStreamHandler("POST", uploaderPath); m_timeoutTimer.Stop(); + httpListener.RemoveStreamHandler("POST", uploaderPath); // TODO: probably make this a better set of extensions here string extension = ".jp2"; @@ -1289,7 +1347,6 @@ namespace OpenSim.Region.ClientStack.Linden { handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); } - return res; } -- cgit v1.1 From bf987f96d2339f1471ad5fc5b3df5a7a8b484d6e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 20 Sep 2012 14:32:30 +0100 Subject: Fix model upload rotations and offsets ( i hope ) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 159 ++++++++------------- 1 file changed, 56 insertions(+), 103 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d66076d..a139ea8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -128,9 +128,6 @@ namespace OpenSim.Region.ClientStack.Linden } private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; -// private bool m_addNewTextures = false; -// private bool m_addNewMeshes = false; - public BunchOfCaps(Scene scene, Caps caps) { m_Scene = scene; @@ -641,6 +638,7 @@ namespace OpenSim.Region.ClientStack.Linden } } + // strings to types if (inventoryType == "sound") { inType = (sbyte)InventoryType.Sound; @@ -687,45 +685,6 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); - /* - don't do this - replace it by optionaly making model textures cost less than if individually uploaded - since they can't be used for other purpuses - - // save it to inventory - if (m_addNewTextures && AddNewInventoryItem != null) - { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Texture#" + i.ToString(); - InventoryItemBase texitem = new InventoryItemBase(); - texitem.Owner = m_HostCapsObj.AgentID; - texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - texitem.CreatorData = String.Empty; - texitem.ID = UUID.Random(); - texitem.AssetID = textureAsset.FullID; - texitem.Description = "mesh model texture"; - texitem.Name = name; - texitem.AssetType = (int)AssetType.Texture; - texitem.InvType = (int)InventoryType.Texture; - texitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - texitem.BasePermissions = (uint)PermissionMask.All; - texitem.EveryOnePermissions = 0; - texitem.NextPermissions = (uint)PermissionMask.All; - texitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); - texitem = null; - } - */ - textureAsset = null; } // create and store meshs assets @@ -736,47 +695,9 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); - - /* this was a test, funny and showed viewers deal with mesh inventory itens - * nut also same reason as for textures - * let integrated in a model cost eventually less than hipotetical independent meshs assets - * that will be in inventory - // save it to inventory - if (m_addNewMeshes && AddNewInventoryItem != null) - { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Mesh#" + i.ToString(); - InventoryItemBase meshitem = new InventoryItemBase(); - meshitem.Owner = m_HostCapsObj.AgentID; - meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - meshitem.CreatorData = String.Empty; - meshitem.ID = UUID.Random(); - meshitem.AssetID = meshAsset.FullID; - meshitem.Description = "mesh "; - meshitem.Name = name; - meshitem.AssetType = (int)AssetType.Mesh; - meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - meshitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - meshitem.BasePermissions = (uint)PermissionMask.All; - meshitem.EveryOnePermissions = 0; - meshitem.NextPermissions = (uint)PermissionMask.All; - meshitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); - meshitem = null; - } - */ - meshAsset = null; } + int skipedMeshs = 0; // build prims from instances for (int i = 0; i < instance_list.Count; i++) { @@ -784,9 +705,12 @@ namespace OpenSim.Region.ClientStack.Linden // skip prims that are 2 small Vector3 scale = inner_instance_list["scale"].AsVector3(); - + if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin) + { + skipedMeshs++; continue; + } PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); @@ -836,21 +760,33 @@ namespace OpenSim.Region.ClientStack.Linden pbs.TextureEntry = textureEntry.GetBytes(); - int meshindx = inner_instance_list["mesh"].AsInteger(); - if (meshAssets.Count > meshindx) + bool hasmesh = false; + if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ... { - pbs.SculptEntry = true; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction - // data will be requested from asset on rez (i hope) + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + hasmesh = true; + } } Vector3 position = inner_instance_list["position"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); + // for now viwers do send fixed defaults + // but this may change +// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); + byte physicsShapeType = (byte)PhysShapeType.prim; // default for mesh is simple convex + if(hasmesh) + physicsShapeType = (byte) PhysShapeType.convex; // default for mesh is simple convex +// int material = inner_instance_list["material"].AsInteger(); + byte material = (byte)Material.Wood; + // no longer used - begin ------------------------ -// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); -// int material = inner_instance_list["material"].AsInteger(); // int mesh = inner_instance_list["mesh"].AsInteger(); // OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; @@ -872,7 +808,7 @@ namespace OpenSim.Region.ClientStack.Linden = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); prim.Scale = scale; - prim.OffsetPosition = position; +// prim.OffsetPosition = position; rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); @@ -883,6 +819,8 @@ namespace OpenSim.Region.ClientStack.Linden prim.CreationDate = Util.UnixTimeSinceEpoch(); prim.Name = assetName; prim.Description = ""; + prim.Material = material; + prim.PhysicsShapeType = physicsShapeType; // prim.BaseMask = (uint)base_mask; // prim.EveryoneMask = (uint)everyone_mask; @@ -896,25 +834,40 @@ namespace OpenSim.Region.ClientStack.Linden grp.AddPart(prim); } - // Fix first link number + Vector3 rootPos = positions[0]; + if (grp.Parts.Length > 1) + { + // Fix first link number grp.RootPart.LinkNum++; - Vector3 rootPos = positions[0]; - grp.AbsolutePosition = rootPos; - for (int i = 0; i < positions.Count; i++) - { - Vector3 offset = positions[i] - rootPos; - grp.Parts[i].OffsetPosition = offset; - } + Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]); + Quaternion tmprot; + Vector3 offset; + + // fix children rotations and positions + for (int i = 1; i < rotations.Count; i++) + { + tmprot = rotations[i]; + tmprot = rootRotConj * tmprot; + + grp.Parts[i].RotationOffset = tmprot; - for (int i = 0; i < rotations.Count; i++) + offset = positions[i] - rootPos; + + offset *= rootRotConj; + grp.Parts[i].OffsetPosition = offset; + } + + grp.AbsolutePosition = rootPos; + grp.UpdateGroupRotationR(rotations[0]); + } + else { - if (i != 0) - grp.Parts[i].RotationOffset = rotations[i]; + grp.AbsolutePosition = rootPos; + grp.UpdateGroupRotationR(rotations[0]); } - grp.UpdateGroupRotationR(rotations[0]); data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } -- cgit v1.1 From f9c24c9414134af04fea3dd6ff39800856aec10e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 21 Sep 2012 11:50:14 +0100 Subject: read model upload cost parameters from config [Economy] section --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a139ea8..1b47fca 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -118,6 +118,7 @@ namespace OpenSim.Region.ClientStack.Linden private string m_regionName; private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; + private bool m_enableFreeTestModelUpload = false; private enum FileAgentInventoryState : int { @@ -142,6 +143,11 @@ namespace OpenSim.Region.ClientStack.Linden // m_ModelCost.ObjectLinkedPartsMax = ?? // m_PrimScaleMin = ?? + float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; + float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; + float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; + + IConfigSource config = m_Scene.Config; if (config != null) { @@ -156,6 +162,20 @@ namespace OpenSim.Region.ClientStack.Linden { m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); } + // economy for model upload + IConfig EconomyConfig = config.Configs["Economy"]; + if (EconomyConfig != null) + { + modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); + modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); + modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); + m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); + + m_ModelCost.ModelMeshCostFactor = modelUploadFactor; + m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; + m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; + } + } m_assetService = m_Scene.AssetService; @@ -912,6 +932,7 @@ namespace OpenSim.Region.ClientStack.Linden { AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } + lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.idle; } -- cgit v1.1 From 4bba72b7afc104ea5a42acb6206c1c07fbba099b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Sep 2012 16:47:15 +0100 Subject: removed AssetUploaderWithCost, fixing AssetUploader. add parsing of some more needed fields in request --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 66 ++++++++-------------- 1 file changed, 24 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 1b47fca..b64453a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -54,8 +54,8 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; 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); + string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, + byte[] data, string inventoryType, string assetType, int cost); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -119,6 +119,7 @@ namespace OpenSim.Region.ClientStack.Linden private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; private bool m_enableFreeTestModelUpload = false; + private bool m_enableModelUploadTextureToInventory = false; private enum FileAgentInventoryState : int { @@ -147,7 +148,6 @@ namespace OpenSim.Region.ClientStack.Linden float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; - IConfigSource config = m_Scene.Config; if (config != null) { @@ -170,12 +170,12 @@ namespace OpenSim.Region.ClientStack.Linden modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); + m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; } - } m_assetService = m_Scene.AssetService; @@ -426,37 +426,13 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } - - private delegate void UploadWithCostCompleteDelegate(string assetName, - string assetDescription, UUID assetID, UUID inventoryItem, - UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost); - - private class AssetUploaderWithCost : AssetUploader +/* + private class AssetUploaderExtraParameters { - private uint m_cost; + public int total_cost; + public UUID textureFolder = UUID.Zero; +*/ - public event UploadWithCostCompleteDelegate OnUpLoad; - - public AssetUploaderWithCost(string assetName, string description, UUID assetID, - UUID inventoryItem, UUID parentFolderID, string invType, string assetType, - string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : - base(assetName, description, assetID, inventoryItem, parentFolderID, - invType, assetType, path, httpServer, dumpAssetsToFile) - { - m_cost = cost; - - base.OnUpLoad += UploadCompleteHandler; - } - - private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) - { - OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, - data, inventoryType, assetType, m_cost); - } - } /// /// @@ -497,7 +473,7 @@ namespace OpenSim.Region.ClientStack.Linden m_FileAgentInventoryState = FileAgentInventoryState.processRequest; } - uint cost = 0; + int cost = 0; LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -551,11 +527,11 @@ namespace OpenSim.Region.ClientStack.Linden m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } - cost = (uint)modelcost; + cost = modelcost; } else { - cost = (uint)baseCost; + cost = baseCost; } // check funds @@ -584,8 +560,8 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploaderWithCost uploader = - new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + AssetUploader uploader = + new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( @@ -631,7 +607,7 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost) + string assetType, int cost) { lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.processUpload; @@ -920,6 +896,7 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. + item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); @@ -930,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); + AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); } lock (m_ModelCost) @@ -1247,6 +1224,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event UpLoadedAsset OnUpLoad; private UpLoadedAsset handlerUpLoad = null; @@ -1261,11 +1239,14 @@ namespace OpenSim.Region.ClientStack.Linden private string m_invType = String.Empty; private string m_assetType = String.Empty; + private int m_cost; + private Timer m_timeoutTimer = new Timer(); + public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, - IHttpServer httpServer, bool dumpAssetsToFile) + IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) { m_assetName = assetName; m_assetDes = description; @@ -1277,6 +1258,7 @@ namespace OpenSim.Region.ClientStack.Linden m_assetType = assetType; m_invType = invType; m_dumpAssetsToFile = dumpAssetsToFile; + m_cost = totalCost; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1319,7 +1301,7 @@ namespace OpenSim.Region.ClientStack.Linden handlerUpLoad = OnUpLoad; if (handlerUpLoad != null) { - handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); + handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost); } return res; } -- cgit v1.1 From 11e05217df2de7ce7da581a2332ee4871f75a527 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Sep 2012 21:14:15 +0100 Subject: report asset upload errors the right away --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 80 +++++++++++++++++----- 1 file changed, 64 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index b64453a..a934113 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -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 /// 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(); 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 positions = new List(); List rotations = new List(); 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; } -- cgit v1.1 From 64db9e41143c36ee1638f2c453b4645ff4ed008f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 23 Sep 2012 15:04:10 +0100 Subject: try to allow free uploads for testing, if users prefix names with "TEST-". Let textures get into inventory again. Both features under config control. Have direct warnings to client, including a final one on upload complete since i see nothing. problems: textures don't showup in inventory til relog, also issues with permitions. A few more changes --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 225 +++++++++++++++++---- 1 file changed, 190 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a934113..21a1005 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -55,7 +55,9 @@ 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, ref string error); + byte[] data, string inventoryType, string assetType, + int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -118,8 +120,9 @@ namespace OpenSim.Region.ClientStack.Linden private string m_regionName; private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; - private bool m_enableFreeTestModelUpload = false; + private bool m_enableFreeTestUpload = false; private bool m_enableModelUploadTextureToInventory = false; + private UUID m_testAssetsCreatorID = UUID.Zero; private enum FileAgentInventoryState : int { @@ -148,6 +151,9 @@ namespace OpenSim.Region.ClientStack.Linden float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; + // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config + UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); + IConfigSource config = m_Scene.Config; if (config != null) { @@ -169,9 +175,18 @@ namespace OpenSim.Region.ClientStack.Linden modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); - m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); + m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); + string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); + if (testcreator != "") + { + UUID id; + UUID.TryParse(testcreator, out id); + if (id != null) + m_testAssetsCreatorID = id; + } + m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; @@ -426,13 +441,6 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } -/* - private class AssetUploaderExtraParameters - { - public int total_cost; - public UUID textureFolder = UUID.Zero; -*/ - /// /// @@ -477,6 +485,11 @@ namespace OpenSim.Region.ClientStack.Linden } int cost = 0; + int nreqtextures = 0; + int nreqmeshs= 0; + int nreqinstances = 0; + bool IsAtestUpload = false; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -496,7 +509,6 @@ namespace OpenSim.Region.ClientStack.Linden resperror.message = "Insufficient permissions to upload"; resperror.identifier = UUID.Zero; - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; @@ -516,13 +528,15 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) baseCost = mm.UploadCharge; + string warning = String.Empty; + if (llsdRequest.asset_type == "mesh") { string error; int modelcost; - + if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata, out error)) + meshcostdata, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -544,8 +558,21 @@ namespace OpenSim.Region.ClientStack.Linden cost = baseCost; } + if (m_enableFreeTestUpload && cost > 0 && mm != null) + { + string str = llsdRequest.name; + if (str.Length > 5 && str.StartsWith("TEST-")) + { + warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; + IsAtestUpload = true; + } + } + + if (client != null && warning != String.Empty) + client.SendAgentAlertMessage(warning, true); + // check funds - if (mm != null) + if (!IsAtestUpload && mm != null && cost >0) { if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -572,10 +599,15 @@ namespace OpenSim.Region.ClientStack.Linden UUID newInvItem = UUID.Random(); UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + UUID texturesFolder = UUID.Zero; + + if(!IsAtestUpload && m_enableModelUploadTextureToInventory) + texturesFolder = llsdRequest.texture_folder_id; AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, + texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -620,7 +652,9 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType, int cost, ref string error) + string assetType, int cost, + UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload, ref string error) { lock (m_ModelCost) @@ -633,6 +667,18 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + UUID owner_id = m_HostCapsObj.AgentID; + UUID creatorID; + + bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); + + if (istest) + creatorID = m_testAssetsCreatorID; + else + creatorID = owner_id; + + string creatorIDstr = creatorID.ToString(); + IMoneyModule mm = m_Scene.RequestModuleInterface(); if (mm != null) { @@ -703,20 +749,56 @@ namespace OpenSim.Region.ClientStack.Linden SceneObjectGroup grp = null; // create and store texture assets + bool doTextInv = (!istest && m_enableModelUploadTextureToInventory && + texturesFolder != UUID.Zero); + + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) { - AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + + if (doTextInv) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = creatorIDstr; + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = texturesFolder; + + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + // this aren't showing up in viewer until relog :( + } } // create and store meshs assets List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); @@ -827,7 +909,7 @@ namespace OpenSim.Region.ClientStack.Linden // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - UUID owner_id = m_HostCapsObj.AgentID; + SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); @@ -837,13 +919,29 @@ namespace OpenSim.Region.ClientStack.Linden rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); - prim.CreatorID = owner_id; + prim.CreatorID = creatorID; prim.OwnerID = owner_id; prim.GroupID = UUID.Zero; - prim.LastOwnerID = prim.OwnerID; + prim.LastOwnerID = creatorID; prim.CreationDate = Util.UnixTimeSinceEpoch(); - prim.Name = assetName; - prim.Description = ""; + + if (grp == null) + prim.Name = assetName; + else + prim.Name = assetName + "#" + i.ToString(); + + if (istest) + { + prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + prim.EveryoneMask = 0; + prim.GroupMask = 0; + prim.NextOwnerMask = 0; + prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + + prim.Description = "For personal testing only. Other uses are forbiden"; + } + else + prim.Description = ""; prim.Material = material; prim.PhysicsShapeType = physicsShapeType; @@ -854,7 +952,10 @@ namespace OpenSim.Region.ClientStack.Linden // prim.OwnerMask = (uint)owner_mask; if (grp == null) + { grp = new SceneObjectGroup(prim); + grp.LastOwnerID = creatorID; + } else grp.AddPart(prim); } @@ -904,7 +1005,7 @@ namespace OpenSim.Region.ClientStack.Linden } AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); + asset = new AssetBase(assetID, assetName, assType, creatorIDstr); asset.Data = data; if (AddNewAsset != null) AddNewAsset(asset); @@ -913,11 +1014,14 @@ namespace OpenSim.Region.ClientStack.Linden InventoryItemBase item = new InventoryItemBase(); item.Owner = m_HostCapsObj.AgentID; - item.CreatorId = m_HostCapsObj.AgentID.ToString(); + item.CreatorId = creatorIDstr; item.CreatorData = String.Empty; item.ID = inventoryItem; item.AssetID = asset.FullID; - item.Description = assetDescription; + if (istest) + item.Description = "For personal testing only. Other uses are forbiden"; + else + item.Description = assetDescription; item.Name = assetName; item.AssetType = assType; item.InvType = inType; @@ -926,17 +1030,53 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + if (istest) + { + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Modify); + + item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); + item.EveryOnePermissions = 0; + item.NextPermissions = 0; + } + else + { + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + item.BasePermissions = (uint)PermissionMask.All; + item.EveryOnePermissions = 0; + item.NextPermissions = (uint)PermissionMask.All; + } - item.BasePermissions = (uint)PermissionMask.All; - item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; item.CreationDate = Util.UnixTimeSinceEpoch(); + IClientAPI client = null; + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); + if (istest) + { + AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); + if (client != null) + client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); + } + else + { + AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost); + if (client != null) + { + // let users see anything.. i don't so far + string str; + if (cost > 0) + // dont remember where is money unit name to put here + str = "Upload complete. charged " + cost.ToString() + "$"; + else + str = "Upload complete"; + client.SendAgentAlertMessage(str, true); + } + } } lock (m_ModelCost) @@ -1272,11 +1412,17 @@ namespace OpenSim.Region.ClientStack.Linden private string m_error = String.Empty; private Timer m_timeoutTimer = new Timer(); - + private UUID m_texturesFolder; + private int m_nreqtextures; + private int m_nreqmeshs; + private int m_nreqinstances; + private bool m_IsAtestUpload; public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, - IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) + IHttpServer httpServer, bool dumpAssetsToFile, + int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload) { m_assetName = assetName; m_assetDes = description; @@ -1290,6 +1436,12 @@ namespace OpenSim.Region.ClientStack.Linden m_dumpAssetsToFile = dumpAssetsToFile; m_cost = totalCost; + m_texturesFolder = texturesFolder; + m_nreqtextures = nreqtextures; + m_nreqmeshs = nreqmeshs; + m_nreqinstances = nreqinstances; + m_IsAtestUpload = IsAtestUpload; + m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; m_timeoutTimer.AutoReset = false; @@ -1332,12 +1484,15 @@ 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, ref m_error); + handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, + m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); } if(m_error == String.Empty) { uploadComplete.new_asset = newAssetID.ToString(); uploadComplete.new_inventory_item = inv; +// if (m_texturesFolder != UUID.Zero) +// uploadComplete.new_texture_folder_id = m_texturesFolder; uploadComplete.state = "complete"; } else -- cgit v1.1 From a1a0a90720e65ce104699abb6dcd46b5cb34a6db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Sep 2012 22:57:33 +0100 Subject: more upload changes (plus untouch prebuild.xml) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 183 ++++++++++++++------- 1 file changed, 123 insertions(+), 60 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 21a1005..4a323d8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -118,12 +118,20 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_assetService; private bool m_dumpAssetsToFile = false; private string m_regionName; + private int m_levelUpload = 0; - private float m_PrimScaleMin = 0.001f; - private bool m_enableFreeTestUpload = false; - private bool m_enableModelUploadTextureToInventory = false; + + private bool m_enableFreeTestUpload = false; // allows "TEST-" prefix hack + private bool m_ForceFreeTestUpload = false; // forces all uploads to be test + + private bool m_enableModelUploadTextureToInventory = false; // place uploaded textures also in inventory + // may not be visible till relog + + private bool m_RestrictFreeTestUploadPerms = false; // reduces also the permitions. Needs a creator defined!! private UUID m_testAssetsCreatorID = UUID.Zero; + private float m_PrimScaleMin = 0.001f; + private enum FileAgentInventoryState : int { idle = 0, @@ -143,16 +151,16 @@ namespace OpenSim.Region.ClientStack.Linden // tell it about scene object limits m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; -// m_ModelCost.PrimScaleMin = ?? + // m_ModelCost.ObjectLinkedPartsMax = ?? -// m_PrimScaleMin = ?? +// m_ModelCost.PrimScaleMin = ?? + m_PrimScaleMin = m_ModelCost.PrimScaleMin; float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; - - // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config - UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); + float modelPrimCreationCost = m_ModelCost.primCreationCost; + float modelMeshByteCost = m_ModelCost.bytecost; IConfigSource config = m_Scene.Config; if (config != null) @@ -175,10 +183,16 @@ namespace OpenSim.Region.ClientStack.Linden modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); - m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); + // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost + modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost); + modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost); - m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); - string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); + m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory); + + m_RestrictFreeTestUploadPerms = EconomyConfig.GetBoolean("m_RestrictFreeTestUploadPerms", m_RestrictFreeTestUploadPerms); + m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload); + m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload); + string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", ""); if (testcreator != "") { UUID id; @@ -190,6 +204,8 @@ namespace OpenSim.Region.ClientStack.Linden m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; + m_ModelCost.primCreationCost = modelPrimCreationCost; + m_ModelCost.bytecost = modelMeshByteCost; } } @@ -490,6 +506,8 @@ namespace OpenSim.Region.ClientStack.Linden int nreqinstances = 0; bool IsAtestUpload = false; + string assetName = llsdRequest.name; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -497,7 +515,7 @@ namespace OpenSim.Region.ClientStack.Linden llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { - ScenePresence avatar = null; + ScenePresence avatar = null; m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); // check user level @@ -519,7 +537,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - // check funds + // check test upload and funds if (client != null) { IMoneyModule mm = m_Scene.RequestModuleInterface(); @@ -558,41 +576,53 @@ namespace OpenSim.Region.ClientStack.Linden cost = baseCost; } - if (m_enableFreeTestUpload && cost > 0 && mm != null) + if (cost > 0 && mm != null) { - string str = llsdRequest.name; - if (str.Length > 5 && str.StartsWith("TEST-")) + // check for test upload + + if (m_ForceFreeTestUpload) // all are test { - warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; + if (!(assetName.Length > 5 && assetName.StartsWith("TEST-"))) // has normal name lets change it + assetName = "TEST-" + assetName; + IsAtestUpload = true; } - } - - if (client != null && warning != String.Empty) - client.SendAgentAlertMessage(warning, true); - // check funds - if (!IsAtestUpload && mm != null && cost >0) - { - if (!mm.UploadCovered(client.AgentId, (int)cost)) + else if (m_enableFreeTestUpload) // only if prefixed with "TEST-" { - 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; + IsAtestUpload = (assetName.Length > 5 && assetName.StartsWith("TEST-")); + } + + + if(IsAtestUpload) // let user know, still showing cost estimation + warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; + + // check funds + else + { + if (!mm.UploadCovered(client.AgentId, (int)cost)) + { + 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; + } } } + + if (client != null && warning != String.Empty) + client.SendAgentAlertMessage(warning, true); } } - - string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; UUID newAsset = UUID.Random(); @@ -607,7 +637,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -667,12 +697,16 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + IClientAPI client = null; + UUID owner_id = m_HostCapsObj.AgentID; UUID creatorID; bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); - if (istest) + bool restrictPerms = m_RestrictFreeTestUploadPerms && istest; + + if (istest && m_testAssetsCreatorID != UUID.Zero) creatorID = m_testAssetsCreatorID; else creatorID = owner_id; @@ -755,10 +789,19 @@ namespace OpenSim.Region.ClientStack.Linden List textures = new List(); + + if (doTextInv) + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + + if(client == null) // don't put textures in inventory if there is no client + doTextInv = false; + for (int i = 0; i < texture_list.Count; i++) { AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); textureAsset.Data = texture_list[i].AsBinary(); + if (istest) + textureAsset.Local = true; m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); @@ -788,9 +831,8 @@ namespace OpenSim.Region.ClientStack.Linden texitem.NextPermissions = (uint)PermissionMask.All; texitem.CreationDate = Util.UnixTimeSinceEpoch(); - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + m_Scene.AddInventoryItem(client, texitem); texitem = null; - // this aren't showing up in viewer until relog :( } } @@ -800,6 +842,8 @@ namespace OpenSim.Region.ClientStack.Linden { AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); + if (istest) + meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); } @@ -908,14 +952,12 @@ namespace OpenSim.Region.ClientStack.Linden // UUID owner_id = permissions["owner_id"].AsUUID(); // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - - + SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); prim.Scale = scale; -// prim.OffsetPosition = position; rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); @@ -930,18 +972,20 @@ namespace OpenSim.Region.ClientStack.Linden else prim.Name = assetName + "#" + i.ToString(); - if (istest) + if (restrictPerms) { prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); prim.EveryoneMask = 0; prim.GroupMask = 0; prim.NextOwnerMask = 0; prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + } + if(istest) prim.Description = "For personal testing only. Other uses are forbiden"; - } else prim.Description = ""; + prim.Material = material; prim.PhysicsShapeType = physicsShapeType; @@ -1007,6 +1051,8 @@ namespace OpenSim.Region.ClientStack.Linden AssetBase asset; asset = new AssetBase(assetID, assetName, assType, creatorIDstr); asset.Data = data; + if (istest) + asset.Local = true; if (AddNewAsset != null) AddNewAsset(asset); else if (m_assetService != null) @@ -1019,7 +1065,10 @@ namespace OpenSim.Region.ClientStack.Linden item.ID = inventoryItem; item.AssetID = asset.FullID; if (istest) + { item.Description = "For personal testing only. Other uses are forbiden"; + item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); + } else item.Description = assetDescription; item.Name = assetName; @@ -1030,7 +1079,7 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - if (istest) + if (restrictPerms) { item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); @@ -1051,16 +1100,18 @@ namespace OpenSim.Region.ClientStack.Linden item.CreationDate = Util.UnixTimeSinceEpoch(); - IClientAPI client = null; m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if (AddNewInventoryItem != null) { if (istest) { + m_Scene.AddInventoryItem(client, item); +/* AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); if (client != null) - client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); + client.SendAgentAlertMessage("Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on a another region" , true); + */ } else { @@ -1487,22 +1538,34 @@ namespace OpenSim.Region.ClientStack.Linden handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); } - if(m_error == String.Empty) - { - uploadComplete.new_asset = newAssetID.ToString(); - uploadComplete.new_inventory_item = inv; -// if (m_texturesFolder != UUID.Zero) -// uploadComplete.new_texture_folder_id = m_texturesFolder; - uploadComplete.state = "complete"; - } - else + if (m_IsAtestUpload) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = m_error; + resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; resperror.identifier = inv; uploadComplete.error = resperror; - uploadComplete.state = "failed"; + uploadComplete.state = "Upload4Testing"; + } + else + { + if (m_error == String.Empty) + { + uploadComplete.new_asset = newAssetID.ToString(); + uploadComplete.new_inventory_item = inv; + // if (m_texturesFolder != UUID.Zero) + // uploadComplete.new_texture_folder_id = m_texturesFolder; + 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); -- cgit v1.1 From 421071bd8a489b90d3ddd58add7135b178f59381 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 24 Sep 2012 23:19:57 +0200 Subject: Text changes for upload messages --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 4a323d8..c705f10 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack.Linden if(IsAtestUpload) // let user know, still showing cost estimation - warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; + warning += "Upload will have no cost, for testing purposes only. Other uses are prohibited. Items will not work after 48 hours or on other regions"; // check funds else @@ -982,7 +982,7 @@ namespace OpenSim.Region.ClientStack.Linden } if(istest) - prim.Description = "For personal testing only. Other uses are forbiden"; + prim.Description = "For testing only. Other uses are prohibited"; else prim.Description = ""; @@ -1066,7 +1066,7 @@ namespace OpenSim.Region.ClientStack.Linden item.AssetID = asset.FullID; if (istest) { - item.Description = "For personal testing only. Other uses are forbiden"; + item.Description = "For testing only. Other uses are prohibited"; item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); } else @@ -1541,7 +1541,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_IsAtestUpload) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; + resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are prohibited. Item will not work after 48 hours or on other regions"; resperror.identifier = inv; uploadComplete.error = resperror; -- cgit v1.1 From 2e8e8d576e342e4036b278805137ad68066dcbad Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 18 Oct 2012 13:20:50 +0200 Subject: Remove redundant and annoyingly modal message box in upload processing. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index c705f10..650cd50 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1116,17 +1116,17 @@ namespace OpenSim.Region.ClientStack.Linden else { AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost); - if (client != null) - { - // let users see anything.. i don't so far - string str; - if (cost > 0) - // dont remember where is money unit name to put here - str = "Upload complete. charged " + cost.ToString() + "$"; - else - str = "Upload complete"; - client.SendAgentAlertMessage(str, true); - } +// if (client != null) +// { +// // let users see anything.. i don't so far +// string str; +// if (cost > 0) +// // dont remember where is money unit name to put here +// str = "Upload complete. charged " + cost.ToString() + "$"; +// else +// str = "Upload complete"; +// client.SendAgentAlertMessage(str, true); +// } } } -- cgit v1.1 From 0a393b317dd6449e5a4ebbfc41dd3c8f4d9b2092 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 8 Jan 2013 22:32:39 +0100 Subject: Add the new UpdateAgentInformation cap to make maturity on more recent viewers work. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index f6146a9..b06788b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -103,6 +103,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_getObjectPhysicsDataPath = "0101/"; private static readonly string m_getObjectCostPath = "0102/"; private static readonly string m_ResourceCostSelectedPath = "0103/"; + private static readonly string m_UpdateAgentInformationPath = "0500/"; // These are callbacks which will be setup by the scene so that we can update scene data when we @@ -287,6 +288,8 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); + m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); m_HostCapsObj.RegisterHandler( "CopyInventoryFromNotecard", @@ -1438,6 +1441,22 @@ namespace OpenSim.Region.ClientStack.Linden string response = OSDParser.SerializeLLSDXmlString(resp); return response; } + + public string UpdateAgentInformation(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + OSDMap accessPrefs = new OSDMap(); + accessPrefs["max"] = "A"; + + resp["access_prefs"] = accessPrefs; + + string response = OSDParser.SerializeLLSDXmlString(resp); + return response; + } } public class AssetUploader -- cgit v1.1 From 6aa876a83b08390ab057eb012fd2c730010f79d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 83347e2..d7d4708 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1316,7 +1316,7 @@ namespace OpenSim.Region.ClientStack.Linden object_data["PhysicsShapeType"] = obj.PhysicsShapeType; object_data["Density"] = obj.Density; object_data["Friction"] = obj.Friction; - object_data["Restitution"] = obj.Bounciness; + object_data["Restitution"] = obj.Restitution; object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; -- cgit v1.1 From bbda7b94b3fe2350d5413879388cfce7309ca907 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index b06788b..2bb3d38 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1317,7 +1317,7 @@ namespace OpenSim.Region.ClientStack.Linden object_data["PhysicsShapeType"] = obj.PhysicsShapeType; object_data["Density"] = obj.Density; object_data["Friction"] = obj.Friction; - object_data["Restitution"] = obj.Bounciness; + object_data["Restitution"] = obj.Restitution; object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; -- cgit v1.1 From 8c0b9080a4fb013d559966fc8c8175fb16162c2d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Feb 2013 21:09:14 +0100 Subject: Fix an issue where the viewer would request the seed cap before there was a handler for it. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2bb3d38..248eab6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -343,6 +343,9 @@ namespace OpenSim.Region.ClientStack.Linden m_log.DebugFormat( "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); + if (!m_HostCapsObj.WaitForActivation()) + return string.Empty; + if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) { m_log.WarnFormat( -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index eadca9b..921d3bf 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -50,6 +50,7 @@ using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDMap = OpenMetaverse.StructuredData.OSDMap; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.ClientStack.Linden { @@ -830,9 +831,9 @@ namespace OpenSim.Region.ClientStack.Linden texitem.Folder = texturesFolder; texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - texitem.BasePermissions = (uint)PermissionMask.All; + texitem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; texitem.EveryOnePermissions = 0; texitem.NextPermissions = (uint)PermissionMask.All; texitem.CreationDate = Util.UnixTimeSinceEpoch(); @@ -1097,9 +1098,9 @@ namespace OpenSim.Region.ClientStack.Linden else { item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - item.BasePermissions = (uint)PermissionMask.All; + item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; item.EveryOnePermissions = 0; item.NextPermissions = (uint)PermissionMask.All; } -- cgit v1.1 From 0af1d8fe196e403c066f7fc3dbc9f4b897b4da2c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Apr 2013 23:35:59 +0200 Subject: Fix CAPS to work like they should - do not send caps to the viewer if they're not in the requested caps list. The previous wrong behavior caused the debug setting "UseHTTPInventory" to fail on all viewers when turned off. UDB inventory would not be correctly used in that case. --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 921d3bf..59b9585 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -355,11 +355,22 @@ namespace OpenSim.Region.ClientStack.Linden return string.Empty; } - Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true); + OSDArray capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(request); + List validCaps = new List(); + + foreach (OSD c in capsRequested) + validCaps.Add(c.AsString()); + + Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); // Add the external too foreach (KeyValuePair kvp in m_HostCapsObj.ExternalCapsHandlers) + { + if (!validCaps.Contains(kvp.Key)) + continue; + caps[kvp.Key] = kvp.Value; + } string result = LLSDHelpers.SerialiseLLSDReply(caps); -- cgit v1.1 From 745a209bf2cf2465717f2d17fd5a506221c63ac5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 10 Jun 2013 01:16:22 +0200 Subject: Explicitly set uploaded mesh object perms --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 59b9585..8241e07 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -990,13 +990,20 @@ namespace OpenSim.Region.ClientStack.Linden else prim.Name = assetName + "#" + i.ToString(); + prim.EveryoneMask = 0; + prim.GroupMask = 0; + if (restrictPerms) { prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); - prim.EveryoneMask = 0; - prim.GroupMask = 0; - prim.NextOwnerMask = 0; prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + prim.NextOwnerMask = 0; + } + else + { + prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export; + prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export; + prim.NextOwnerMask = (uint)PermissionMask.Transfer; } if(istest) @@ -1099,21 +1106,17 @@ namespace OpenSim.Region.ClientStack.Linden if (restrictPerms) { - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Modify); - item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); + item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); item.EveryOnePermissions = 0; item.NextPermissions = 0; } else { - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; + item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; + item.NextPermissions = (uint)PermissionMask.Transfer; } item.CreationDate = Util.UnixTimeSinceEpoch(); -- cgit v1.1 From 2eb1c1c37765a42fd24467f26cf53e7443d5a75b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 15:15:27 +0100 Subject: move from RegisterInventoryServiceHandlers to RegisterRegionServiceHandlers what belongs there ( readabilitly only ) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 613bc24..3949f8b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -248,7 +248,19 @@ namespace OpenSim.Region.ClientStack.Linden //m_capsHandlers["MapLayer"] = // new LLSDStreamhandler("POST", // capsBase + m_mapLayerPath, - // GetMapLayer); + // GetMapLayer); + + IRequestHandler getObjectPhysicsDataHandler + = new RestStreamHandler( + "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); + m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); + + IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); + m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); + IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + + IRequestHandler req = new RestStreamHandler( "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); @@ -283,14 +295,7 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); - IRequestHandler getObjectPhysicsDataHandler - = new RestStreamHandler( - "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); - m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); - IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); - m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); - IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); - m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler( -- cgit v1.1 From 601c50dc1e2e590a227a7b641be68cbcde6c279d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 16:19:07 +0100 Subject: return even zero costs ( prims on other regions ) --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3949f8b..0141940 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1448,7 +1448,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - if (simul != 0) + // if (simul != 0) { OSDMap object_data = new OSDMap(); -- cgit v1.1 From c84a3c3630fe678d618667ee472a0852f2921f64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 16:22:46 +0100 Subject: also on other case --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0141940..61b9045 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1384,6 +1384,17 @@ namespace OpenSim.Region.ClientStack.Linden resp[uuid.ToString()] = object_data; } + else + { + OSDMap object_data = new OSDMap(); + object_data["linked_set_resource_cost"] = 0; + object_data["resource_cost"] = 0; + object_data["physics_cost"] = 0; + object_data["linked_set_physics_cost"] = 0; + + resp[uuid.ToString()] = object_data; + } + } } -- cgit v1.1 From 18cc33e2c55539596363a0233bc680034bfacef6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 13:35:30 +0100 Subject: add animationset to upload assets, for now no cost --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 61b9045..593bd52 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -757,6 +757,12 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } + else if (inventoryType == "animationset") + { + inType = (sbyte)CustomInventoryType.AnimationSet; + assType = (sbyte)CustomAssetType.AnimationSet; + m_log.Debug("got animationset upload request"); + } else if (inventoryType == "wearable") { inType = (sbyte)InventoryType.Wearable; -- cgit v1.1 From f51779bb05b29558e3908ad9931ed61ddc61f390 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 14:10:44 +0100 Subject: add also the name animset until its clear the name liru will use --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 593bd52..01d4248 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -757,12 +757,19 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } +// add add both animationset and animset until is clear what name Liru will use else if (inventoryType == "animationset") { inType = (sbyte)CustomInventoryType.AnimationSet; assType = (sbyte)CustomAssetType.AnimationSet; m_log.Debug("got animationset upload request"); } + else if (inventoryType == "animset") + { + inType = (sbyte)CustomInventoryType.AnimationSet; + assType = (sbyte)CustomAssetType.AnimationSet; + m_log.Debug("got animset upload request"); + } else if (inventoryType == "wearable") { inType = (sbyte)InventoryType.Wearable; -- cgit v1.1 From 57166878b54ca1495e244a2a1ef791129b42d70f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 16:37:43 +0100 Subject: fix animation asset name to "animatn", use "animset" for the new animationSet --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 01d4248..9b12dd2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -530,6 +530,7 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || + llsdRequest.asset_type == "animatn" || // this is the asset name actually used by viewers llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { @@ -757,13 +758,6 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } -// add add both animationset and animset until is clear what name Liru will use - else if (inventoryType == "animationset") - { - inType = (sbyte)CustomInventoryType.AnimationSet; - assType = (sbyte)CustomAssetType.AnimationSet; - m_log.Debug("got animationset upload request"); - } else if (inventoryType == "animset") { inType = (sbyte)CustomInventoryType.AnimationSet; @@ -1121,7 +1115,15 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - if (restrictPerms) + if (inType == (sbyte)CustomInventoryType.AnimationSet) + { + item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + item.CurrentPermissions = (uint)(PermissionMask.Copy| PermissionMask.Modify); + item.EveryOnePermissions = 0; + item.NextPermissions = 0; + } + + else if (restrictPerms) { item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); -- cgit v1.1 From 3a42ea52792438b44c6ddbd17eaad93c32263bbb Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2014 21:21:20 +0200 Subject: Extend upload verification to all upload paths --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 9b12dd2..0e38d05 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_getObjectCostPath = "0102/"; private static readonly string m_ResourceCostSelectedPath = "0103/"; private static readonly string m_UpdateAgentInformationPath = "0500/"; + private static readonly string m_animSetTaskUpdatePath = "0260/"; // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls @@ -267,6 +268,12 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); + +// IRequestHandler animSetRequestHandler +// = new RestStreamHandler( +// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null); + +// m_HostCapsObj.RegisterHandler("UpdateAnimSetTaskInventory", animSetRequestHandler); } catch (Exception e) { @@ -292,6 +299,7 @@ namespace OpenSim.Region.ClientStack.Linden "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); + m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); -- cgit v1.1 From 5f57b55dc97eb943af4c0429a68f074b490fffd7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:08:21 +0100 Subject: use central animationset permitions define --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0e38d05..a32593a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,8 +1125,8 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); - item.CurrentPermissions = (uint)(PermissionMask.Copy| PermissionMask.Modify); + item.BasePermissions = AnimationSet.allowedPermitions; + item.CurrentPermissions = AnimationSet.allowedPermitions; item.EveryOnePermissions = 0; item.NextPermissions = 0; } -- cgit v1.1 From fcad64209c29c55cbec78ae94f221120e9956ebf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:17:01 +0100 Subject: make c# more happy --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a32593a..a31532b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,10 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - item.BasePermissions = AnimationSet.allowedPermitions; - item.CurrentPermissions = AnimationSet.allowedPermitions; - item.EveryOnePermissions = 0; - item.NextPermissions = 0; + AnimationSet.enforceItemPermitions(ref item); } else if (restrictPerms) -- cgit v1.1 From 90cad824050ffbd081baf5338638e2e6d95903f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:22:54 +0100 Subject: remove unnecessary argument ref --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a31532b..1e28db0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,7 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - AnimationSet.enforceItemPermitions(ref item); + AnimationSet.enforceItemPermitions(item); } else if (restrictPerms) -- cgit v1.1 From 46caea6987a24e07f61e3c3bef24ab4495899bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 15:03:33 +0100 Subject: change it again... --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 1e28db0..75634e0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,7 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - AnimationSet.enforceItemPermitions(item); + AnimationSet.setCreateItemPermitions(item); } else if (restrictPerms) -- cgit v1.1 From 1a6ef2d60e4aff73e614ef45a0040c45316707f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 10:01:26 +0100 Subject: check for avatar skeleton data on meshs headers on cost estimation. Dont let a model have more than one mesh with skeleton, for testing create a mesh inventory item, for this meshs. Add also option to read a avatar collider replacement. This information still needs to be saved somewhere so it can be checked on attachment, etc, without parsing the mesh asset again. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 68 ++++++++++++++++++++-- 1 file changed, 62 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 75634e0..3a070c3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload, ref string error); + bool IsAtestUpload, bool avatarSkeleton, bool avatarCollider, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -531,6 +531,8 @@ namespace OpenSim.Region.ClientStack.Linden int nreqmeshs= 0; int nreqinstances = 0; bool IsAtestUpload = false; + bool avatarSkeleton = false; + bool avatarCollider = false; string assetName = llsdRequest.name; @@ -580,8 +582,9 @@ namespace OpenSim.Region.ClientStack.Linden string error; int modelcost; + if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata, out error, ref warning)) + meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -664,7 +667,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -711,7 +714,7 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload, ref string error) + bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error) { lock (m_ModelCost) @@ -877,12 +880,60 @@ namespace OpenSim.Region.ClientStack.Linden List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { +/* + // do we really need this heavy thing? + OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); + if (osd is OSDMap) + { + OSDMap mosd = (OSDMap)osd; + if (mosd.ContainsKey("skeleton")) + { + OSDMap skeleton = (OSDMap)mosd["skeleton"]; + int sksize = skeleton["size"].AsInteger(); + } + } +*/ + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); if (istest) meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); + + + // test code + if (avatarSkeleton) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = creatorIDstr; + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + m_Scene.AddInventoryItem(client, meshitem); + meshitem = null; + } } int skipedMeshs = 0; @@ -1540,12 +1591,14 @@ namespace OpenSim.Region.ClientStack.Linden private int m_nreqmeshs; private int m_nreqinstances; private bool m_IsAtestUpload; + private bool m_avatarSkeleton; + private bool m_avatarCollider; public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, IHttpServer httpServer, bool dumpAssetsToFile, int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload) + bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider) { m_assetName = assetName; m_assetDes = description; @@ -1564,6 +1617,8 @@ namespace OpenSim.Region.ClientStack.Linden m_nreqmeshs = nreqmeshs; m_nreqinstances = nreqinstances; m_IsAtestUpload = IsAtestUpload; + m_avatarSkeleton = avatarSkeleton; + m_avatarCollider = avatarCollider; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1608,7 +1663,8 @@ namespace OpenSim.Region.ClientStack.Linden if (handlerUpLoad != null) { handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, - m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); + m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, + m_avatarSkeleton, m_avatarCollider, ref m_error); } if (m_IsAtestUpload) { -- cgit v1.1 From dab2e778d6a9d11cce48161d045598a56e7de952 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 10:22:57 +0100 Subject: bug fix --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3a070c3..133a629 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -830,7 +830,8 @@ namespace OpenSim.Region.ClientStack.Linden List textures = new List(); - if (doTextInv) +// if (doTextInv) + if (doTextInv || avatarSkeleton) m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if(client == null) // don't put textures in inventory if there is no client @@ -903,7 +904,7 @@ namespace OpenSim.Region.ClientStack.Linden // test code - if (avatarSkeleton) + if (avatarSkeleton && client != null) { string name = assetName; if (name.Length > 25) -- cgit v1.1 From cc71dd9a278ffe79668336db11fb768ce881fd18 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 11:12:43 +0100 Subject: dont let test mesh go to meshes inventory folder that is not displayed by viewers --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 133a629..344df2b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -920,7 +920,9 @@ namespace OpenSim.Region.ClientStack.Linden meshitem.Name = name; meshitem.AssetType = (int)AssetType.Mesh; meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default + // meshitem.Folder = UUID.Zero; // send to default + + meshitem.Folder = parentFolder; // dont let it go to folder Meshes that viewers dont show // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. -- cgit v1.1 From c3e88b7b3810aace6e2260526d8f74df88d2cead Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 22:41:59 +0100 Subject: changed skeleton, do parse the mesh on upload to check skeleton. Sooner or later this parsing needs to validate the model cost also. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 344df2b..ab8f0c9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload, bool avatarSkeleton, bool avatarCollider, ref string error); + bool IsAtestUpload, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -531,8 +531,6 @@ namespace OpenSim.Region.ClientStack.Linden int nreqmeshs= 0; int nreqinstances = 0; bool IsAtestUpload = false; - bool avatarSkeleton = false; - bool avatarCollider = false; string assetName = llsdRequest.name; @@ -584,7 +582,7 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning)) + meshcostdata, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -667,7 +665,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -714,7 +712,7 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error) + bool IsAtestUpload, ref string error) { lock (m_ModelCost) @@ -800,7 +798,7 @@ namespace OpenSim.Region.ClientStack.Linden OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); // compare and get updated information - +/* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation bool mismatchError = true; while (mismatchError) @@ -816,7 +814,7 @@ namespace OpenSim.Region.ClientStack.Linden return; } - +*/ OSDArray instance_list = (OSDArray)request["instance_list"]; OSDArray mesh_list = (OSDArray)request["mesh_list"]; OSDArray texture_list = (OSDArray)request["texture_list"]; @@ -831,7 +829,6 @@ namespace OpenSim.Region.ClientStack.Linden // if (doTextInv) - if (doTextInv || avatarSkeleton) m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if(client == null) // don't put textures in inventory if there is no client @@ -879,10 +876,17 @@ namespace OpenSim.Region.ClientStack.Linden // create and store meshs assets List meshAssets = new List(); + List meshAvatarSkeletons = new List(); + List meshAvatarColliders = new List(); + + bool curAvSkeleton; + bool curAvCollider; for (int i = 0; i < mesh_list.Count; i++) { -/* - // do we really need this heavy thing? + curAvSkeleton = false; + curAvCollider = false; + + // we do need to parse the mesh now OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); if (osd is OSDMap) { @@ -891,9 +895,10 @@ namespace OpenSim.Region.ClientStack.Linden { OSDMap skeleton = (OSDMap)mosd["skeleton"]; int sksize = skeleton["size"].AsInteger(); + if (sksize > 0) + curAvSkeleton = true; } } -*/ AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); @@ -901,10 +906,11 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); - + meshAvatarSkeletons.Add(curAvSkeleton); + meshAvatarColliders.Add(curAvCollider); // test code - if (avatarSkeleton && client != null) + if (curAvSkeleton && client != null) { string name = assetName; if (name.Length > 25) @@ -1594,14 +1600,12 @@ namespace OpenSim.Region.ClientStack.Linden private int m_nreqmeshs; private int m_nreqinstances; private bool m_IsAtestUpload; - private bool m_avatarSkeleton; - private bool m_avatarCollider; - + public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, IHttpServer httpServer, bool dumpAssetsToFile, int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider) + bool IsAtestUpload) { m_assetName = assetName; m_assetDes = description; @@ -1620,8 +1624,6 @@ namespace OpenSim.Region.ClientStack.Linden m_nreqmeshs = nreqmeshs; m_nreqinstances = nreqinstances; m_IsAtestUpload = IsAtestUpload; - m_avatarSkeleton = avatarSkeleton; - m_avatarCollider = avatarCollider; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1667,7 +1669,7 @@ namespace OpenSim.Region.ClientStack.Linden { handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, - m_avatarSkeleton, m_avatarCollider, ref m_error); + ref m_error); } if (m_IsAtestUpload) { -- cgit v1.1