From dd96fef9404daa2b702cc499661a350f8bba69ea Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 4 Jan 2014 21:18:37 +0000 Subject: [PATCH 01/18] Dynamically adjust to the number of visual params sent. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6cb733279c..1d65136985 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3634,7 +3634,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null; From d9848943a96672b14fb9a6be58c4adc1e1552f3c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 4 Jan 2014 10:39:05 -0800 Subject: [PATCH 02/18] Add routines in Util.cs for conversion of region handles to region locations and for the conversion of region world location to region 'region' location. These routines will replace all the arithmatic scattered throughout OpenSimulator. --- OpenSim/Framework/Constants.cs | 5 +++- OpenSim/Framework/Util.cs | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 3468ceac85..3ba264c7af 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -38,7 +38,10 @@ namespace OpenSim.Framework // This could be a parameters but, really, a region of greater than this is pretty unmanageable public const uint MaximumRegionSize = 8192; - public const byte TerrainPatchSize = 16; + // Since terrain is stored in 16x16 heights, regions must be a multiple of this number and that is the minimum + public const int MinRegionSize = 16; + public const int TerrainPatchSize = 16; + public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; public enum EstateAccessCodex : uint diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e8dfec1b5b..b84673b6f9 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -333,6 +333,49 @@ namespace OpenSim.Framework return Utils.UIntsToLong(X, Y); } + // Regions are identified with a 'handle' made up of its region coordinates packed into a ulong. + // Several places rely on the ability to extract a region's location from its handle. + // Note the location is in 'world coordinates' (see below). + // Region handles are based on the lowest coordinate of the region so trim the passed x,y to be the regions 0,0. + public static ulong RegionWorldLocToHandle(uint X, uint Y) + { + return Utils.UIntsToLong(X, Y); + } + + public static ulong RegionLocToHandle(uint X, uint Y) + { + return Utils.UIntsToLong(Util.RegionToWorldLoc(X), Util.RegionToWorldLoc(Y)); + } + + public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y) + { + X = (uint)(handle >> 32); + Y = (uint)(handle & (ulong)uint.MaxValue); + } + + public static void RegionHandleToRegionLoc(ulong handle, out uint X, out uint Y) + { + uint worldX, worldY; + RegionHandleToWorldLoc(handle, out worldX, out worldY); + X = WorldToRegionLoc(worldX); + Y = WorldToRegionLoc(worldY); + } + + // A region location can be 'world coordinates' (meters from zero) or 'region coordinates' + // (number of regions from zero). This measurement of regions relies on the legacy 256 region size. + // These routines exist to make what is being converted explicit so the next person knows what was meant. + // Convert a region's 'world coordinate' to its 'region coordinate'. + public static uint WorldToRegionLoc(uint worldCoord) + { + return worldCoord / Constants.RegionSize; + } + + // Convert a region's 'region coordinate' to its 'world coordinate'. + public static uint RegionToWorldLoc(uint regionCoord) + { + return regionCoord * Constants.RegionSize; + } + public static T Clamp(T x, T min, T max) where T : IComparable { From 004ecee3147cde699adbedcb2fcd88caee87527a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 2 Nov 2013 15:42:26 -0700 Subject: [PATCH 03/18] varregion: send region size in LLLoginResponse. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 11 ++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 6ab5258829..f96480cd09 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -254,11 +254,12 @@ namespace OpenSim.Services.LLLoginService Currency = currency; ClassifiedFee = classifiedFee; - FillOutHomeData(pinfo, home); LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); FillOutRegionData(destination); + m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); + Util.PrintCallStack(); FillOutSeedCap(aCircuit, destination, clientIP); @@ -384,6 +385,8 @@ namespace OpenSim.Services.LLLoginService SimPort = (uint)endPoint.Port; RegionX = (uint)destination.RegionLocX; RegionY = (uint)destination.RegionLocY; + RegionSizeX = destination.RegionSizeX; + RegionSizeY = destination.RegionSizeY; } private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) @@ -529,6 +532,9 @@ namespace OpenSim.Services.LLLoginService responseData["message"] = welcomeMessage; responseData["region_x"] = (Int32)(RegionX); responseData["region_y"] = (Int32)(RegionY); + responseData["region_size_x"] = (Int32)RegionSizeX; + responseData["region_size_y"] = (Int32)RegionSizeY; + m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); if (searchURL != String.Empty) responseData["search"] = searchURL; @@ -918,6 +924,9 @@ namespace OpenSim.Services.LLLoginService set { regionY = value; } } + public int RegionSizeX { get; private set; } + public int RegionSizeY { get; private set; } + public string SunTexture { get { return sunTexture; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fe43582a89..e2f9966e73 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -50,6 +50,8 @@ namespace OpenSim.Services.LLLoginService public class LLLoginService : ILoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[LLOGIN SERVICE]"; + private static bool Initialized = false; protected IUserAccountService m_UserAccountService; @@ -389,6 +391,7 @@ namespace OpenSim.Services.LLLoginService if (guinfo == null) { // something went wrong, make something up, so that we don't have to test this anywhere else + m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); guinfo = new GridUserInfo(); guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); } From 7e32313a491defe8f5fb62ce0036c1692d4b4af9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 3 Jan 2014 07:41:06 -0800 Subject: [PATCH 04/18] varregion: Add region size to teleport event messages (EnableSimulator, CorssRegion, TeleportFinishEvent). Have Simian grid service return the region size. Many teleport related debug log messages. Can be removed when teleport works (like that's ever going to happen). Conflicts: OpenSim/Framework/RegionInfo.cs --- OpenSim/Framework/RegionInfo.cs | 2 ++ .../Caps/EventQueue/EventQueueGetModule.cs | 28 ++++++++++----- .../Caps/EventQueue/EventQueueHelper.cs | 36 +++++++++++++------ .../EntityTransfer/EntityTransferModule.cs | 32 +++++++++++------ .../Framework/Interfaces/IEventQueue.cs | 9 ++--- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++ .../SimianGrid/SimianGridServiceConnector.cs | 6 +++- OpenSim/Services/Interfaces/IGridService.cs | 14 ++++++++ .../Common/Mock/TestEventQueueGetModule.cs | 11 +++--- 9 files changed, 104 insertions(+), 39 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 857c151506..1de30afad3 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -238,6 +238,8 @@ namespace OpenSim.Framework { RegionLocX = legacyRegionLocX; RegionLocY = legacyRegionLocY; + RegionSizeX = Constants.RegionSize; + RegionSizeY = Constants.RegionSize; m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; m_serverURI = string.Empty; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 0dbdbaf456..a05e88c265 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -711,34 +711,46 @@ namespace OpenSim.Region.ClientStack.Linden Enqueue(item, avatarID); } - public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID) + public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) { - OSD item = EventQueueHelper.EnableSimulator(handle, endPoint); + m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>", + "[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY); + + OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); } - public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath) + public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath, + ulong regionHandle, int regionSizeX, int regionSizeY) { - OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath); + m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>", + "[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY); + OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); Enqueue(item, avatarID); } public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, - UUID avatarID) + UUID avatarID, int regionSizeX, int regionSizeY) { + m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>", + "[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY); + OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, - locationID, flags, capsURL, avatarID); + locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); Enqueue(item, avatarID); } public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, - string capsURL, UUID avatarID, UUID sessionID) + string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) { + m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", + "[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY); + OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, - capsURL, avatarID, sessionID); + capsURL, avatarID, sessionID, regionSizeX, regionSizeY); Enqueue(item, avatarID); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index dab727f98e..ded228dbfa 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -70,13 +70,15 @@ namespace OpenSim.Region.ClientStack.Linden return llsdEvent; } - public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint) + public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY) { - OSDMap llsdSimInfo = new OSDMap(3); + OSDMap llsdSimInfo = new OSDMap(5); llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); + llsdSimInfo.Add("RegionSizeX", new OSDInteger(regionSizeX)); + llsdSimInfo.Add("RegionSizeY", new OSDInteger(regionSizeY)); OSDArray arr = new OSDArray(1); arr.Add(llsdSimInfo); @@ -104,7 +106,8 @@ namespace OpenSim.Region.ClientStack.Linden public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, - string capsURL, UUID agentID, UUID sessionID) + string capsURL, UUID agentID, UUID sessionID, + int regionSizeX, int regionSizeY) { OSDArray lookAtArr = new OSDArray(3); lookAtArr.Add(OSD.FromReal(lookAt.X)); @@ -130,11 +133,13 @@ namespace OpenSim.Region.ClientStack.Linden OSDArray agentDataArr = new OSDArray(1); agentDataArr.Add(agentDataMap); - OSDMap regionDataMap = new OSDMap(4); + OSDMap regionDataMap = new OSDMap(6); regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle))); regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); + regionDataMap.Add("RegionSizeX", new OSDInteger(regionSizeX)); + regionDataMap.Add("RegionSizeY", new OSDInteger(regionSizeY)); OSDArray regionDataArr = new OSDArray(1); regionDataArr.Add(regionDataMap); @@ -148,8 +153,9 @@ namespace OpenSim.Region.ClientStack.Linden } public static OSD TeleportFinishEvent( - ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, - uint locationID, uint flags, string capsURL, UUID agentID) + ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, + uint locationID, uint flags, string capsURL, UUID agentID, + int regionSizeX, int regionSizeY) { OSDMap info = new OSDMap(); info.Add("AgentID", OSD.FromUUID(agentID)); @@ -160,6 +166,8 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation + info.Add("RegionSizeX", new OSDInteger(regionSizeX)); + info.Add("RegionSizeY", new OSDInteger(regionSizeY)); OSDArray infoArr = new OSDArray(); infoArr.Add(info); @@ -187,12 +195,18 @@ namespace OpenSim.Region.ClientStack.Linden return BuildEvent("ScriptRunningReply", body); } - public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap) + public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap, + ulong regionHandle, int regionSizeX, int regionSizeY) { - OSDMap body = new OSDMap(3); - body.Add("agent-id", new OSDUUID(agentID)); - body.Add("sim-ip-and-port", new OSDString(simIpAndPort)); - body.Add("seed-capability", new OSDString(seedcap)); + OSDMap body = new OSDMap(6) + { + {"agent-id", new OSDUUID(agentID)}, + {"sim-ip-and-port", new OSDString(simIpAndPort)}, + {"seed-capability", new OSDString(seedcap)}, + {"region-handle", OSD.FromULong(regionHandle)}, + {"region-size-x", OSD.FromInteger(regionSizeX)}, + {"region-size-y", OSD.FromInteger(regionSizeY)} + }; return BuildEvent("EstablishAgentCommunication", body); } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ef5239a516..717c80276b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -825,7 +825,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // The EnableSimulator message makes the client establish a connection with the destination // simulator by sending the initial UseCircuitCode UDP packet to the destination containing the // correct circuit code. - m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID); + m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID, + finalDestination.RegionSizeX, finalDestination.RegionSizeY); + m_log.DebugFormat("{0} Sent EnableSimulator. regName={1}, size=<{2},{3}>", LogHeader, + finalDestination.RegionName, finalDestination.RegionSizeX, finalDestination.RegionSizeY); // XXX: Is this wait necessary? We will always end up waiting on UpdateAgent for the destination // simulator to confirm that it has established communication with the viewer. @@ -835,7 +838,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // unnecessary - teleport will succeed and SEED caps will be requested without it (though possibly // only on TeleportFinish). This is untested for region teleport between different simulators // though this probably also works. - m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); + m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, finalDestination.RegionHandle, + finalDestination.RegionSizeX, finalDestination.RegionSizeY); } else { @@ -921,7 +925,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, send TPFinish to the client, so that it starts the process of contacting the destination region if (m_eqModule != null) { - m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID); + m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID, + finalDestination.RegionSizeX, finalDestination.RegionSizeY); } else { @@ -1074,7 +1079,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // New protocol: send TP Finish directly, without prior ES or EAC. That's what happens in the Linden grid if (m_eqModule != null) - m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID); + m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID, + finalDestination.RegionSizeX, finalDestination.RegionSizeY); else sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, teleportFlags, capsPath); @@ -1717,11 +1723,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { m_eqModule.CrossRegion( - neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, - capsPath, agent.UUID, agent.ControllingClient.SessionId); + neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, + neighbourRegion.ExternalEndPoint, + capsPath, agent.UUID, agent.ControllingClient.SessionId, + neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); } else { + m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader); agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath); } @@ -2087,12 +2096,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } #endregion - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " + - "and EstablishAgentCommunication with seed cap {4}", - scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); + m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + + "and EstablishAgentCommunication with seed cap {8}", LogHeader, + scene.RegionInfo.RegionName, sp.Name, + reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY , capsPath); - m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); - m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); + m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY); + m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY); } else { diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index 3780ece8af..dfc269e302 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs @@ -39,16 +39,17 @@ namespace OpenSim.Region.Framework.Interfaces // These are required to decouple Scenes from EventQueueHelper void DisableSimulator(ulong handle, UUID avatarID); - void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID); + void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY); void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, - string capsPath); + string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY); void TeleportFinishEvent(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, - UUID agentID); + UUID agentID, int regionSizeX, int regionSizeY); void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, - string capsURL, UUID avatarID, UUID sessionID); + string capsURL, UUID avatarID, UUID sessionID, + int regionSizeX, int regionSizeY); void ChatterboxInvitation(UUID sessionID, string sessionName, UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID, Vector3 position, diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7772f9476b..610bcd63be 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1953,6 +1953,11 @@ namespace OpenSim.Region.Framework.Scenes GridRegion region = new GridRegion(RegionInfo); string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); + m_log.DebugFormat("{0} RegisterRegionWithGrid. name={1},id={2},loc=<{3},{4}>,size=<{5},{6}>", + LogHeader, m_regionName, + RegionInfo.RegionID, + RegionInfo.RegionLocX, RegionInfo.RegionLocY, + RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); if (error != String.Empty) throw new Exception(error); } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 816591b82e..c928f163bf 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -443,9 +443,13 @@ namespace OpenSim.Services.Connectors.SimianGrid region.RegionName = response["Name"].AsString(); Vector3d minPosition = response["MinPosition"].AsVector3d(); + Vector3d maxPosition = response["MaxPosition"].AsVector3d(); region.RegionLocX = (int)minPosition.X; region.RegionLocY = (int)minPosition.Y; - + + region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X; + region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y; + if ( ! extraData["HyperGrid"] ) { Uri httpAddress = response["Address"].AsUri(); region.ExternalHostName = httpAddress.Host; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 59d61673ce..9459ecd881 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -29,9 +29,13 @@ using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; +using System.Reflection; + using OpenSim.Framework; using OpenMetaverse; +using log4net; + namespace OpenSim.Services.Interfaces { public interface IGridService @@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces public class GridRegion { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[GRID REGION]"; + /// /// The port by which http communication occurs with the region /// @@ -422,9 +429,13 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("sizeX")) RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); + else + RegionSizeX = (int)Constants.RegionSize; if (kvp.ContainsKey("sizeY")) RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); + else + RegionSizeX = (int)Constants.RegionSize; if (kvp.ContainsKey("regionName")) RegionName = (string)kvp["regionName"]; @@ -473,6 +484,9 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("Token")) Token = kvp["Token"].ToString(); + + m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", + LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); } } } diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index e666433c15..f2bae5876d 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs @@ -114,22 +114,25 @@ namespace OpenSim.Tests.Common AddEvent(avatarID, "DisableSimulator", handle); } - public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID) + public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) { AddEvent(avatarID, "EnableSimulator", handle); } - public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath) + public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath, + ulong regionHandle, int regionSizeX, int regionSizeY) { AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath); } - public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) + public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, + uint locationID, uint flags, string capsURL, UUID agentID, int regionSizeX, int regionSizeY) { AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); } - public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID) + public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, + string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) { AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID); } From 8ff2ff1a3667a679c4e8e8502a80e03e7e2ca69d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 4 Jan 2014 15:10:35 -0800 Subject: [PATCH 05/18] Remove some chatty DebugFormat statements. No functional changes. --- OpenSim/Services/Interfaces/IGridService.cs | 4 ++-- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 9459ecd881..739e279072 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -485,8 +485,8 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("Token")) Token = kvp["Token"].ToString(); - m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", - LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); + // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", + // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); } } } diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f96480cd09..5256b74f74 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -258,8 +258,7 @@ namespace OpenSim.Services.LLLoginService LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); FillOutRegionData(destination); - m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); - Util.PrintCallStack(); + // m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); FillOutSeedCap(aCircuit, destination, clientIP); @@ -534,7 +533,7 @@ namespace OpenSim.Services.LLLoginService responseData["region_y"] = (Int32)(RegionY); responseData["region_size_x"] = (Int32)RegionSizeX; responseData["region_size_y"] = (Int32)RegionSizeY; - m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); + // m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); if (searchURL != String.Empty) responseData["search"] = searchURL; From 38148bd4b68ad718bf6274342ac8382a611e2010 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 4 Jan 2014 17:52:38 -0800 Subject: [PATCH 06/18] Some missing definitions needed for successful compilation. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneBase.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 717c80276b..246b2530ac 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -51,7 +51,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EntityTransferModule")] public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[ENTITY TRANSFER MODULE]"; public const int DefaultMaxTransferDistance = 4095; public const bool WaitForAgentArrivedAtDestinationDefault = true; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 4f0470698a..c86f41217c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -42,7 +42,8 @@ namespace OpenSim.Region.Framework.Scenes { public abstract class SceneBase : IScene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected static readonly string LogHeader = "[SCENE]"; #region Events From 0155d42b80ee7b35d0a882052d8cf4976e7d15de Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 8 Jan 2014 00:54:39 +0000 Subject: [PATCH 07/18] If an agent is sitting, then do send the rotation in the agent update instead of zeroing it to resolve mouselook camera problems Addresses http://opensimulator.org/mantis/view.php?id=6892 Thanks to tglion for this spot. This resolves a recent regression from 17b32b764acd815400d9eb903aaec6dcebd60ac7 --- .../ClientStack/Linden/UDP/LLClientView.cs | 25 +++++++++++++------ .../Region/Framework/Scenes/ScenePresence.cs | 2 ++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a04ded5b9a..c38c829886 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5098,11 +5098,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP // excessive up and down movements of the camera when looking up and down. // See http://opensimulator.org/mantis/view.php?id=3274 // This does not affect head movement, since this is controlled entirely by camera movement rather than - // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes - // effect, not the avatar rotation. + // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change + // the rotation in this case. rotation = presence.Rotation; - rotation.X = 0; - rotation.Y = 0; + + if (!presence.IsSatOnObject) + { + rotation.X = 0; + rotation.Y = 0; + } if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); @@ -5225,11 +5229,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // excessive up and down movements of the camera when looking up and down. // See http://opensimulator.org/mantis/view.php?id=3274 // This does not affect head movement, since this is controlled entirely by camera movement rather than - // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes - // effect, not the avatar rotation. + // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change + // the rotation in this case. Quaternion rot = data.Rotation; - rot.X = 0; - rot.Y = 0; + + if (!data.IsSatOnObject) + { + rot.X = 0; + rot.Y = 0; + } + rot.ToBytes(objectData, 52); //data.AngularVelocity.ToBytes(objectData, 64); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7ed3a4b113..49f70c4f28 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1640,6 +1640,8 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAgentTerseUpdate(this); PhysicsActor actor = PhysicsActor; + + // This will be the case if the agent is sitting on the groudn or on an object. if (actor == null) { SendControlsToScripts(flagsForScripts); From 13f31fdf85c404896c166932730b7b8bc5416626 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 4 Nov 2013 19:28:24 +0200 Subject: [PATCH 08/18] Refactored setting permissions when rezzing items: use the same function when rezzing from user inventory and prim inventory. Also, fixed a bug: when rezzing a coalesced object from a prim's inventory, apply the coalesced object's name and description only to the first sub-object; not to all the objects in the coalescence. (This was already done correctly when rezzing from a user's inventory.) --- OpenSim/Framework/PermissionsUtil.cs | 68 ++++++++++++++++++ .../InventoryAccess/InventoryAccessModule.cs | 51 ++++--------- .../Framework/Scenes/SceneObjectGroup.cs | 3 + .../Framework/Scenes/SceneObjectPart.cs | 58 +++++++++++++++ .../Scenes/SceneObjectPartInventory.cs | 72 +++++-------------- 5 files changed, 159 insertions(+), 93 deletions(-) create mode 100644 OpenSim/Framework/PermissionsUtil.cs diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs new file mode 100644 index 0000000000..3dce04dde0 --- /dev/null +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -0,0 +1,68 @@ +/* + * 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.Generic; +using System.Reflection; +using System.Text; +using log4net; + +namespace OpenSim.Framework +{ + public static class PermissionsUtil + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Logs permissions flags. Useful when debugging permission problems. + /// + /// + public static void LogPermissions(String name, String message, uint basePerm, uint curPerm, uint nextPerm) + { + m_log.DebugFormat("Permissions of \"{0}\" at \"{1}\": Base {2} ({3:X4}), Current {4} ({5:X4}), NextOwner {6} ({7:X4})", + name, message, + PermissionsToString(basePerm), basePerm, PermissionsToString(curPerm), curPerm, PermissionsToString(nextPerm), nextPerm); + } + + /// + /// Converts a permissions bit-mask to a string (e.g., "MCT"). + /// + private static string PermissionsToString(uint perms) + { + string str = ""; + if ((perms & (int)PermissionMask.Modify) != 0) + str += "M"; + if ((perms & (int)PermissionMask.Copy) != 0) + str += "C"; + if ((perms & (int)PermissionMask.Transfer) != 0) + str += "T"; + if (str == "") + str = "."; + return str; + } + } +} diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 831922eda7..da36ed0ab6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -512,10 +512,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; - // Magic number badness. Maybe this deserves an enum. - // bit 4 (16) is the "Slam" bit, it means treat as passed - // and apply next owner perms on rez - item.CurrentPermissions |= 16; // Slam! + // apply next owner perms on rez + item.CurrentPermissions |= SceneObjectGroup.SLAM; } else { @@ -809,11 +807,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; } - foreach (SceneObjectPart part in group.Parts) + if (item == null) { - // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. - part.LastOwnerID = part.OwnerID; - part.OwnerID = remoteClient.AgentId; + // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here. + foreach (SceneObjectPart part in group.Parts) + { + // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. + part.LastOwnerID = part.OwnerID; + part.OwnerID = remoteClient.AgentId; + } } if (!attachment) @@ -969,44 +971,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", // rootPart.OwnerID, item.Owner, item.CurrentPermissions); - if ((rootPart.OwnerID != item.Owner) || - (item.CurrentPermissions & 16) != 0) + if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) { //Need to kill the for sale here rootPart.ObjectSaleType = 0; rootPart.SalePrice = 10; - - if (m_Scene.Permissions.PropagatePermissions()) - { - foreach (SceneObjectPart part in so.Parts) - { - if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) - { - part.EveryoneMask = item.EveryOnePermissions; - part.NextOwnerMask = item.NextPermissions; - } - part.GroupMask = 0; // DO NOT propagate here - } - - so.ApplyNextOwnerPermissions(); - } } - + foreach (SceneObjectPart part in so.Parts) { part.FromUserInventoryItemID = fromUserInventoryItemId; - - if ((part.OwnerID != item.Owner) || - (item.CurrentPermissions & 16) != 0) - { - part.Inventory.ChangeInventoryOwner(item.Owner); - part.GroupMask = 0; // DO NOT propagate here - } - - part.EveryoneMask = item.EveryOnePermissions; - part.NextOwnerMask = item.NextPermissions; + part.ApplyPermissionsOnRez(item, true, m_Scene); } - + rootPart.TrimPermissions(); if (isAttachment) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4b4e4ba9c6..23507f4b7e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -109,6 +109,9 @@ namespace OpenSim.Region.Framework.Scenes STATUS_ROTATE_Z = 0x008, } + // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm + public static readonly uint SLAM = 16; + // private PrimCountTaintedDelegate handlerPrimCountTainted = null; /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ea9d0d85ac..1cf77267e4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4800,6 +4800,64 @@ namespace OpenSim.Region.Framework.Scenes { ParentGroup.AddScriptLPS(count); } + + /// + /// Sets a prim's owner and permissions when it's rezzed. + /// + /// The inventory item from which the item was rezzed + /// True: the item is being rezzed from the user's inventory. False: from a prim's inventory. + /// The scene the prim is being rezzed into + public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) + { + if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) + { + if (scene.Permissions.PropagatePermissions()) + { + if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) + { + // Apply the item's permissions to the object + //LogPermissions("Before applying item permissions"); + if (userInventory) + { + EveryoneMask = item.EveryOnePermissions; + NextOwnerMask = item.NextPermissions; + } + else + { + if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) + EveryoneMask = item.EveryOnePermissions; + if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) + NextOwnerMask = item.NextPermissions; + if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) + GroupMask = item.GroupPermissions; + } + //LogPermissions("After applying item permissions"); + } + } + + GroupMask = 0; // DO NOT propagate here + } + + if (OwnerID != item.Owner) + { + //LogPermissions("Before ApplyNextOwnerPermissions"); + ApplyNextOwnerPermissions(); + //LogPermissions("After ApplyNextOwnerPermissions"); + + LastOwnerID = OwnerID; + OwnerID = item.Owner; + Inventory.ChangeInventoryOwner(item.Owner); + } + } + + /// + /// Logs the prim's permissions. Useful when debugging permission problems. + /// + /// + private void LogPermissions(String message) + { + PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask); + } public void ApplyNextOwnerPermissions() { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 380e402d16..5fa01e31e1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -764,48 +764,27 @@ namespace OpenSim.Region.Framework.Scenes // Since renaming the item in the inventory does not affect the name stored // in the serialization, transfer the correct name from the inventory to the // object itself before we rez. - rootPart.Name = item.Name; - rootPart.Description = item.Description; - - SceneObjectPart[] partList = group.Parts; + // Only do these for the first object if we are rezzing a coalescence. + if (i == 0) + { + rootPart.Name = item.Name; + rootPart.Description = item.Description; + } group.SetGroup(m_part.GroupID, null); - // TODO: Remove magic number badness - if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number + foreach (SceneObjectPart part in group.Parts) { - if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) - { - foreach (SceneObjectPart part in partList) - { - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) - part.EveryoneMask = item.EveryonePermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) - part.NextOwnerMask = item.NextPermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) - part.GroupMask = item.GroupPermissions; - } + // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :) + InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID); + dest.BasePermissions = item.BasePermissions; + dest.CurrentPermissions = item.CurrentPermissions; + dest.EveryOnePermissions = item.EveryonePermissions; + dest.GroupPermissions = item.GroupPermissions; + dest.NextPermissions = item.NextPermissions; + dest.Flags = item.Flags; - group.ApplyNextOwnerPermissions(); - } - } - - foreach (SceneObjectPart part in partList) - { - // TODO: Remove magic number badness - if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number - { - part.LastOwnerID = part.OwnerID; - part.OwnerID = item.OwnerID; - part.Inventory.ChangeInventoryOwner(item.OwnerID); - } - - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) - part.EveryoneMask = item.EveryonePermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) - part.NextOwnerMask = item.NextPermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) - part.GroupMask = item.GroupPermissions; + part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene); } rootPart.TrimPermissions(); @@ -1130,25 +1109,6 @@ namespace OpenSim.Region.Framework.Scenes mask &= ~((uint)PermissionMask.Transfer >> 13); if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) mask &= ~((uint)PermissionMask.Modify >> 13); - - if (item.InvType != (int)InventoryType.Object) - { - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } - else - { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) mask &= ~(uint)PermissionMask.Copy; From 91fd9c467083a57e2898594ce3ae764aa0525bb5 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 5 Nov 2013 15:42:23 +0200 Subject: [PATCH 09/18] Refactored: use a single function to apply an object's folded permissions to its main permissions --- .../RemoteController/RemoteAdminPlugin.cs | 12 +++++------ OpenSim/Framework/PermissionsUtil.cs | 19 ++++++++++++++++++ .../InventoryAccess/InventoryAccessModule.cs | 20 +++++++++---------- .../World/Objects/BuySell/BuySellModule.cs | 8 +------- .../Framework/Scenes/Scene.Inventory.cs | 17 +++++++++------- .../Scenes/SceneObjectPartInventory.cs | 11 ++++------ 6 files changed, 48 insertions(+), 39 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 354f587466..811781cae8 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -2763,15 +2763,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// private void ApplyNextOwnerPermissions(InventoryItemBase item) { - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + if (item.InvType == (int)InventoryType.Object) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + uint perms = item.CurrentPermissions; + PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); + item.CurrentPermissions = perms; } + item.CurrentPermissions &= item.NextPermissions; item.BasePermissions &= item.NextPermissions; item.EveryOnePermissions &= item.NextPermissions; diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04dde0..d785a781f5 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -64,5 +64,24 @@ namespace OpenSim.Framework str = "."; return str; } + + /// + /// Applies an object's folded permissions to its regular permissions. + /// + /// The folded permissions. Only the lowest 7 bits are examined. + /// The permissions variable to modify. + public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms) + { + if ((foldedPerms & 7) == 0) + return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded + + if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0) + mainPerms &= ~(uint)PermissionMask.Copy; + if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0) + mainPerms &= ~(uint)PermissionMask.Transfer; + if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0) + mainPerms &= ~(uint)PermissionMask.Modify; + } + } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index da36ed0ab6..a7e6fdd1f8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -443,13 +443,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } else { - AddPermissions(item, objlist[0], objlist, remoteClient); - item.CreationDate = Util.UnixTimeSinceEpoch(); item.Description = asset.Description; item.Name = asset.Name; item.AssetType = asset.Type; + AddPermissions(item, objlist[0], objlist, remoteClient); + m_Scene.AddInventoryItem(item); if (remoteClient != null && item.Owner == remoteClient.AgentId) @@ -495,16 +495,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess effectivePerms &= grp.GetEffectivePermissions(); effectivePerms |= (uint)PermissionMask.Move; + //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); + if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) { uint perms = effectivePerms; - uint nextPerms = (perms & 7) << 13; - if ((nextPerms & (uint)PermissionMask.Copy) == 0) - perms &= ~(uint)PermissionMask.Copy; - if ((nextPerms & (uint)PermissionMask.Transfer) == 0) - perms &= ~(uint)PermissionMask.Transfer; - if ((nextPerms & (uint)PermissionMask.Modify) == 0) - perms &= ~(uint)PermissionMask.Modify; + PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); item.BasePermissions = perms & so.RootPart.NextOwnerMask; item.CurrentPermissions = item.BasePermissions; @@ -530,8 +526,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess (uint)PermissionMask.Move | (uint)PermissionMask.Export | 7); // Preserve folded permissions - } - + } + + //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); + return item; } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 22a53a84f4..0cb574a4dc 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -198,13 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell item.InvType = (int)InventoryType.Object; item.Folder = categoryID; - uint nextPerms=(perms & 7) << 13; - if ((nextPerms & (uint)PermissionMask.Copy) == 0) - perms &= ~(uint)PermissionMask.Copy; - if ((nextPerms & (uint)PermissionMask.Transfer) == 0) - perms &= ~(uint)PermissionMask.Transfer; - if ((nextPerms & (uint)PermissionMask.Modify) == 0) - perms &= ~(uint)PermissionMask.Modify; + PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); item.BasePermissions = perms & part.NextOwnerMask; item.CurrentPermissions = perms & part.NextOwnerMask; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 65536dbdbc..9cc5cde2d1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -669,17 +669,13 @@ namespace OpenSim.Region.Framework.Scenes // a mask if (item.InvType == (int)InventoryType.Object) { - // Create a safe mask for the current perms - uint foldedPerms = (item.CurrentPermissions & 7) << 13; - foldedPerms |= permsMask; - bool isRootMod = (item.CurrentPermissions & (uint)PermissionMask.Modify) != 0 ? true : false; // Mask the owner perms to the folded perms - ownerPerms &= foldedPerms; - basePerms &= foldedPerms; + PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); + PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); // If the root was mod, let the mask reflect that // We also need to adjust the base here, because @@ -1209,9 +1205,16 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); if (taskItem.InvType == (int)InventoryType.Object) - agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); + { + uint perms = taskItem.CurrentPermissions; + PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); + agentItem.BasePermissions = perms | (uint)PermissionMask.Move; + agentItem.CurrentPermissions = agentItem.BasePermissions; + } else + { agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; + } agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; agentItem.NextPermissions = taskItem.NextPermissions; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5fa01e31e1..fb8ecd5df9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1132,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + if (item.InvType == (int)InventoryType.Object) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + uint perms = item.CurrentPermissions; + PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); + item.CurrentPermissions = perms; } item.CurrentPermissions &= item.NextPermissions; From a94e1e0e085a3c70e35e2c9cf0583d193c6ed32f Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 6 Nov 2013 12:57:44 +0200 Subject: [PATCH 10/18] When creating a coalesced object, set its Creator ID if all the objects have the same creator --- .../InventoryAccess/InventoryAccessModule.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a7e6fdd1f8..af95577318 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -412,17 +412,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (item == null) return null; + + item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); + item.CreatorData = objlist[0].RootPart.CreatorData; - // Can't know creator is the same, so null it in inventory if (objlist.Count > 1) { - item.CreatorId = UUID.Zero.ToString(); item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; + + // If the objects have different creators then don't specify a creator at all + foreach (SceneObjectGroup objectGroup in objlist) + { + if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId) + || (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData)) + { + item.CreatorId = UUID.Zero.ToString(); + item.CreatorData = string.Empty; + break; + } + } } else { - item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); - item.CreatorData = objlist[0].RootPart.CreatorData; item.SaleType = objlist[0].RootPart.ObjectSaleType; item.SalePrice = objlist[0].RootPart.SalePrice; } From 88f01a41305364e0d505964c6743d95d1564530b Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 7 Nov 2013 17:25:39 +0200 Subject: [PATCH 11/18] When creating a coalesced object, set its permissions to the lowest-common-denominator of all the sub-objects --- .../InventoryAccess/InventoryAccessModule.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index af95577318..781cc69595 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -502,8 +502,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess IClientAPI remoteClient) { uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; + uint allObjectsNextOwnerPerms = 0x7fffffff; + uint allObjectsEveryOnePerms = 0x7fffffff; + uint allObjectsGroupPerms = 0x7fffffff; + foreach (SceneObjectGroup grp in objsForEffectivePermissions) + { effectivePerms &= grp.GetEffectivePermissions(); + allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask; + allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask; + allObjectsGroupPerms &= grp.RootPart.GroupMask; + } effectivePerms |= (uint)PermissionMask.Move; //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); @@ -513,11 +522,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess uint perms = effectivePerms; PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); - item.BasePermissions = perms & so.RootPart.NextOwnerMask; + item.BasePermissions = perms & allObjectsNextOwnerPerms; item.CurrentPermissions = item.BasePermissions; - item.NextPermissions = perms & so.RootPart.NextOwnerMask; - item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; - item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; + item.NextPermissions = perms & allObjectsNextOwnerPerms; + item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms; + item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms; // apply next owner perms on rez item.CurrentPermissions |= SceneObjectGroup.SLAM; @@ -526,9 +535,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { item.BasePermissions = effectivePerms; item.CurrentPermissions = effectivePerms; - item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; - item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; - item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; + item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; + item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms; + item.GroupPermissions = allObjectsGroupPerms & effectivePerms; item.CurrentPermissions &= ((uint)PermissionMask.Copy | From da47bcae3ec625e7cb8dc1947d1aa39ba7b8ac0f Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 16 Sep 2013 09:42:14 +0300 Subject: [PATCH 12/18] When moving the root prim of an attachment: a) Change the attach position; b) Move the other prims in the reverse direction to compensate --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 23507f4b7e..e31270ce06 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3043,13 +3043,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3 oldPos; - // FIXME: This improves the situation where editing just the root prim of an attached object would send - // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim - // still ends up in the wrong position on reattach. if (IsAttachment) - oldPos = RootPart.OffsetPosition; + oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim else - oldPos = AbsolutePosition + RootPart.OffsetPosition; + oldPos = AbsolutePosition + m_rootPart.OffsetPosition; Vector3 diff = oldPos - newPos; Quaternion partRotation = m_rootPart.RotationOffset; @@ -3064,6 +3061,9 @@ namespace OpenSim.Region.Framework.Scenes } AbsolutePosition = newPos; + + if (IsAttachment) + m_rootPart.AttachedPos = newPos; HasGroupChanged = true; ScheduleGroupForTerseUpdate(); From 9050c152b402d0c629b7050033c4d9361fda637b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 4 Jan 2014 21:18:37 +0000 Subject: [PATCH 13/18] Dynamically adjust to the number of visual params sent. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c38c829886..0ebccbe69c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3634,7 +3634,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null; From 08f2fc63cd2891bbc445371584b5b8da5822a25f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 Jan 2014 15:35:12 -0800 Subject: [PATCH 14/18] Fixed llTextBox error message text --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 566304811c..e54b697e6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4397,7 +4397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID av = new UUID(); if (!UUID.TryParse(agent,out av)) { - LSLError("First parameter to llDialog needs to be a key"); + LSLError("First parameter to llTextBox needs to be a key"); return; } From 8c6b9ef86574e9a3f95774715ef63417a2981c18 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Jan 2014 20:45:05 +0000 Subject: [PATCH 15/18] minor: Add ctrlaltdavid to contributors list --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index ef84315cc7..ee3d7c7141 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -75,6 +75,7 @@ what it is today. * Chris Yeoh (IBM) * controlbreak * coyled +* ctrlaltdavid * Daedius * daTwitch * devalnor-#708 From 70dd4cf1525deeaf2c71cb184a6f35dcc63b01df Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Jan 2014 20:51:28 +0000 Subject: [PATCH 16/18] In library inventory, correct asset id for llSay example script From http://opensimulator.org/mantis/view.php?id=6917 Thanks to FreakyTech for this spot. --- bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml | 6 +++--- bin/inventory/ScriptsLibrary/ScriptsLibraryItems.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml b/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml index c76cb78ee2..eae9642275 100644 --- a/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml +++ b/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml @@ -89,9 +89,9 @@ -
+
- +
@@ -240,4 +240,4 @@
- \ No newline at end of file + diff --git a/bin/inventory/ScriptsLibrary/ScriptsLibraryItems.xml b/bin/inventory/ScriptsLibrary/ScriptsLibraryItems.xml index df9d867b5d..6e51d0bd78 100644 --- a/bin/inventory/ScriptsLibrary/ScriptsLibraryItems.xml +++ b/bin/inventory/ScriptsLibrary/ScriptsLibraryItems.xml @@ -195,7 +195,7 @@
- + From bc0ff5e7d43b873f8895f782c73170a84b5c35d6 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 2 May 2013 15:23:37 +0300 Subject: [PATCH 17/18] Allow Boolean nodes in XML to be specified as "0/1". AuroraSim does that. --- OpenSim/Framework/Util.cs | 4 +++- .../Connectors/Hypergrid/UserAgentServiceConnector.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e8dfec1b5b..52635b2584 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2029,8 +2029,10 @@ namespace OpenSim.Framework #region Xml Serialization Utilities public static bool ReadBoolean(XmlTextReader reader) { + // AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this. reader.ReadStartElement(); - bool result = Boolean.Parse(reader.ReadContentAsString().ToLower()); + string val = reader.ReadContentAsString().ToLower(); + bool result = val.Equals("true") || val.Equals("1"); reader.ReadEndElement(); return result; diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index d8a3184780..2511c08052 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -557,7 +557,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch { - m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs", m_ServerURL); + m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID); // reason = "Exception: " + e.Message; return serverURLs; } From 239b85d7cee3d8e0ae7349cbe62582d46940c732 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 10 Jan 2014 22:52:31 -0800 Subject: [PATCH 18/18] Fix crash in BulletSim which sometimes happens making a linkset physical (like sitting on and activating a vehicle) and crossing borders. This keeps better bookkeeping on compound shapes so BulletSim can identify them when being freed. --- .../Region/Physics/BulletSPlugin/BSShapes.cs | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 006a9c17f2..fbe320b7b7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -71,7 +71,7 @@ public abstract class BSShape lastReferenced = DateTime.Now; } - // Called when this shape is being used again. + // Called when this shape is done being used. protected virtual void DecrementReference() { referenceCount--; @@ -866,6 +866,8 @@ public class BSShapeHull : BSShape public class BSShapeCompound : BSShape { private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; + public static Dictionary CompoundShapes = new Dictionary(); + public BSShapeCompound(BulletShape pShape) : base(pShape) { } @@ -873,7 +875,9 @@ public class BSShapeCompound : BSShape { // Base compound shapes are not shared so this returns a raw shape. // A built compound shape can be reused in linksets. - return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); + BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); + CompoundShapes.Add(ret.AddrString, ret); + return ret; } public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) { @@ -911,10 +915,21 @@ public class BSShapeCompound : BSShape BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); DereferenceAnonCollisionShape(physicsScene, childShape); } + + lock (CompoundShapes) + CompoundShapes.Remove(physShapeInfo.AddrString); physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); } } } + public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound) + { + lock (CompoundShapes) + { + string addr = pShape.AddrString; + return CompoundShapes.TryGetValue(addr, out outCompound); + } + } private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) { BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); @@ -926,10 +941,13 @@ public class BSShapeCompound : BSShape private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) { // TODO: figure a better way to go through all the shape types and find a possible instance. + physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}", + BSScene.DetailLogZero, pShape); BSShapeMesh meshDesc; if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) { meshDesc.Dereference(physicsScene); + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape); } else { @@ -937,13 +955,15 @@ public class BSShapeCompound : BSShape if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) { hullDesc.Dereference(physicsScene); + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape); } else { BSShapeConvexHull chullDesc; - if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) + if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc)) { chullDesc.Dereference(physicsScene); + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape); } else { @@ -951,20 +971,23 @@ public class BSShapeCompound : BSShape if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) { gImpactDesc.Dereference(physicsScene); + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape); } else { // Didn't find it in the lists of specific types. It could be compound. - if (physicsScene.PE.IsCompound(pShape)) + BSShapeCompound compoundDesc; + if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc)) { - BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); - recursiveCompound.Dereference(physicsScene); + compoundDesc.Dereference(physicsScene); + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape); } else { // If none of the above, maybe it is a simple native shape. if (physicsScene.PE.IsNativeShape(pShape)) { + // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape); BSShapeNative nativeShape = new BSShapeNative(pShape); nativeShape.Dereference(physicsScene); } @@ -1021,6 +1044,8 @@ public class BSShapeConvexHull : BSShape convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); convexShape.shapeKey = newMeshKey; ConvexHulls.Add(convexShape.shapeKey, retConvexHull); + physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}", + BSScene.DetailLogZero, convexShape); } // Done with the base mesh @@ -1049,7 +1074,7 @@ public class BSShapeConvexHull : BSShape } } // Loop through all the known hulls and return the description based on the physical address. - public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) + public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) { bool ret = false; BSShapeConvexHull foundDesc = null;