From 3b26baf282f911842e5aabcb0ca2ebd80ab10dca Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 9 Aug 2010 22:54:13 +0100 Subject: [PATCH 1/8] Even if all data migratios are up to date, still print the current revision to the log --- OpenSim/Data/Migration.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index c177097ebd..86531d92df 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -407,9 +407,8 @@ scan_old_style: } if (migrations.Count < 1) - { - m_log.InfoFormat("[MIGRATIONS]: {0} up to date, no migrations to apply", _type); - } + m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after); + return migrations; } } From a5dab074a0fd50d8e2e35ad2981678f8c3e9f0e4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 10 Aug 2010 16:00:35 +0100 Subject: [PATCH 2/8] Handle incoming ObjectImage (TextureEntry) updates synchronously rather than asynchronously At least on stock Linden clients, updating the texture on all faces of the prim will actually send an ObjectImage packet for each update. There is a race condition if these are handled async, meaning that occasionally not all of the faces are correctly updated. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index df2690ee2b..87a5832d24 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4731,7 +4731,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); - AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage); + + // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once, + // some clients will send out a separate ObjectImage packet for each face + AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false); + AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false); AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false); AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); From 85fc2dfe3c9c8fc1881833385d13e1c6aae13fe9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 10 Aug 2010 16:16:57 +0100 Subject: [PATCH 3/8] extend TestDuplicateObject() to a two prim object --- .../Framework/Scenes/Tests/SceneGraphTests.cs | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 8a103d7081..bb6e540896 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -48,22 +48,31 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); Scene scene = SceneSetupHelpers.SetupScene(); - UUID ownerUuid = new UUID("00000000-0000-0000-0000-000000000010"); - string objName = "obj1"; - UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); + UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); + string part1Name = "part1"; + UUID part1Id = new UUID("00000000-0000-0000-0000-000000000001"); + string part2Name = "part2"; + UUID part2Id = new UUID("00000000-0000-0000-0000-000000000002"); - SceneObjectPart part - = new SceneObjectPart(ownerUuid, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = objName, UUID = objUuid }; + SceneObjectPart part1 + = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = part1Name, UUID = part1Id }; + SceneObjectGroup so = new SceneObjectGroup(part1); + SceneObjectPart part2 + = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = part2Name, UUID = part2Id }; + so.AddPart(part2); - scene.AddNewSceneObject(new SceneObjectGroup(part), false); + scene.AddNewSceneObject(so, false); + + uint part1LocalId = part1.LocalId; SceneObjectGroup duplicatedSo = scene.SceneGraph.DuplicateObject( - part.LocalId, new Vector3(10, 0, 0), 0, ownerUuid, UUID.Zero, Quaternion.Identity); + part1LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity); - Assert.That(duplicatedSo.Children.Count, Is.EqualTo(1)); - Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part.LocalId)); + Assert.That(duplicatedSo.Children.Count, Is.EqualTo(2)); + Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part1.LocalId)); //SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); } From 7203feb83c3fd4ca7af7ec717ca919fc419bcffd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 10 Aug 2010 16:50:36 +0100 Subject: [PATCH 4/8] Extend DuplicateObject() test to check flags on the duplicated object --- .../Framework/Scenes/Tests/SceneGraphTests.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index bb6e540896..d7da9cb60b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -65,16 +65,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests scene.AddNewSceneObject(so, false); - uint part1LocalId = part1.LocalId; - - SceneObjectGroup duplicatedSo + SceneObjectGroup dupeSo = scene.SceneGraph.DuplicateObject( - part1LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity); + part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity); + Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); - Assert.That(duplicatedSo.Children.Count, Is.EqualTo(2)); - Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part1.LocalId)); + SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); + SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); + Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); + Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); - //SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); + Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags)); + Assert.That(dupePart2.Flags, Is.EqualTo(part2.Flags)); } } } \ No newline at end of file From 0a81038dd5be361dba0a95546f3ef695ae720fc6 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 10 Aug 2010 17:26:31 +0100 Subject: [PATCH 5/8] Reduce number of paths in SOP code by setting flags via Flags property rather than _flags Both ObjectFlags and Flags are effectively exactly the same property, except that ObjectFlags is uint and Flags is PrimFlags Both reference the PrimFlags _flags underneath, so you couldn't set a non PrimFlags uint anyway. Deprecated ObjectFlags in favour of Flags. --- .../Framework/Scenes/SceneObjectPart.cs | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0c35eec533..0d3f64c39c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -396,7 +396,7 @@ namespace OpenSim.Region.Framework.Scenes // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log - _flags = 0; + Flags = 0; CreateSelected = true; TrimPermissions(); @@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes private uint _groupMask = (uint)PermissionMask.None; private uint _everyoneMask = (uint)PermissionMask.None; private uint _nextOwnerMask = (uint)PermissionMask.All; - private PrimFlags _flags = 0; + private PrimFlags _flags = PrimFlags.None; private DateTime m_expires; private DateTime m_rezzed; private bool m_createSelected = false; @@ -471,10 +471,14 @@ namespace OpenSim.Region.Framework.Scenes set { m_inventory.Items = value; } } + /// + /// This is idential to the Flags property, except that the returned value is uint rather than PrimFlags + /// + [Obsolete("Use Flags property instead")] public uint ObjectFlags { - get { return (uint)_flags; } - set { _flags = (PrimFlags)value; } + get { return (uint)Flags; } + set { Flags = (PrimFlags)value; } } public UUID UUID @@ -1169,7 +1173,11 @@ namespace OpenSim.Region.Framework.Scenes public PrimFlags Flags { get { return _flags; } - set { _flags = value; } + set + { +// m_log.DebugFormat("[SOP]: Setting flags for {0} {1} to {2}", UUID, Name, value); + _flags = value; + } } [XmlIgnore] @@ -1305,7 +1313,7 @@ namespace OpenSim.Region.Framework.Scenes if ((ObjectFlags & (uint) flag) == 0) { //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); - _flags |= flag; + Flags |= flag; if (flag == PrimFlags.TemporaryOnRez) ResetExpire(); @@ -1940,12 +1948,14 @@ namespace OpenSim.Region.Framework.Scenes } public uint GetEffectiveObjectFlags() - { - PrimFlags f = _flags; - if (m_parentGroup == null || m_parentGroup.RootPart == this) - f &= ~(PrimFlags.Touch | PrimFlags.Money); + { + // Commenting this section of code out since it doesn't actually do anything, as enums are handled by + // value rather than reference +// PrimFlags f = _flags; +// if (m_parentGroup == null || m_parentGroup.RootPart == this) +// f &= ~(PrimFlags.Touch | PrimFlags.Money); - return (uint)_flags | (uint)LocalFlags; + return (uint)Flags | (uint)LocalFlags; } public Vector3 GetGeometricCenter() @@ -2696,10 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes public void RemFlag(PrimFlags flag) { // PrimFlags prevflag = Flags; - if ((ObjectFlags & (uint) flag) != 0) + if ((Flags & flag) != 0) { //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString()); - _flags &= ~flag; + Flags &= ~flag; } //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); //ScheduleFullUpdate(); @@ -2990,10 +3000,10 @@ namespace OpenSim.Region.Framework.Scenes if (remoteClient.AgentId == _ownerID) { - if ((uint) (_flags & PrimFlags.CreateSelected) != 0) + if ((Flags & PrimFlags.CreateSelected) != 0) { clientFlags |= (uint) PrimFlags.CreateSelected; - _flags &= ~PrimFlags.CreateSelected; + Flags &= ~PrimFlags.CreateSelected; } } //bool isattachment = IsAttachment; From 7741143fb5c7c62355170a2f795561d28b9f589f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Aug 2010 11:14:24 -0700 Subject: [PATCH 6/8] Enforce DB limits on region name to 32 chars, or else (not good). Removed a piece of code from Hyperlinker that didn't work anyway. Shortened the hyperlink region name. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 3 +++ .../Services/GridService/HypergridLinker.cs | 25 ++----------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 878b8e8056..baa948e680 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -210,6 +210,9 @@ namespace OpenSim.Data.MySQL if (data.Data.ContainsKey("locY")) data.Data.Remove("locY"); + if (data.RegionName.Length > 32) + data.RegionName = data.RegionName.Substring(0, 32); + string[] fields = new List(data.Data.Keys).ToArray(); using (MySqlCommand cmd = new MySqlCommand()) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b190f9316e..3d722eca96 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -247,21 +247,8 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - Uri uri = null; - try - { - uri = new Uri(externalName); - regInfo.ExternalHostName = uri.Host; - regInfo.HttpPort = (uint)uri.Port; - } - catch - { - m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); - } - string name = regInfo.RegionName; - regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort; - if (name != string.Empty) - regInfo.RegionName += ":" + name; + if (regInfo.RegionName == string.Empty) + regInfo.RegionName = regInfo.ExternalHostName; // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); @@ -384,8 +371,6 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { - //m_HyperlinkRegions[regionInfo.RegionID] = regionInfo; - //m_HyperlinkHandles[regionInfo.RegionID] = regionHandle; RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; @@ -397,12 +382,6 @@ namespace OpenSim.Services.GridService private void RemoveHyperlinkRegion(UUID regionID) { - //// Try the hyperlink collection - //if (m_HyperlinkRegions.ContainsKey(regionID)) - //{ - // m_HyperlinkRegions.Remove(regionID); - // m_HyperlinkHandles.Remove(regionID); - //} m_Database.Delete(regionID); } From a299fa4849e41c04afc363f49fe9ed940451be7c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Aug 2010 11:18:39 -0700 Subject: [PATCH 7/8] This file wants to be committed --- .../Grid/Tests/GridConnectorsTests.cs | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index ebfba2b83a..e54ee02f43 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); - config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); - config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); + config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); + config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); + config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); m_LocalConnector = new LocalGridServicesConnector(config); @@ -128,8 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); - m_LocalConnector.RegisterRegion(UUID.Zero, r2); - m_LocalConnector.RegisterRegion(UUID.Zero, r3); + m_LocalConnector.RegisterRegion(UUID.Zero, r2); + m_LocalConnector.RegisterRegion(UUID.Zero, r3); m_LocalConnector.RegisterRegion(UUID.Zero, r4); result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); @@ -154,38 +154,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); - results = m_LocalConnector.GetDefaultRegions(UUID.Zero); - Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); - Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); + results = m_LocalConnector.GetDefaultRegions(UUID.Zero); + Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); + Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); results = m_LocalConnector.GetHyperlinks(UUID.Zero); Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); From 2a1c11fda9b4ab948b7821ef2423270793a5e577 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 10 Aug 2010 20:15:44 +0100 Subject: [PATCH 8/8] On shift-copy of an object, set up a new physics actor (as appropriate) for every copied prim, not just the root This addresses http://opensimulator.org/mantis/view.php?id=4295 --- .../ClientStack/LindenUDP/LLClientView.cs | 4 ++ .../Framework/Scenes/SceneObjectGroup.cs | 38 +++++++++---------- .../Framework/Scenes/SceneObjectPart.cs | 22 +++++++++-- .../Framework/Scenes/Tests/SceneGraphTests.cs | 7 ++++ 4 files changed, 48 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 87a5832d24..5473d2369e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4599,6 +4599,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", +// data.Name, update.FullID, flags, update.ID); + update.UpdateFlags = (uint)flags; #endregion PrimFlags diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a2c3c074cf..6c1f3c2c8f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1563,23 +1563,6 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) dupe.m_rootPart.TrimPermissions(); - /// may need to create a new Physics actor. - if (dupe.RootPart.PhysActor != null && userExposed) - { - PrimitiveBaseShape pbs = dupe.RootPart.Shape; - - dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( - dupe.RootPart.Name, - pbs, - dupe.RootPart.AbsolutePosition, - dupe.RootPart.Scale, - dupe.RootPart.RotationOffset, - dupe.RootPart.PhysActor.IsPhysical); - - dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; - dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); - } - List partList; lock (m_parts) @@ -1598,11 +1581,28 @@ namespace OpenSim.Region.Framework.Scenes if (part.UUID != m_rootPart.UUID) { SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); - newPart.LinkNum = part.LinkNum; } - } + // Need to duplicate the physics actor as well + if (part.PhysActor != null && userExposed) + { + PrimitiveBaseShape pbs = part.Shape; + + part.PhysActor + = m_scene.PhysicsScene.AddPrimShape( + part.Name, + pbs, + part.AbsolutePosition, + part.Scale, + part.RotationOffset, + part.PhysActor.IsPhysical); + + part.PhysActor.LocalID = part.LocalId; + part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); + } + } + if (userExposed) { dupe.UpdateParentIDs(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0d3f64c39c..cf718cbf88 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -150,8 +150,17 @@ namespace OpenSim.Region.Framework.Scenes // TODO: This needs to be persisted in next XML version update! [XmlIgnore] public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; + [XmlIgnore] - public PhysicsActor PhysActor; + public PhysicsActor PhysActor + { + get { return m_physActor; } + set + { +// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID); + m_physActor = value; + } + } //Xantor 20080528 Sound stuff: // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. @@ -297,6 +306,7 @@ namespace OpenSim.Region.Framework.Scenes /// private byte m_updateFlag; + private PhysicsActor m_physActor; protected Vector3 m_acceleration; protected Vector3 m_angularVelocity; @@ -1006,7 +1016,11 @@ namespace OpenSim.Region.Framework.Scenes public bool CreateSelected { get { return m_createSelected; } - set { m_createSelected = value; } + set + { +// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); + m_createSelected = value; + } } #endregion @@ -1531,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_log.DebugFormat("[SPEW]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); + m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); } } } @@ -1801,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes /// that's not wholesome. Had to make Scene public //PhysActor = null; - if ((ObjectFlags & (uint)PrimFlags.Phantom) == 0) + if ((Flags & PrimFlags.Phantom) == 0) { if (UsePhysics) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index d7da9cb60b..c9662ef9eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -77,6 +77,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags)); Assert.That(dupePart2.Flags, Is.EqualTo(part2.Flags)); + + /* + Assert.That(part1.PhysActor, Is.Not.Null); + Assert.That(part2.PhysActor, Is.Not.Null); + Assert.That(dupePart1.PhysActor, Is.Not.Null); + Assert.That(dupePart2.PhysActor, Is.Not.Null); + */ } } } \ No newline at end of file