From a9e76ce8470062f7e9a1de3a314fd37e675e25a9 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 3 Feb 2009 17:50:25 +0000
Subject: * minor: remove some pointless assignments in SOG.Copy() that had
already been done by MemberwiseClone()
---
OpenSim/Region/Environment/Scenes/SceneGraph.cs | 5 +++++
OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 16 ++--------------
OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 +-
.../Region/Environment/Scenes/Tests/SceneObjectTests.cs | 11 +++++------
4 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index 940aee6..24eaad1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -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);
}
+
///
/// Duplicate the given object.
///
@@ -1780,6 +1784,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID);
}
+
return null;
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 908bb0d..d026180 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -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
///
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();
- 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;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0f36e82..256d6f8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -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;
}
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
index ae879bb..ed2eb79 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
@@ -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));
-
}
///
--
cgit v1.1