mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneGraph.cs
This commit is contained in:
@@ -2310,7 +2310,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneGraph.DelinkObjects(parts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the scene objects containing the indicated parts to a root object.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
|
||||
/// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
|
||||
public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
|
||||
{
|
||||
LinkObjects(client.AgentId, parentPrimId, childPrimIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the scene objects containing the indicated parts to a root object.
|
||||
/// </summary>
|
||||
/// <param name="agentId">The ID of the user linking.</param>
|
||||
/// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
|
||||
/// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
|
||||
public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
|
||||
{
|
||||
List<UUID> owners = new List<UUID>();
|
||||
|
||||
@@ -2323,7 +2340,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
|
||||
if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
|
||||
{
|
||||
m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
|
||||
return;
|
||||
@@ -2339,7 +2356,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!owners.Contains(part.OwnerID))
|
||||
owners.Add(part.OwnerID);
|
||||
|
||||
if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
|
||||
if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
|
||||
children.Add(part);
|
||||
}
|
||||
|
||||
|
||||
@@ -1751,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
SceneObjectGroup child = children[i].ParentGroup;
|
||||
|
||||
// Don't try and add a group to itself - this will only cause severe problems later on.
|
||||
if (child == parentGroup)
|
||||
continue;
|
||||
|
||||
// Make sure no child prim is set for sale
|
||||
// So that, on delink, no prims are unwittingly
|
||||
// left for sale and sold off
|
||||
@@ -1777,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// We need to explicitly resend the newly link prim's object properties since no other actions
|
||||
// occur on link to invoke this elsewhere (such as object selection)
|
||||
parentGroup.RootPart.CreateSelected = true;
|
||||
parentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||
if (childGroups.Count > 0)
|
||||
{
|
||||
parentGroup.RootPart.CreateSelected = true;
|
||||
parentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||
parentGroup.HasGroupChanged = true;
|
||||
parentGroup.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -2361,6 +2361,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
|
||||
// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
|
||||
|
||||
// Linking to ourselves is not a valid operation.
|
||||
if (objectGroup == this)
|
||||
return;
|
||||
|
||||
SceneObjectPart linkPart = objectGroup.m_rootPart;
|
||||
|
||||
Vector3 oldGroupPosition = linkPart.GroupPosition;
|
||||
|
||||
@@ -39,14 +39,31 @@ using log4net;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Linking tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class SceneObjectLinkingTests
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Links to self should be ignored.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLinkToSelf()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID ownerId = TestHelpers.ParseTail(0x1);
|
||||
int nParts = 3;
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
|
||||
scene.AddSceneObject(sog1);
|
||||
scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
|
||||
// sog1.LinkToGroup(sog1);
|
||||
|
||||
Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLinkDelink2SceneObjects()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user