diff options
author | Melanie | 2012-02-09 00:19:37 +0000 |
---|---|---|
committer | Melanie | 2012-02-09 00:19:37 +0000 |
commit | 7c888f6af11b5f1d2e41add5ecadae4aa4b2dfa1 (patch) | |
tree | 14c6090f09e2d6bd400fbdaa2fe16299323f63a9 /OpenSim/Region/Framework | |
parent | Push more NPC stuff into threads (diff) | |
parent | minor: put in commented out logging statements for future reuse (diff) | |
download | opensim-SC-7c888f6af11b5f1d2e41add5ecadae4aa4b2dfa1.zip opensim-SC-7c888f6af11b5f1d2e41add5ecadae4aa4b2dfa1.tar.gz opensim-SC-7c888f6af11b5f1d2e41add5ecadae4aa4b2dfa1.tar.bz2 opensim-SC-7c888f6af11b5f1d2e41add5ecadae4aa4b2dfa1.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneGraph.cs
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 54 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 58de44e..01df575 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2310,8 +2310,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2310 | m_sceneGraph.DelinkObjects(parts); | 2310 | m_sceneGraph.DelinkObjects(parts); |
2311 | } | 2311 | } |
2312 | 2312 | ||
2313 | /// <summary> | ||
2314 | /// Link the scene objects containing the indicated parts to a root object. | ||
2315 | /// </summary> | ||
2316 | /// <param name="client"></param> | ||
2317 | /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param> | ||
2318 | /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param> | ||
2313 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | 2319 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) |
2314 | { | 2320 | { |
2321 | LinkObjects(client.AgentId, parentPrimId, childPrimIds); | ||
2322 | } | ||
2323 | |||
2324 | /// <summary> | ||
2325 | /// Link the scene objects containing the indicated parts to a root object. | ||
2326 | /// </summary> | ||
2327 | /// <param name="agentId">The ID of the user linking.</param> | ||
2328 | /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param> | ||
2329 | /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param> | ||
2330 | public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds) | ||
2331 | { | ||
2315 | List<UUID> owners = new List<UUID>(); | 2332 | List<UUID> owners = new List<UUID>(); |
2316 | 2333 | ||
2317 | List<SceneObjectPart> children = new List<SceneObjectPart>(); | 2334 | List<SceneObjectPart> children = new List<SceneObjectPart>(); |
@@ -2323,7 +2340,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2323 | return; | 2340 | return; |
2324 | } | 2341 | } |
2325 | 2342 | ||
2326 | if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) | 2343 | if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID)) |
2327 | { | 2344 | { |
2328 | m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); | 2345 | m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); |
2329 | return; | 2346 | return; |
@@ -2339,7 +2356,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2339 | if (!owners.Contains(part.OwnerID)) | 2356 | if (!owners.Contains(part.OwnerID)) |
2340 | owners.Add(part.OwnerID); | 2357 | owners.Add(part.OwnerID); |
2341 | 2358 | ||
2342 | if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | 2359 | if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID)) |
2343 | children.Add(part); | 2360 | children.Add(part); |
2344 | } | 2361 | } |
2345 | 2362 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 17563bd..6dd42dd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1751,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1751 | { | 1751 | { |
1752 | SceneObjectGroup child = children[i].ParentGroup; | 1752 | SceneObjectGroup child = children[i].ParentGroup; |
1753 | 1753 | ||
1754 | // Don't try and add a group to itself - this will only cause severe problems later on. | ||
1755 | if (child == parentGroup) | ||
1756 | continue; | ||
1757 | |||
1754 | // Make sure no child prim is set for sale | 1758 | // Make sure no child prim is set for sale |
1755 | // So that, on delink, no prims are unwittingly | 1759 | // So that, on delink, no prims are unwittingly |
1756 | // left for sale and sold off | 1760 | // left for sale and sold off |
@@ -1777,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1777 | 1781 | ||
1778 | // We need to explicitly resend the newly link prim's object properties since no other actions | 1782 | // We need to explicitly resend the newly link prim's object properties since no other actions |
1779 | // occur on link to invoke this elsewhere (such as object selection) | 1783 | // occur on link to invoke this elsewhere (such as object selection) |
1780 | parentGroup.RootPart.CreateSelected = true; | 1784 | if (childGroups.Count > 0) |
1781 | parentGroup.TriggerScriptChangedEvent(Changed.LINK); | 1785 | { |
1786 | parentGroup.RootPart.CreateSelected = true; | ||
1787 | parentGroup.TriggerScriptChangedEvent(Changed.LINK); | ||
1788 | parentGroup.HasGroupChanged = true; | ||
1789 | parentGroup.ScheduleGroupForFullUpdate(); | ||
1790 | } | ||
1782 | } | 1791 | } |
1783 | finally | 1792 | finally |
1784 | { | 1793 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 46c4d7b..683aafc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2361,6 +2361,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2361 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", | 2361 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", |
2362 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); | 2362 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); |
2363 | 2363 | ||
2364 | // Linking to ourselves is not a valid operation. | ||
2365 | if (objectGroup == this) | ||
2366 | return; | ||
2367 | |||
2364 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 2368 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
2365 | 2369 | ||
2366 | Vector3 oldGroupPosition = linkPart.GroupPosition; | 2370 | Vector3 oldGroupPosition = linkPart.GroupPosition; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index a2332bb..be5b4a8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -39,14 +39,31 @@ using log4net; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 41 | { |
42 | /// <summary> | ||
43 | /// Linking tests | ||
44 | /// </summary> | ||
45 | [TestFixture] | 42 | [TestFixture] |
46 | public class SceneObjectLinkingTests | 43 | public class SceneObjectLinkingTests |
47 | { | 44 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 46 | ||
47 | /// <summary> | ||
48 | /// Links to self should be ignored. | ||
49 | /// </summary> | ||
50 | [Test] | ||
51 | public void TestLinkToSelf() | ||
52 | { | ||
53 | TestHelpers.InMethod(); | ||
54 | |||
55 | UUID ownerId = TestHelpers.ParseTail(0x1); | ||
56 | int nParts = 3; | ||
57 | |||
58 | TestScene scene = SceneHelpers.SetupScene(); | ||
59 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); | ||
60 | scene.AddSceneObject(sog1); | ||
61 | scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId }); | ||
62 | // sog1.LinkToGroup(sog1); | ||
63 | |||
64 | Assert.That(sog1.Parts.Length, Is.EqualTo(nParts)); | ||
65 | } | ||
66 | |||
50 | [Test] | 67 | [Test] |
51 | public void TestLinkDelink2SceneObjects() | 68 | public void TestLinkDelink2SceneObjects() |
52 | { | 69 | { |