From 2bce1716afb4df36c4c67b2f17f6f0f18b341987 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 1 Nov 2010 13:07:24 +0100 Subject: [PATCH 01/19] Fix HypergridLinker.Check4096() Make the optimization with IEnumerable.Except() in Check4096 actually work by providing an appropriate equality definition for GridRegion objects. --- OpenSim/Services/Interfaces/IGridService.cs | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a33d7..ee062256c5 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces int GetRegionFlags(UUID scopeID, UUID regionID); } - public class GridRegion + public class GridRegion : Object { /// @@ -225,6 +225,33 @@ namespace OpenSim.Services.Interfaces EstateOwner = ConvertFrom.EstateOwner; } + # region Definition of equality + + /// + /// Define equality as two regions having the same, non-zero UUID. + /// + public bool Equals(GridRegion region) + { + if ((object)region == null) + return false; + // Return true if the non-zero UUIDs are equal: + return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID); + } + + public override bool Equals(Object obj) + { + if (obj == null) + return false; + return Equals(obj as GridRegion); + } + + public override int GetHashCode() + { + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + } + + #endregion + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// From ed7959ddfbff413c18d1167eccda0d3436a26b8c Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 2 Nov 2010 02:35:56 -0700 Subject: [PATCH 02/19] Thanks Snoopy for a patch that addresses Mantis #0005165: osSetDynamicTextureURL crashed region server Signed-off-by: dahlia --- .../LoadImageURL/LoadImageURLModule.cs | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index c23cea539a..ed3e516631 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL stream = response.GetResponseStream(); if (stream != null) { - Bitmap image = new Bitmap(stream); - Size newsize; - - // TODO: make this a bit less hard coded - if ((image.Height < 64) && (image.Width < 64)) - { - newsize = new Size(32, 32); - } - else if ((image.Height < 128) && (image.Width < 128)) - { - newsize = new Size(64, 64); - } - else if ((image.Height < 256) && (image.Width < 256)) - { - newsize = new Size(128, 128); - } - else if ((image.Height < 512 && image.Width < 512)) - { - newsize = new Size(256, 256); - } - else if ((image.Height < 1024 && image.Width < 1024)) - { - newsize = new Size(512, 512); - } - else - { - newsize = new Size(1024, 1024); - } - - Bitmap resize = new Bitmap(image, newsize); - try { + Bitmap image = new Bitmap(stream); + Size newsize; + + // TODO: make this a bit less hard coded + if ((image.Height < 64) && (image.Width < 64)) + { + newsize = new Size(32, 32); + } + else if ((image.Height < 128) && (image.Width < 128)) + { + newsize = new Size(64, 64); + } + else if ((image.Height < 256) && (image.Width < 256)) + { + newsize = new Size(128, 128); + } + else if ((image.Height < 512 && image.Width < 512)) + { + newsize = new Size(256, 256); + } + else if ((image.Height < 1024 && image.Width < 1024)) + { + newsize = new Size(512, 512); + } + else + { + newsize = new Size(1024, 1024); + } + + Bitmap resize = new Bitmap(image, newsize); + imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); } catch (Exception) { - m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); + m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!"); } } else From 9f5ab3b965b1a3324918b7b2267c24709d42919b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 2 Nov 2010 12:05:24 -0700 Subject: [PATCH 03/19] Old deserialization can't deal with commas in flag fields. Making use of -version option on save oar command. Bumped archives version to 0.5; version < 0.5 generates flag fields without commas. Everything else is identical. --- OpenSim/Region/Application/OpenSim.cs | 5 +++-- .../Archiver/ArchiveWriteRequestExecution.cs | 7 ++----- .../ArchiveWriteRequestPreparation.cs | 19 ++++++++---------- .../Serialization/SceneObjectSerializer.cs | 20 ++++++++++++++++--- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 7a0142f2cd..f80cb342af 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -264,9 +264,10 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar []", + "save oar [-v|version=N] []", "Save a region's data to an OAR archive.", - "The OAR path must be a filesystem path." + "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine + + "The OAR path must be a filesystem path." + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index c062833370..f8a599a232 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); - Dictionary serializationOptions = new Dictionary(); -// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") -// serializationOptions["old-guids"] = true; - + // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 31820794b8..0567a82825 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string Create0p2ControlFile(Dictionary options) { - int majorVersion = 0, minorVersion = 4; - - /* - if (options.ContainsKey("version") && (string)options["version"] == "0") + int majorVersion = 0, minorVersion = 5; + + if (options.ContainsKey("version")) { - majorVersion = 0; - minorVersion = 3; - } - else - { - majorVersion = 1; minorVersion = 0; + string[] parts = options["version"].ToString().Split('.'); + if (parts.Length >= 1) + majorVersion = Int32.Parse(parts[0]); + if (parts.Length >= 2) + minorVersion = Int32.Parse(parts[1]); } - */ m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); // if (majorVersion == 1) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index e661ca9da1..7f37878cda 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); - writer.WriteElementString("Flags", sop.Flags.ToString()); + WriteFlags(writer, "Flags", sop.Flags.ToString(), options); WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) @@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } + static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary options) + { + // Older versions of serialization can't cope with commas + if (options.ContainsKey("version")) + { + float version = 0.5F; + float.TryParse(options["version"].ToString(), out version); + if (version < 0.5) + flagsStr = flagsStr.Replace(",", ""); + } + + writer.WriteElementString(name, flagsStr); + } + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) { if (tinv.Count > 0) // otherwise skip this @@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); writer.WriteElementString("State", shp.State.ToString()); - writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); - writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); + WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); + WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); writer.WriteElementString("SculptType", shp.SculptType.ToString()); From 63ffdcf53a9b8a53df5eb8322c9c98afb7c1afb0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Nov 2010 19:55:05 +0000 Subject: [PATCH 04/19] Try to not make avatars switch outfits --- OpenSim/Framework/AvatarWearable.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index efec50b71f..0809ab691c 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -221,9 +221,6 @@ namespace OpenSim.Framework { get { - if (defaultWearables != null) - return defaultWearables; - defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these for (int i = 0; i < MAX_WEARABLES; i++) { From 4d1f0c5348f9a59501f81c4d4ce061db309b5d8a Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 1 Nov 2010 13:36:30 +0100 Subject: [PATCH 05/19] Support for CORS with simple requests in BaseHttpServer --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba8c1941a8..30505f6a5b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1450,6 +1450,10 @@ namespace OpenSim.Framework.Servers.HttpServer if (responsedata.ContainsKey("reusecontext")) response.ReuseContext = (bool) responsedata["reusecontext"]; + // Cross-Origin Resource Sharing with simple requests + if (responsedata.ContainsKey("access_control_allow_origin")) + response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]); + //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions From 4fdab71c8d05249778a567349fc3340be3841c43 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 1 Nov 2010 13:52:39 +0100 Subject: [PATCH 06/19] Add support for cross-domain AJAX requests to REST console. Enables RemoteConsole to add the appropriate HTTP header when responding to requests that use Cross-Origin Resource Sharing (CORS with simple requests). The allowed origin is set with configuration option "ConsoleAllowedOrigin" in section [Network]. For a suggestion to make this configuration option more flexible, see the TODO comment in the source code. The WifiConsole uses this functionality with grid mode. --- OpenSim/Framework/Console/RemoteConsole.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 7eb289ba72..07de27a2fc 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using OpenMetaverse; using Nini.Config; @@ -62,6 +63,7 @@ namespace OpenSim.Framework.Console new Dictionary(); private string m_UserName = String.Empty; private string m_Password = String.Empty; + private string m_AllowedOrigin = String.Empty; public RemoteConsole(string defaultPrompt) : base(defaultPrompt) { @@ -77,6 +79,7 @@ namespace OpenSim.Framework.Console m_UserName = netConfig.GetString("ConsoleUser", String.Empty); m_Password = netConfig.GetString("ConsolePass", String.Empty); + m_AllowedOrigin = netConfig.GetString("ConsoleAllowedOrigin", String.Empty); } public void SetServer(IHttpServer server) @@ -150,6 +153,29 @@ namespace OpenSim.Framework.Console return cmdinput; } + private Hashtable CheckOrigin(Hashtable result) + { + if (!string.IsNullOrEmpty(m_AllowedOrigin)) + result["access_control_allow_origin"] = m_AllowedOrigin; + return result; + } + /* TODO: Figure out how PollServiceHTTPHandler can access the request headers + * in order to use m_AllowedOrigin as a regular expression + private Hashtable CheckOrigin(Hashtable headers, Hashtable result) + { + if (!string.IsNullOrEmpty(m_AllowedOrigin)) + { + if (headers.ContainsKey("origin")) + { + string origin = headers["origin"].ToString(); + if (Regex.IsMatch(origin, m_AllowedOrigin)) + result["access_control_allow_origin"] = origin; + } + } + return result; + } + */ + private void DoExpire() { List expired = new List(); @@ -235,6 +261,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -289,6 +316,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -344,6 +372,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -457,6 +486,7 @@ namespace OpenSim.Framework.Console result["content_type"] = "application/xml"; result["keepalive"] = false; result["reusecontext"] = false; + result = CheckOrigin(result); return result; } @@ -480,6 +510,7 @@ namespace OpenSim.Framework.Console result["content_type"] = "text/xml"; result["keepalive"] = false; result["reusecontext"] = false; + result = CheckOrigin(result); return result; } From 78a0ed3ff919569b7f572ea3d713454c9a71fff0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Nov 2010 21:28:24 +0000 Subject: [PATCH 07/19] Fix sitting and standing up --- .../Region/Framework/Scenes/ScenePresence.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8defe68e71..d01cac2efc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -872,6 +872,12 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(isFlying); + if (m_appearance != null) + { + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); + } + if (m_forceFly) { m_physicsActor.Flying = true; @@ -2391,11 +2397,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_appearance.Texture == null) return; - if (LocalId == remoteAvatar.LocalId) - { - m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); - return; - } +// MT: This is needed for sit. It's legal to send it to oneself, and the name +// of the method is a misnomer +// +// if (LocalId == remoteAvatar.LocalId) +// { +// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); +// return; +// } if (IsChildAgent) { From 43ac44b02896343ac4df82cd7c91c1ea2c119cf7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Nov 2010 21:41:27 +0000 Subject: [PATCH 08/19] Fix default club feet --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d0a22b23b9..69e1ae6c7b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -231,7 +231,7 @@ namespace OpenSim.Framework protected virtual void SetDefaultParams() { - m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; + m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; // for (int i = 0; i < VISUALPARAM_COUNT; i++) // { // m_visualparams[i] = 150; From d555c373d88586a868d5a466b5933fcfd9c8a3e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Nov 2010 23:39:45 +0000 Subject: [PATCH 09/19] Fix avatar height management --- .../Region/Framework/Scenes/ScenePresence.cs | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d01cac2efc..ce9cf0c074 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -171,9 +171,6 @@ namespace OpenSim.Region.Framework.Scenes private float m_health = 100f; - // Default AV Height - private float m_avHeight = 127.0f; - protected RegionInfo m_regionInfo; protected ulong crossingFromRegion; @@ -841,9 +838,10 @@ namespace OpenSim.Region.Framework.Scenes } float localAVHeight = 1.56f; - if (m_avHeight != 127.0f) + if (m_appearance != null) { - localAVHeight = m_avHeight; + if (m_appearance.AvatarHeight > 0) + localAVHeight = m_appearance.AvatarHeight; } float posZLimit = 0; @@ -1066,10 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetHeight(float height) { - m_avHeight = height; if (PhysicsActor != null && !IsChildAgent) { - Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight); + Vector3 SetSize = new Vector3(0.45f, 0.6f, height); PhysicsActor.Size = SetSize; } } @@ -1693,9 +1690,10 @@ namespace OpenSim.Region.Framework.Scenes m_parentID = 0; SendFullUpdateToAllClients(); m_requestedSitTargetID = 0; - if ((m_physicsActor != null) && (m_avHeight > 0)) + if (m_physicsActor != null && m_appearance != null) { - SetHeight(m_avHeight); + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); } } @@ -2585,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes cadu.ActiveGroupID = UUID.Zero.Guid; cadu.AgentID = UUID.Guid; cadu.alwaysrun = m_setAlwaysRun; - cadu.AVHeight = m_avHeight; + cadu.AVHeight = m_appearance.AvatarHeight; Vector3 tempCameraCenter = m_CameraCenter; cadu.cameraPosition = tempCameraCenter; cadu.drawdistance = m_DrawDistance; @@ -2921,7 +2919,6 @@ namespace OpenSim.Region.Framework.Scenes m_CameraCenter = cAgentData.Center + offset; - m_avHeight = cAgentData.Size.Z; //SetHeight(cAgentData.AVHeight); if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) @@ -2946,8 +2943,6 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Position = AbsolutePosition; cAgent.Velocity = m_velocity; cAgent.Center = m_CameraCenter; - // Don't copy the size; it is inferred from apearance parameters - //cAgent.Size = new Vector3(0, 0, m_avHeight); cAgent.AtAxis = m_CameraAtAxis; cAgent.LeftAxis = m_CameraLeftAxis; cAgent.UpAxis = m_CameraUpAxis; @@ -3065,7 +3060,6 @@ namespace OpenSim.Region.Framework.Scenes m_pos = cAgent.Position; m_velocity = cAgent.Velocity; m_CameraCenter = cAgent.Center; - //m_avHeight = cAgent.Size.Z; m_CameraAtAxis = cAgent.AtAxis; m_CameraLeftAxis = cAgent.LeftAxis; m_CameraUpAxis = cAgent.UpAxis; @@ -3198,16 +3192,9 @@ namespace OpenSim.Region.Framework.Scenes Vector3 pVec = AbsolutePosition; // Old bug where the height was in centimeters instead of meters - if (m_avHeight == 127.0f) - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f), - isFlying); - } - else - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, - new Vector3(0f, 0f, m_avHeight), isFlying); - } + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, + new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); + scene.AddPhysicsActorTaint(m_physicsActor); //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; From 7d551e27cac7cba3c475ec7e528897834552b36f Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 00:01:47 +0000 Subject: [PATCH 10/19] Trying to prevent a wrong physical actor size --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ce9cf0c074..a339a4fe7d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3187,6 +3187,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddToPhysicalScene(bool isFlying) { + if (m_appearance.AvatarHeight == 0) + return; + PhysicsScene scene = m_scene.PhysicsScene; Vector3 pVec = AbsolutePosition; From 57eabe9d4625a7f91a48525f83233a5a617c5a24 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 00:47:22 +0000 Subject: [PATCH 11/19] Actually calculate the height before setting it, this isn't done automatically on incoming transfers in all cases. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a339a4fe7d..964f8cb901 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3078,6 +3078,12 @@ namespace OpenSim.Region.Framework.Scenes m_setAlwaysRun = cAgent.AlwaysRun; m_appearance = new AvatarAppearance(cAgent.Appearance); + if (m_physicsActor != null) + { + bool isFlying = m_physicsActor.Flying; + RemoveFromPhysicalScene(); + AddToPhysicalScene(isFlying); + } /* uint i = 0; @@ -3188,7 +3194,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddToPhysicalScene(bool isFlying) { if (m_appearance.AvatarHeight == 0) - return; + m_appearance.SetHeight(); PhysicsScene scene = m_scene.PhysicsScene; From 1f77f05f023f9ab45e9f8fd0109766a1fe151dba Mon Sep 17 00:00:00 2001 From: mores Date: Tue, 2 Nov 2010 21:46:45 -0400 Subject: [PATCH 12/19] Admin Server can now bind to a private ip address Signed-off-by: Melanie --- .../RemoteController/RemoteAdminPlugin.cs | 4 +++- OpenSim/Framework/MainServer.cs | 9 +++++++++ bin/OpenSim.ini.example | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 72ac3039d1..cbaa38b02b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -116,7 +116,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController int port = m_config.GetInt("port", 0); m_application = openSim; - m_httpServer = MainServer.GetHttpServer((uint)port); + string bind_ip_address = m_config.GetString("bind_ip_address", "127.0.0.1"); + IPAddress ipaddr = IPAddress.Parse( bind_ip_address ); + m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr); Dictionary availableMethods = new Dictionary(); availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 1f5f2088fc..8ccabece50 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Reflection; +using System.Net; using log4net; using OpenSim.Framework.Servers.HttpServer; @@ -47,6 +48,11 @@ namespace OpenSim.Framework } public static IHttpServer GetHttpServer(uint port) + { + return GetHttpServer(port,null); + } + + public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) { if (port == 0) return Instance; @@ -58,6 +64,9 @@ namespace OpenSim.Framework m_Servers[port] = new BaseHttpServer(port); + if (ipaddr != null ) + m_Servers[port].ListenIPAddress = ipaddr; + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); m_Servers[port].Start(); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9d348548c0..669f534afb 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,6 +326,9 @@ ;; Set this to a nonzero value to have remote admin use a different port ; port = 0 + ;; Set this to the ip address that you want the admin server to bind to + ; bind_ip_address = 127.0.0.1 + ;# {access_password} {enabled:true} {Password for the remote admin interface} {} ;; This password is required to make any XMLRPC call (should be set as ;; the "password" parameter) From e76980bc496b414908ced8a9451631ff21ba5a17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 01:09:42 +0000 Subject: [PATCH 13/19] Fix config items. Less used / expert items go in OpenSimDefaults.ini The default shown is always the hardcoded default --- bin/OpenSim.ini.example | 3 --- bin/OpenSimDefaults.ini | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 669f534afb..9d348548c0 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,9 +326,6 @@ ;; Set this to a nonzero value to have remote admin use a different port ; port = 0 - ;; Set this to the ip address that you want the admin server to bind to - ; bind_ip_address = 127.0.0.1 - ;# {access_password} {enabled:true} {Password for the remote admin interface} {} ;; This password is required to make any XMLRPC call (should be set as ;; the "password" parameter) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index de7c44ccf4..f98689b613 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -624,6 +624,9 @@ ; Set this to a nonzero value to have remote admin use a different port port = 0 + ; Set this to the ip address that you want the admin server to bind to + bind_ip_address = "0.0.0.0" + ; This password is required to make any XMLRPC call (should be set as the "password" parameter) access_password = unknown From c25f84e31c9ce20b887d2aba638962984ef20941 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 01:11:04 +0000 Subject: [PATCH 14/19] Change the default of the new bind_ip_address RemoteAdmin option to 0.0.0.0 so it reflects the prior default. We are not in the habot of changing default behavior without good reason and making localhost the default would break most current use cases. --- .../ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index cbaa38b02b..854307c1e8 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -116,7 +116,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController int port = m_config.GetInt("port", 0); m_application = openSim; - string bind_ip_address = m_config.GetString("bind_ip_address", "127.0.0.1"); + string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0"); IPAddress ipaddr = IPAddress.Parse( bind_ip_address ); m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr); From 4ab9d37a8e556fe7f54d70db922eede861bce812 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 02:04:17 +0000 Subject: [PATCH 15/19] When LightShare is enabled, the standard day cycle is bypassed and replaced by midday defaults when no specific LightShare profile is set. This prevents LightShare info being send out when the region has no LightShare profile, allowing normal day/night cycles to happen. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 1 + OpenSim/Framework/RegionInfo.cs | 1 + OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | 3 ++- .../Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e2b69538e5..b53c67b912 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -817,6 +817,7 @@ namespace OpenSim.Data.MySQL nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); + nWP.valid = true; } } } diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398a18..176a523146 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework { public class RegionLightShareData : ICloneable { + public bool valid = false; public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); public float waterFogDensityExponent = 4.0f; diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 412dbb69c3..88f392dcdb 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare } private void EventManager_OnSaveNewWindlightProfile() { - m_scene.ForEachScenePresence(SendProfileToClient); + if (m_scene.RegionInfo.WindlightSettings.valid) + m_scene.ForEachScenePresence(SendProfileToClient); } public void PostInitialise() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 665b39f6fc..24a93c5d8a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -455,6 +455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (LightShareModule.EnableWindlight) { RegionLightShareData wl = getWindlightProfileFromRules(rules); + wl.valid = true; m_host.ParentGroup.Scene.StoreWindlightProfile(wl); success = 1; } From 6c3b7617b0356f093ef2730f1c517d6228997984 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 02:31:43 +0000 Subject: [PATCH 16/19] Add lsClearWindlightScene() to the lightshare module to remove WL settings from a region and allow normal day cycles to be reestablished --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 3 +++ OpenSim/Data/MySQL/MySQLSimulationData.cs | 15 +++++++++++++++ OpenSim/Data/Null/NullSimulationData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ .../Data/SQLiteLegacy/SQLiteSimulationData.cs | 3 +++ .../Interfaces/ISimulationDataService.cs | 1 + .../Interfaces/ISimulationDataStore.cs | 1 + .../Shared/Api/Implementation/LS_Api.cs | 17 +++++++++++++++++ .../Shared/Api/Interface/ILS_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 4 ++++ .../Simulation/SimulationDataService.cs | 4 ++++ .../Tests/Common/Mock/MockRegionDataPlugin.cs | 10 +++++++++- 12 files changed, 64 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 1da52b41e4..80ec65e246 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -705,6 +705,9 @@ VALUES //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index b53c67b912..ae78814f06 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -965,6 +965,21 @@ namespace OpenSim.Data.MySQL } } + public void RemoveRegionWindlightSettings(UUID regionID) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; + cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); + ExecuteNonQuery(cmd); + } + } + } + public void StoreRegionSettings(RegionSettings rs) { lock (m_dbLock) diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 34d3a4e38a..eb4e313f84 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -56,6 +56,9 @@ namespace OpenSim.Data.Null //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 9d49fb681f..bade0a1e9c 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -323,6 +323,9 @@ namespace OpenSim.Data.SQLite //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index ce18a428bb..4952cdf569 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -286,6 +286,9 @@ namespace OpenSim.Data.SQLiteLegacy //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index edaa07c80f..5295a72976 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -94,5 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); } } diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 0a4d531b91..615f3770d1 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); void Shutdown(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 24a93c5d8a..645566eaf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -466,6 +466,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return success; } + public void lsClearWindlightScene() + { + if (!m_LSFunctionsEnabled) + { + LSShoutError("LightShare functions are not enabled."); + return; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); + return; + } + + m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; + if (m_host.ParentGroup.Scene.SimulationDataService != null) + m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); + } /// /// Set the current Windlight scene to a target avatar /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs index 9aa437b37e..f2df094abf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs @@ -44,5 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List lsGetWindlightScene(LSL_List rules); int lsSetWindlightScene(LSL_List rules); int lsSetWindlightSceneTargeted(LSL_List rules, key target); + void lsClearWindlightScene(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs index f8dbe03ccc..143b497cd8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs @@ -72,5 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target); } + public void lsClearWindlightScene() + { + m_LS_Functions.lsClearWindlightScene(); + } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index c8ecb18bbc..0df9380547 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -144,5 +144,9 @@ namespace OpenSim.Services.Connectors { m_database.StoreRegionWindlightSettings(wl); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + m_database.RemoveRegionWindlightSettings(regionID); + } } } diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2e5020b043..2ea36da228 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -104,6 +104,10 @@ namespace OpenSim.Data.Null return m_store.LoadRegionWindlightSettings(regionUUID); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { m_store.StoreRegionWindlightSettings(wl); @@ -146,6 +150,10 @@ namespace OpenSim.Data.Null return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet @@ -274,4 +282,4 @@ namespace OpenSim.Data.Null { } } -} \ No newline at end of file +} From 1c8d19d714cf8595680a88930287e4da222535ee Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 13:31:45 +0000 Subject: [PATCH 17/19] Delete existing presences for a user ID when they log in again. WARNING!!! This changes a default. The old default is to allow multiple presences, the new default disables this. As the feature currently has no users, this should not present any difficulty and will alleviate the presence issues somewhat. --- OpenSim/Services/PresenceService/PresenceService.cs | 13 +++++++++++++ bin/Robust.ini.example | 3 +++ 2 files changed, 16 insertions(+) diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 09c31c321b..c8ac38e63a 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -45,10 +45,20 @@ namespace OpenSim.Services.PresenceService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_allowDuplicatePresences = false; + public PresenceService(IConfigSource config) : base(config) { m_log.Debug("[PRESENCE SERVICE]: Starting presence service"); + + IConfig presenceConfig = config.Configs["PresenceService"]; + if (presenceConfig != null) + { + m_allowDuplicatePresences = + presenceConfig.GetBoolean("AllowDuplicatePresences", + m_allowDuplicatePresences); + } } public bool LoginAgent(string userID, UUID sessionID, @@ -57,6 +67,9 @@ namespace OpenSim.Services.PresenceService //PresenceData[] d = m_Database.Get("UserID", userID); //m_Database.Get("UserID", userID); + if (!m_allowDuplicatePresences) + m_Database.Delete("UserID", userID.ToString()); + PresenceData data = new PresenceData(); data.UserID = userID; diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 10edccd9c9..bc87ac286d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -107,6 +107,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [PresenceService] ; for the server connector LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" + ; Set this to true to allow the use of advanced web services and multiple + ; bots using one account + AllowDuplicatePresences = false; [AvatarService] ; for the server connector From e078c57bf09cc70f3026096002d3b6f279657ce7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Oct 2010 13:24:45 +0100 Subject: [PATCH 18/19] Fix attached sounds from HUDs erroneously being delivered to other avatars --- .../CoreModules/World/Sound/SoundModule.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index a52fea46fc..e77062b17f 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -62,6 +62,12 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.IsChildAgent) @@ -71,6 +77,19 @@ namespace OpenSim.Region.CoreModules.World.Sound if (dis > 100.0) // Max audio distance return; + if (grp.IsAttachment) + { + + if (grp.GetAttachmentPoint() > 30) // HUD + { + if (sp.ControllingClient.AgentId != grp.OwnerID) + return; + } + + if (sp.ControllingClient.AgentId == grp.OwnerID) + dis = 0; + } + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); From 644eb9fd7f87637727d4789fa331accbffce931e Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 13:45:28 +0000 Subject: [PATCH 19/19] Fix playing sound from HUDs --- .../CoreModules/World/Sound/SoundModule.cs | 18 ++++++++++++++++-- .../Region/Framework/Scenes/SceneObjectPart.cs | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index e77062b17f..8df645dd32 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -31,12 +31,14 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using System.Reflection; +using log4net; namespace OpenSim.Region.CoreModules.World.Sound { public class SoundModule : IRegionModule, ISoundModule { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; @@ -79,7 +81,6 @@ namespace OpenSim.Region.CoreModules.World.Sound if (grp.IsAttachment) { - if (grp.GetAttachmentPoint() > 30) // HUD { if (sp.ControllingClient.AgentId != grp.OwnerID) @@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Sound else gain = (float)((double)gain * ((radius - dis) / radius)); + m_log.DebugFormat("Play sound, gain {0}", gain); sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); }); } @@ -103,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + + if (grp.IsAttachment && grp.GetAttachmentPoint() > 30) + { + objectID = ownerID; + parentID = ownerID; + } + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.IsChildAgent) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a6449decf..f1642015af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3100,6 +3100,7 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID = _ownerID; UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = GetRootPartUUID(); + UUID soundID = UUID.Zero; Vector3 position = AbsolutePosition; // region local ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;