From 3384f643ebbc377ecbaae885941a08484bf259f5 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 02:19:42 -0400 Subject: * Partially complete stuff for Mesh support that Melanie wanted to see before it was done. * Shouldn't break the build. * Doesn't work yet either. --- .../CoreModules/Avatar/Assets/GetMeshModule.cs | 201 +++++++++++++++++ .../Avatar/Assets/UploadObjectAssetModule.cs | 248 +++++++++++++++++++++ 2 files changed, 449 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs create mode 100644 OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs new file mode 100644 index 0000000..c1e9891 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -0,0 +1,201 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; + +namespace OpenSim.Region.CoreModules.Avatar.Assets +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class GetMeshModule : INonSharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + private IAssetService m_assetService; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + + m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "GetMeshModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + UUID capID = UUID.Random(); + + m_log.Info("[GETMESH]: /CAPS/" + capID); + caps.RegisterHandler("GetMesh", + new RestHTTPHandler("POST", "/CAPS/" + capID + "/", + delegate(Hashtable m_dhttpMethod) + { + return ProcessGetMesh(m_dhttpMethod, agentID, caps); + })); + + } + + #endregion + public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) + { + + Hashtable responsedata = new Hashtable(); + responsedata["int_response_code"] = 400; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Request wasn't what was expected"; + + string meshStr = string.Empty; + + if (request.ContainsKey("mesh_id")) + meshStr = request["mesh_id"].ToString(); + + + UUID meshID = UUID.Zero; + if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) + { + if (m_assetService == null) + { + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh."; + return responsedata; + } + + AssetBase mesh; + // Only try to fetch locally cached textures. Misses are redirected + mesh = m_assetService.GetCached(meshID.ToString()); + if (mesh != null) + { + if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! + { + responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); + responsedata["content_type"] = "application/vnd.ll.mesh"; + responsedata["int_response_code"] = 200; + } + // Optionally add additional mesh types here + else + { + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; + return responsedata; + } + } + else + { + mesh = m_assetService.Get(meshID.ToString()); + if (mesh != null) + { + if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! + { + responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); + responsedata["content_type"] = "application/vnd.ll.mesh"; + responsedata["int_response_code"] = 200; + } + // Optionally add additional mesh types here + else + { + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; + return responsedata; + } + } + + else + { + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; + return responsedata; + } + } + + } + + return responsedata; + } + } +} diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs new file mode 100644 index 0000000..2600506 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs @@ -0,0 +1,248 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Framework.Capabilities; + +namespace OpenSim.Region.CoreModules.Avatar.Assets +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class UploadObjectAssetModule : INonSharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + private IAssetService m_assetService; + private bool m_dumpAssetsToFile = false; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + + m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "UploadObjectAssetModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + UUID capID = UUID.Random(); + + m_log.Info("[GETMESH]: /CAPS/" + capID); + caps.RegisterHandler("UploadObjectAsset", + + new LLSDStreamhandler("POST", + "/CAPS/" + capID.ToString(), + delegate(LLSDAssetUploadRequest req) + { + return NewAgentInventoryRequest(req,agentID); + })); + + } + + #endregion + + public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + { + //if (llsdRequest.asset_type == "texture" || + // llsdRequest.asset_type == "animation" || + // llsdRequest.asset_type == "sound") + // { + IClientAPI client = null; + + + IMoneyModule mm = m_scene.RequestModuleInterface(); + + if (mm != null) + { + if (m_scene.TryGetClient(agentID, out client)) + { + if (!mm.UploadCovered(client, mm.UploadCharge)) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + } + // } + + + + string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; + string capsBase = "/CAPS/UploadObjectAsset/"; + UUID newAsset = UUID.Random(); + UUID newInvItem = UUID.Random(); + UUID parentFolder = llsdRequest.folder_id; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + + Caps.AssetUploader uploader = + new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); + MainServer.Instance.AddStreamHandler( + new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + + string protocol = "http://"; + + if (MainServer.Instance.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + + uploaderPath; + + LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); + uploadResponse.uploader = uploaderURL; + uploadResponse.state = "upload"; + + uploader.OnUpLoad += delegate( + string passetName, string passetDescription, UUID passetID, + UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, + string passetType) + { + UploadCompleteHandler(passetName, passetDescription, passetID, + pinventoryItem, pparentFolder, pdata, pinventoryType, + passetType,agentID); + }; + return uploadResponse; + } + + + public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType,UUID AgentID) + { + sbyte assType = 0; + sbyte inType = 0; + + if (inventoryType == "sound") + { + inType = 1; + assType = 1; + } + else if (inventoryType == "animation") + { + inType = 19; + assType = 20; + } + else if (inventoryType == "wearable") + { + inType = 18; + switch (assetType) + { + case "bodypart": + assType = 13; + break; + case "clothing": + assType = 5; + break; + } + } + + AssetBase asset; + asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); + asset.Data = data; + + if (m_scene.AssetService != null) + m_scene.AssetService.Store(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = AgentID; + item.CreatorId = AgentID.ToString(); + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions = 2147483647; + item.BasePermissions = 2147483647; + item.EveryOnePermissions = 0; + item.NextPermissions = 2147483647; + item.CreationDate = Util.UnixTimeSinceEpoch(); + m_scene.AddInventoryItem(item); + + } + } +} -- cgit v1.1 From b4a5ce148cf209b1bc0a1ca302275f44abf1040f Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 03:22:14 -0400 Subject: Rename file + more testing and tweaking --- .../NewFileAgentInventoryVariablePriceModule.cs | 256 +++++++++++++++++++++ .../Avatar/Assets/UploadObjectAssetModule.cs | 248 -------------------- 2 files changed, 256 insertions(+), 248 deletions(-) create mode 100644 OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs delete mode 100644 OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs new file mode 100644 index 0000000..0bba7d4 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -0,0 +1,256 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Framework.Capabilities; + +namespace OpenSim.Region.CoreModules.Avatar.Assets +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + private IAssetService m_assetService; + private bool m_dumpAssetsToFile = false; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + + m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + UUID capID = UUID.Random(); + + m_log.Info("[GETMESH]: /CAPS/" + capID); + caps.RegisterHandler("NewFileAgentInventoryVariablePrice", + + new LLSDStreamhandler("POST", + "/CAPS/" + capID.ToString(), + delegate(LLSDAssetUploadRequest req) + { + return NewAgentInventoryRequest(req,agentID); + })); + + } + + #endregion + + public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + { + //if (llsdRequest.asset_type == "texture" || + // llsdRequest.asset_type == "animation" || + // llsdRequest.asset_type == "sound") + // { + IClientAPI client = null; + + + IMoneyModule mm = m_scene.RequestModuleInterface(); + + if (mm != null) + { + if (m_scene.TryGetClient(agentID, out client)) + { + if (!mm.UploadCovered(client, mm.UploadCharge)) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + } + // } + + + + string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; + string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/"; + UUID newAsset = UUID.Random(); + UUID newInvItem = UUID.Random(); + UUID parentFolder = llsdRequest.folder_id; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; + + Caps.AssetUploader uploader = + new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); + MainServer.Instance.AddStreamHandler( + new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + + string protocol = "http://"; + + if (MainServer.Instance.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + + uploaderPath; + + LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); + uploadResponse.uploader = uploaderURL; + uploadResponse.state = "upload"; + + uploader.OnUpLoad += UploadCompleteHandler; + + /*delegate( + string passetName, string passetDescription, UUID passetID, + UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, + string passetType) + { + UploadCompleteHandler(passetName, passetDescription, passetID, + pinventoryItem, pparentFolder, pdata, pinventoryType, + passetType,agentID); + };*/ + return uploadResponse; + } + + + public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType) + { + UUID AgentID = UUID.Zero; + sbyte assType = 0; + sbyte inType = 0; + + if (inventoryType == "sound") + { + inType = 1; + assType = 1; + } + else if (inventoryType == "animation") + { + inType = 19; + assType = 20; + } + else if (inventoryType == "wearable") + { + inType = 18; + switch (assetType) + { + case "bodypart": + assType = 13; + break; + case "clothing": + assType = 5; + break; + } + } + else if (inventoryType == "mesh") + { + inType = 45; // TODO: Replace with appropriate type + assType = 45;// TODO: Replace with appropriate type + } + + AssetBase asset; + asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); + asset.Data = data; + + if (m_scene.AssetService != null) + m_scene.AssetService.Store(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = AgentID; + item.CreatorId = AgentID.ToString(); + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions = 2147483647; + item.BasePermissions = 2147483647; + item.EveryOnePermissions = 0; + item.NextPermissions = 2147483647; + item.CreationDate = Util.UnixTimeSinceEpoch(); + m_scene.AddInventoryItem(item); + + } + } +} diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs deleted file mode 100644 index 2600506..0000000 --- a/OpenSim/Region/CoreModules/Avatar/Assets/UploadObjectAssetModule.cs +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.IO; -using System.Web; -using Mono.Addins; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; -using OpenSim.Framework.Capabilities; - -namespace OpenSim.Region.CoreModules.Avatar.Assets -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class UploadObjectAssetModule : INonSharedRegionModule - { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Scene m_scene; - private IAssetService m_assetService; - private bool m_dumpAssetsToFile = false; - - #region IRegionModuleBase Members - - - public Type ReplaceableInterface - { - get { return null; } - } - - public void Initialise(IConfigSource source) - { - - } - - public void AddRegion(Scene pScene) - { - m_scene = pScene; - } - - public void RemoveRegion(Scene scene) - { - - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene = null; - } - - public void RegionLoaded(Scene scene) - { - - m_assetService = m_scene.RequestModuleInterface(); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; - } - - #endregion - - - #region IRegionModule Members - - - - public void Close() { } - - public string Name { get { return "UploadObjectAssetModule"; } } - - - public void RegisterCaps(UUID agentID, Caps caps) - { - UUID capID = UUID.Random(); - - m_log.Info("[GETMESH]: /CAPS/" + capID); - caps.RegisterHandler("UploadObjectAsset", - - new LLSDStreamhandler("POST", - "/CAPS/" + capID.ToString(), - delegate(LLSDAssetUploadRequest req) - { - return NewAgentInventoryRequest(req,agentID); - })); - - } - - #endregion - - public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) - { - //if (llsdRequest.asset_type == "texture" || - // llsdRequest.asset_type == "animation" || - // llsdRequest.asset_type == "sound") - // { - IClientAPI client = null; - - - IMoneyModule mm = m_scene.RequestModuleInterface(); - - if (mm != null) - { - if (m_scene.TryGetClient(agentID, out client)) - { - if (!mm.UploadCovered(client, mm.UploadCharge)) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - } - // } - - - - string assetName = llsdRequest.name; - string assetDes = llsdRequest.description; - string capsBase = "/CAPS/UploadObjectAsset/"; - UUID newAsset = UUID.Random(); - UUID newInvItem = UUID.Random(); - UUID parentFolder = llsdRequest.folder_id; - string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - - Caps.AssetUploader uploader = - new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); - MainServer.Instance.AddStreamHandler( - new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - - string protocol = "http://"; - - if (MainServer.Instance.UseSSL) - protocol = "https://"; - - string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + - uploaderPath; - - LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); - uploadResponse.uploader = uploaderURL; - uploadResponse.state = "upload"; - - uploader.OnUpLoad += delegate( - string passetName, string passetDescription, UUID passetID, - UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, - string passetType) - { - UploadCompleteHandler(passetName, passetDescription, passetID, - pinventoryItem, pparentFolder, pdata, pinventoryType, - passetType,agentID); - }; - return uploadResponse; - } - - - public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType,UUID AgentID) - { - sbyte assType = 0; - sbyte inType = 0; - - if (inventoryType == "sound") - { - inType = 1; - assType = 1; - } - else if (inventoryType == "animation") - { - inType = 19; - assType = 20; - } - else if (inventoryType == "wearable") - { - inType = 18; - switch (assetType) - { - case "bodypart": - assType = 13; - break; - case "clothing": - assType = 5; - break; - } - } - - AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); - asset.Data = data; - - if (m_scene.AssetService != null) - m_scene.AssetService.Store(asset); - - InventoryItemBase item = new InventoryItemBase(); - item.Owner = AgentID; - item.CreatorId = AgentID.ToString(); - item.ID = inventoryItem; - item.AssetID = asset.FullID; - item.Description = assetDescription; - item.Name = assetName; - item.AssetType = assType; - item.InvType = inType; - item.Folder = parentFolder; - item.CurrentPermissions = 2147483647; - item.BasePermissions = 2147483647; - item.EveryOnePermissions = 0; - item.NextPermissions = 2147483647; - item.CreationDate = Util.UnixTimeSinceEpoch(); - m_scene.AddInventoryItem(item); - - } - } -} -- cgit v1.1 From 7e363b79c7894b8c393ec38ae60ea19f8cb65d5e Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 09:24:15 -0400 Subject: * Tweaked the upload response and now at least uploading the mesh works. * Binary error on downloading the mesh though.. so still not yet working. --- .../CoreModules/Avatar/Assets/GetMeshModule.cs | 4 +-- .../NewFileAgentInventoryVariablePriceModule.cs | 33 +++++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index c1e9891..bae108c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.GetCached(meshID.ToString()); if (mesh != null) { - if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! + if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated! { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.Get(meshID.ToString()); if (mesh != null) { - if (mesh.Type == (sbyte)45) //TODO: Change to AssetType.Mesh when libomv gets updated! + if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated! { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 0bba7d4..9029f58 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets m_log.Info("[GETMESH]: /CAPS/" + capID); caps.RegisterHandler("NewFileAgentInventoryVariablePrice", - new LLSDStreamhandler("POST", + new LLSDStreamhandler("POST", "/CAPS/" + capID.ToString(), delegate(LLSDAssetUploadRequest req) { @@ -117,8 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } #endregion - - public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + + public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) { //if (llsdRequest.asset_type == "texture" || // llsdRequest.asset_type == "animation" || @@ -138,8 +138,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; errorResponse.state = "error"; return errorResponse; } @@ -170,14 +170,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + uploaderPath; + - LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); - uploadResponse.uploader = uploaderURL; + LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + + + uploadResponse.rsvp = uploaderURL; uploadResponse.state = "upload"; + uploadResponse.resource_cost = 0; + uploadResponse.upload_price = 0; - uploader.OnUpLoad += UploadCompleteHandler; + uploader.OnUpLoad += //UploadCompleteHandler; - /*delegate( + delegate( string passetName, string passetDescription, UUID passetID, UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, string passetType) @@ -185,16 +190,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets UploadCompleteHandler(passetName, passetDescription, passetID, pinventoryItem, pparentFolder, pdata, pinventoryType, passetType,agentID); - };*/ + }; return uploadResponse; } public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) + string assetType,UUID AgentID) { - UUID AgentID = UUID.Zero; + sbyte assType = 0; sbyte inType = 0; @@ -223,8 +228,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } else if (inventoryType == "mesh") { - inType = 45; // TODO: Replace with appropriate type - assType = 45;// TODO: Replace with appropriate type + inType = 22; // TODO: Replace with appropriate type + assType = 49;// TODO: Replace with appropriate type } AssetBase asset; -- cgit v1.1 From 6d99f0c627d9f1eefd14b7488cce34b1e2e7d933 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 09:34:37 -0400 Subject: * Whoops, That was supposed to use the HTTP VERB 'GET' not 'POST' * At this point. Visually, Mesh works OK. Remember peeps, this is still highly experimental from the viewer side as well as the Simulator side. There are known problems with the new beta viewers and attachment breaking so be careful until that's fixed. Additionally there some new properties in the Mesh Viewer that determine physics settings that are non-functional. More work will be done on that. --- OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index bae108c..a090c0c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets m_log.Info("[GETMESH]: /CAPS/" + capID); caps.RegisterHandler("GetMesh", - new RestHTTPHandler("POST", "/CAPS/" + capID + "/", + new RestHTTPHandler("GET", "/CAPS/" + capID, delegate(Hashtable m_dhttpMethod) { return ProcessGetMesh(m_dhttpMethod, agentID, caps); -- cgit v1.1 From 05c4e27a30e9bfa4657aac911ddbb69cafe3c9a0 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 09:57:42 -0400 Subject: * A few additional cleanup elements * At this point, I want to make sure to thank the fabulous developers of the LibOpenMetaverse library for tirelessly keeping things updated and hammering away at the protocols and providing excellent tools to figure out where things go wrong. * Special thanks to John Hurliman and Latif Khalifa for their valuable insight. --- OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs | 1 + .../Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index a090c0c..b8aed0b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -113,6 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } #endregion + public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 9029f58..35f054f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) { + + //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit + // You need to be aware of this and + + //if (llsdRequest.asset_type == "texture" || // llsdRequest.asset_type == "animation" || // llsdRequest.asset_type == "sound") -- cgit v1.1 From ba247f729d80dbc01b1cc13cc46692691b4b4cb3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 14 Oct 2010 11:08:10 +0100 Subject: Kill some magic numbers in the mesh upload module and change the mesh asset type from 45 to 49 to match OMV trunk --- .../Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 35f054f..d644cdd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -254,10 +254,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets item.AssetType = assType; item.InvType = inType; item.Folder = parentFolder; - item.CurrentPermissions = 2147483647; - item.BasePermissions = 2147483647; + item.CurrentPermissions = (uint)PermissionMask.All; + item.BasePermissions = (uint)PermissionMask.All; item.EveryOnePermissions = 0; - item.NextPermissions = 2147483647; + item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); item.CreationDate = Util.UnixTimeSinceEpoch(); m_scene.AddInventoryItem(item); -- cgit v1.1 From 405935492ba360806fd47fa2053601bc98969d0d Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 14 Oct 2010 18:08:59 +0200 Subject: Don't distroy attachments when using viewer 2.1+, strip multiple attachment data --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 457e0bb..51197d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -228,6 +228,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); + // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should + // be removed when that functionality is implemented in opensim + AttachmentPt &= 0x7f; + SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); if (updateInventoryStatus) -- cgit v1.1 From c148ef25a9fcb5236731e949f6c6dbf042d07ef9 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 14 Oct 2010 12:23:41 -0400 Subject: * Replacing Magic numbers with Enums --- OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs | 4 ++-- .../Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index b8aed0b..36aaab3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.GetCached(meshID.ToString()); if (mesh != null) { - if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated! + if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; @@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets mesh = m_assetService.Get(meshID.ToString()); if (mesh != null) { - if (mesh.Type == (sbyte)49) //TODO: Change to AssetType.Mesh when libomv gets updated! + if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 35f054f..0d26036 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -233,8 +233,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets } else if (inventoryType == "mesh") { - inType = 22; // TODO: Replace with appropriate type - assType = 49;// TODO: Replace with appropriate type + inType = (sbyte)InventoryType.Mesh; + assType = (sbyte)AssetType.Mesh; } AssetBase asset; -- cgit v1.1 From cd4d7a7c351ad78c13805374b46ea8168568d89e Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Fri, 15 Oct 2010 07:24:57 +0200 Subject: A couple of more ways attachment point is sent Signed-off-by: Teravus Ovares (Dan Olivares) --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 51197d2..2a0c0b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -113,6 +113,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) return; + // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should + // be removed when that functionality is implemented in opensim + AttachmentPt &= 0x7f; + // Calls attach with a Zero position if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false)) { @@ -142,6 +146,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) { + // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should + // be removed when that functionality is implemented in opensim + AttachmentPt &= 0x7f; + // If the attachment point isn't the same as the one previously used // set it's offset position = 0 so that it appears on the attachment point // and not in a weird location somewhere unknown. -- cgit v1.1