From 37a7c167343d90b4fb13cd4b8254801489794410 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Jun 2011 21:01:48 +0100 Subject: minor: method documentation --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 95713e9..d52ebda 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -439,7 +439,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Convert raw uploaded data into the appropriate asset and item. /// /// /// @@ -506,8 +506,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - - /// /// /// @@ -632,7 +630,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw asset upload data via the capability. /// /// /// @@ -670,6 +668,7 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ @@ -679,6 +678,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -719,7 +719,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded asset data. /// /// /// @@ -752,6 +752,7 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ @@ -761,6 +762,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -905,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded baked texture data. /// /// /// -- cgit v1.1 From 1a0a9d229013ff7abba17ccd95159ca7d4b47e9f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Jun 2011 21:54:01 +0100 Subject: Implement the latest mesh mechanism so that rezzing the uploaded mesh now works again. Many thanks to the aurora project for pioneering this. This code is almost certainly not bug free, but it does at least appear to handle simple meshes (except when the viewer crashes - but it is beta!). --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 192 ++++++++++++++++++++- 1 file changed, 189 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d52ebda..6786ac5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1,10 +1,39 @@ -using System; +/* + * 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.Generic; using System.IO; using System.Reflection; +using System.Text; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Nini.Config; using log4net; @@ -12,11 +41,14 @@ using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; +using OSDArray = OpenMetaverse.StructuredData.OSDArray; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.ClientStack.Linden { @@ -79,7 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_persistBakedTextures = false; private IAssetService m_assetService; - private bool m_dumpAssetsToFile; + private bool m_dumpAssetsToFile = false; private string m_regionName; public BunchOfCaps(Scene scene, Caps caps) @@ -448,6 +480,10 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType) { + m_log.DebugFormat( + "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", + assetID, inventoryItem, inventoryType, assetType); + sbyte assType = 0; sbyte inType = 0; @@ -474,6 +510,156 @@ namespace OpenSim.Region.ClientStack.Linden break; } } + 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; + + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) + { + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + textureAsset.Data = texture_list[i].AsBinary(); + m_assetService.Store(textureAsset); + textures.Add(textureAsset.FullID); + } + + for (int i = 0; i < mesh_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"]; + 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(); + + if(imagerot != 0) + f.Rotation = imagerot; + + if(offsets != 0) + f.OffsetU = offsets; + + if (offsett != 0) + f.OffsetV = offsett; + + if (scales != 0) + f.RepeatU = scales; + + if (scalet != 0) + f.RepeatV = scalet; + + if (textures.Count > textureNum) + f.TextureID = textures[textureNum]; + else + f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; + + textureEntry.FaceTextures[face] = f; + } + + 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; + + Vector3 position = inner_instance_list["position"].AsVector3(); + Vector3 scale = inner_instance_list["scale"].AsVector3(); + Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); + +// 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"]; + int base_mask = permissions["base_mask"].AsInteger(); + int everyone_mask = permissions["everyone_mask"].AsInteger(); + UUID creator_id = permissions["creator_id"].AsUUID(); + UUID group_id = permissions["group_id"].AsUUID(); + int group_mask = permissions["group_mask"].AsInteger(); +// bool is_owner_group = permissions["is_owner_group"].AsBoolean(); +// UUID last_owner_id = permissions["last_owner_id"].AsUUID(); + int next_owner_mask = permissions["next_owner_mask"].AsInteger(); + UUID owner_id = permissions["owner_id"].AsUUID(); + int owner_mask = permissions["owner_mask"].AsInteger(); + + 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 = creator_id; + prim.OwnerID = owner_id; + prim.GroupID = group_id; + prim.LastOwnerID = prim.OwnerID; + prim.CreationDate = Util.UnixTimeSinceEpoch(); + prim.Name = assetName; + prim.Description = ""; + + prim.BaseMask = (uint)base_mask; + prim.EveryoneMask = (uint)everyone_mask; + prim.GroupMask = (uint)group_mask; + prim.NextOwnerMask = (uint)next_owner_mask; + prim.OwnerMask = (uint)owner_mask; + + if (grp == null) + grp = new SceneObjectGroup(prim); + else + grp.AddPart(prim); + } + + // 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; + } + + 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)); + } AssetBase asset; asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); @@ -841,7 +1027,7 @@ namespace OpenSim.Region.ClientStack.Linden uploadComplete.new_asset = inventoryItemID; uploadComplete.compiled = errors.Count > 0 ? false : true; uploadComplete.state = "complete"; - uploadComplete.errors = new OSDArray(); + uploadComplete.errors = new OpenSim.Framework.Capabilities.OSDArray(); uploadComplete.errors.Array = errors; res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); -- cgit v1.1 From 281e80ccf3353b4876eaff97b7accaf547561634 Mon Sep 17 00:00:00 2001 From: Michael Cerquoni aka Nebadon Izumi Date: Thu, 7 Jul 2011 03:18:04 -0700 Subject: add MeshUploadFlag capability fixed mesh upload with latest mesh viewer thank you dahlia and lkalif for helping to make this happen! --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 40 ++++--- .../Linden/Caps/MeshUploadFlagModule.cs | 128 +++++++++++++++++++++ 2 files changed, 150 insertions(+), 18 deletions(-) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 6786ac5..d3bb0bc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -595,21 +595,25 @@ namespace OpenSim.Region.ClientStack.Linden 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(); // int material = inner_instance_list["material"].AsInteger(); // int mesh = inner_instance_list["mesh"].AsInteger(); - OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; - int base_mask = permissions["base_mask"].AsInteger(); - int everyone_mask = permissions["everyone_mask"].AsInteger(); - UUID creator_id = permissions["creator_id"].AsUUID(); - UUID group_id = permissions["group_id"].AsUUID(); - int group_mask = permissions["group_mask"].AsInteger(); +// OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; +// int base_mask = permissions["base_mask"].AsInteger(); +// int everyone_mask = permissions["everyone_mask"].AsInteger(); +// UUID creator_id = permissions["creator_id"].AsUUID(); +// UUID group_id = permissions["group_id"].AsUUID(); +// int group_mask = permissions["group_mask"].AsInteger(); // bool is_owner_group = permissions["is_owner_group"].AsBoolean(); // UUID last_owner_id = permissions["last_owner_id"].AsUUID(); - int next_owner_mask = permissions["next_owner_mask"].AsInteger(); - UUID owner_id = permissions["owner_id"].AsUUID(); - int owner_mask = permissions["owner_mask"].AsInteger(); +// int next_owner_mask = permissions["next_owner_mask"].AsInteger(); +// UUID owner_id = permissions["owner_id"].AsUUID(); +// 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); @@ -619,19 +623,19 @@ namespace OpenSim.Region.ClientStack.Linden rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); - prim.CreatorID = creator_id; + prim.CreatorID = owner_id; prim.OwnerID = owner_id; - prim.GroupID = group_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; - prim.GroupMask = (uint)group_mask; - prim.NextOwnerMask = (uint)next_owner_mask; - prim.OwnerMask = (uint)owner_mask; +// prim.BaseMask = (uint)base_mask; +// prim.EveryoneMask = (uint)everyone_mask; +// prim.GroupMask = (uint)group_mask; +// prim.NextOwnerMask = (uint)next_owner_mask; +// prim.OwnerMask = (uint)owner_mask; if (grp == null) grp = new SceneObjectGroup(prim); @@ -1123,4 +1127,4 @@ namespace OpenSim.Region.ClientStack.Linden } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs new file mode 100644 index 0000000..98f9663 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -0,0 +1,128 @@ +/* + * 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.Reflection; +using log4net; +using Nini.Config; +using Mono.Addins; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +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.ClientStack.Linden +{ + /// + /// MeshUploadFlag capability. This is required for uploading Mesh. + /// + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class MeshUploadFlagModule : ISharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; + private UUID m_agentID; + + + #region ISharedRegionModule Members + + public void Initialise(IConfigSource source) + { + IConfig config = source.Configs["MeshUploadFlag"]; + if (config == null) + return; + } + + public void AddRegion(Scene s) + { + m_scene = s; + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + public void RemoveRegion(Scene s) + { + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + } + + public void RegionLoaded(Scene s) + { + } + + public void PostInitialise() + { + } + + public void Close() { } + + public string Name { get { return "MeshUploadFlagModule"; } } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + + public void RegisterCaps(UUID agentID, Caps caps) + { + IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); + caps.RegisterHandler("MeshUploadFlag", reqHandler); + m_agentID = agentID; + } + + private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) + { + m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); + OSDMap data = new OSDMap(); + ScenePresence sp = m_scene.GetScenePresence(m_agentID); + data["username"] = sp.Firstname + "." + sp.Lastname; + data["display_name_next_update"] = new OSDDate(DateTime.Now); + data["legacy_first_name"] = sp.Firstname; + data["mesh_upload_status"] = "valid"; + data["display_name"] = sp.Firstname + " " + sp.Lastname; + data["legacy_last_name"] = sp.Lastname; + data["id"] = m_agentID; + data["is_display_name_default"] = true; + + //Send back data + Hashtable responsedata = new Hashtable(); + responsedata["int_response_code"] = 200; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); + return responsedata; + } + + } +} \ No newline at end of file -- cgit v1.1 From 2fbc98fa5c518d549768899573fa506a22f529e6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 7 Jul 2011 23:37:23 +0100 Subject: Make MeshUploadFlagModule non-shared rather than shared (since each scene needs its own cap) --- OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 98f9663..2d15ca5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.ClientStack.Linden /// /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MeshUploadFlagModule : ISharedRegionModule + public class MeshUploadFlagModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -- cgit v1.1 From 3bda7711b3998d21d0ce78d99273f83d6ee73991 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 7 Jul 2011 23:49:19 +0100 Subject: Switch the MeshUploadFlag CAP module on and off with the existing config AllowMeshUpload flag in [Mesh] (in OpenSimDefaults.ini) Default is on. --- .../Linden/Caps/MeshUploadFlagModule.cs | 49 +++++++++++++++------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 2d15ca5..c9d7ae1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -45,33 +45,54 @@ namespace OpenSim.Region.ClientStack.Linden /// /// MeshUploadFlag capability. This is required for uploading Mesh. /// - /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class MeshUploadFlagModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Is this module enabled? + /// + public bool Enabled { get; private set; } + private Scene m_scene; private UUID m_agentID; - #region ISharedRegionModule Members + public MeshUploadFlagModule() + { + Enabled = true; + } + public void Initialise(IConfigSource source) { - IConfig config = source.Configs["MeshUploadFlag"]; + IConfig config = source.Configs["Mesh"]; if (config == null) + { return; + } + else + { + Enabled = config.GetBoolean("AllowMeshUpload", Enabled); + } } public void AddRegion(Scene s) { + if (!Enabled) + return; + m_scene = s; m_scene.EventManager.OnRegisterCaps += RegisterCaps; } public void RemoveRegion(Scene s) { + if (!Enabled) + return; + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; } @@ -98,22 +119,23 @@ namespace OpenSim.Region.ClientStack.Linden { IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); caps.RegisterHandler("MeshUploadFlag", reqHandler); - m_agentID = agentID; + m_agentID = agentID; } private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) { m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); + OSDMap data = new OSDMap(); - ScenePresence sp = m_scene.GetScenePresence(m_agentID); - data["username"] = sp.Firstname + "." + sp.Lastname; - data["display_name_next_update"] = new OSDDate(DateTime.Now); - data["legacy_first_name"] = sp.Firstname; - data["mesh_upload_status"] = "valid"; - data["display_name"] = sp.Firstname + " " + sp.Lastname; - data["legacy_last_name"] = sp.Lastname; - data["id"] = m_agentID; - data["is_display_name_default"] = true; + ScenePresence sp = m_scene.GetScenePresence(m_agentID); + data["username"] = sp.Firstname + "." + sp.Lastname; + data["display_name_next_update"] = new OSDDate(DateTime.Now); + data["legacy_first_name"] = sp.Firstname; + data["mesh_upload_status"] = "valid"; + data["display_name"] = sp.Firstname + " " + sp.Lastname; + data["legacy_last_name"] = sp.Lastname; + data["id"] = m_agentID; + data["is_display_name_default"] = true; //Send back data Hashtable responsedata = new Hashtable(); @@ -123,6 +145,5 @@ namespace OpenSim.Region.ClientStack.Linden responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); return responsedata; } - } } \ No newline at end of file -- cgit v1.1 From 5700c582ba3727678dfd87f80dab8d09da88df63 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 8 Jul 2011 22:28:17 +0100 Subject: refactor: rename bool returning GetAgentInventoryItem() to CanGetAgentInventoryItem() to improve code readability --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f53e236..c176c2b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7548,13 +7548,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); if (invAccess != null) { - if (!invAccess.GetAgentInventoryItem(this, itemID, requestID)) + if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID)) return false; - } else + { return false; - + } } } } @@ -7568,7 +7568,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; - // m_log.Debug("upload request " + request.ToString()); // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId); -- cgit v1.1 From 5e8900dfd058bd103cb6dcf8a57dc94683efd878 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 9 Jul 2011 00:35:30 +0100 Subject: minor: code tidy and inserted log lines for future use. Unable to get to the bottom of why resizing a mesh fails to properly reset the physics proxy, when toggling phantom does After a mesh is generated, the existing sculptdata is set to zero in PrimitiveBaseShape to save memory When phantom is toggled, the sculptdata is regenerated before remeshing. But on resize, the sculptdata is not regenerated. So clearly, resetting sculptdata is possible, but haven't quite been able to pin down how this is being done when phantom is toggled. --- .../ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 3809f84..15ed3b3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -250,11 +250,9 @@ namespace OpenSim.Region.ClientStack.Linden case 0x40: pbs.ReadProjectionData(extraParam.ExtraParamData, 0); break; - } - - } + pbs.PathBegin = (ushort) obj.PathBegin; pbs.PathCurve = (byte) obj.PathCurve; pbs.PathEnd = (ushort) obj.PathEnd; -- cgit v1.1