* minor: remove some pointless assignments in SOG.Copy() that had already been done by MemberwiseClone()

0.6.3-post-fixes
Justin Clarke Casey 2009-02-03 17:50:25 +00:00
parent c80733cc98
commit a9e76ce847
4 changed files with 13 additions and 21 deletions

View File

@ -1496,8 +1496,11 @@ namespace OpenSim.Region.Environment.Scenes
// occur on link to invoke this elsewhere (such as object selection)
parenPrim.RootPart.AddFlag(PrimFlags.CreateSelected);
parenPrim.TriggerScriptChangedEvent(Changed.LINK);
if (client != null)
{
parenPrim.GetProperties(client);
}
else
{
foreach (ScenePresence p in GetScenePresences())
@ -1715,6 +1718,7 @@ namespace OpenSim.Region.Environment.Scenes
// SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero);
DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
}
/// <summary>
/// Duplicate the given object.
/// </summary>
@ -1780,6 +1784,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID);
}
return null;
}

View File

@ -1053,7 +1053,6 @@ namespace OpenSim.Region.Environment.Scenes
{
part.StoreUndoState();
part.OnGrab(offsetPos, remoteClient);
}
public virtual void OnGrabGroup(Vector3 offsetPos, IClientAPI remoteClient)
@ -1232,10 +1231,7 @@ namespace OpenSim.Region.Environment.Scenes
// any exception propogate upwards.
if (IsDeleted || UUID == UUID.Zero)
{
// DetachFromBackup();
return;
}
try
{
@ -1359,18 +1355,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed)
{
SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
dupe.m_isBackedUp = false;
dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
dupe.m_parts.Clear();
//dupe.OwnerID = AgentID;
//dupe.GroupID = GroupID;
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
dupe.m_scene = m_scene;
dupe.m_regionHandle = m_regionHandle;
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
if (userExposed)
@ -1390,7 +1380,6 @@ namespace OpenSim.Region.Environment.Scenes
dupe.RootPart.PhysActor.IsPhysical);
dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
}
@ -1415,8 +1404,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (part.UUID != m_rootPart.UUID)
{
SceneObjectPart newPart =
dupe.CopyPart(part, OwnerID, GroupID, userExposed);
SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart.LinkNum = part.LinkNum;

View File

@ -1380,7 +1380,6 @@ if (m_shape != null) {
if (!userExposed)
dupe.PhysActor = null;
dupe._ownerID = AgentID;
dupe._groupID = GroupID;
dupe.GroupPosition = GroupPosition;
@ -1428,6 +1427,7 @@ if (m_shape != null) {
bool UsePhysics = ((dupe.ObjectFlags & (uint)PrimFlags.Physics) != 0);
dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
}
return dupe;
}

View File

@ -112,7 +112,6 @@ namespace OpenSim.Region.Environment.Scenes.Tests
SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene);
SceneObjectGroup grp2 = part2.ParentGroup;
grp1.AbsolutePosition = new Vector3(10, 10, 10);
grp2.AbsolutePosition = Vector3.Zero;
@ -129,6 +128,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests
// Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated.
grp1.LinkToGroup(grp2);
// FIXME: Can't to these tests yet since group 2 still has the parts attached! We can't yet detach since
// it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed.
//Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link.");
//Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink.");
Assert.That(grp1.Children.Count == 2);
if (debugtest)
@ -170,8 +173,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
if (debugtest)
System.Console.WriteLine("Group2: Prim2: OffsetPosition:{0}, OffsetRotation:{1}", part2.AbsolutePosition, part2.RotationOffset);
Assert.That(part2.AbsolutePosition == Vector3.Zero);
Assert.That(part2.AbsolutePosition == Vector3.Zero);
}
[Test]
@ -189,7 +191,6 @@ namespace OpenSim.Region.Environment.Scenes.Tests
SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene);
SceneObjectGroup grp4 = part4.ParentGroup;
grp1.AbsolutePosition = new Vector3(10, 10, 10);
grp2.AbsolutePosition = Vector3.Zero;
grp3.AbsolutePosition = new Vector3(20, 20, 20);
@ -228,7 +229,6 @@ namespace OpenSim.Region.Environment.Scenes.Tests
Assert.That(grp1.Children.Count == 2);
Assert.That(grp3.Children.Count == 2);
if (debugtest)
{
System.Console.WriteLine("--------After Link-------");
@ -297,7 +297,6 @@ namespace OpenSim.Region.Environment.Scenes.Tests
&& (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003)
&& (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003)
&& (part4.RotationOffset.W - compareQuaternion.W < 0.00003));
}
/// <summary>