aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-21 01:04:08 +0100
committerJustin Clark-Casey (justincc)2010-09-21 01:04:08 +0100
commit51207c24a03b2f5741a886b1d5daaac8d2231c93 (patch)
tree360c993fafd29a32cc132e8c62d390ccdab9e01e /OpenSim/Region/Framework/Scenes
parentImprove the explanative text of migration failures (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-51207c24a03b2f5741a886b1d5daaac8d2231c93.zip
opensim-SC_OLD-51207c24a03b2f5741a886b1d5daaac8d2231c93.tar.gz
opensim-SC_OLD-51207c24a03b2f5741a886b1d5daaac8d2231c93.tar.bz2
opensim-SC_OLD-51207c24a03b2f5741a886b1d5daaac8d2231c93.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs35
2 files changed, 41 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 994b9e3..b655f39 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -330,8 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
330 get { return m_rootPart.UUID; } 330 get { return m_rootPart.UUID; }
331 set 331 set
332 { 332 {
333 m_rootPart.UUID = value; 333 lock (m_parts.SyncRoot)
334 m_parts.AddOrReplace(value, m_rootPart); 334 {
335 m_parts.Remove(m_rootPart.UUID);
336 m_rootPart.UUID = value;
337 m_parts.Add(value, m_rootPart);
338 }
335 } 339 }
336 } 340 }
337 341
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 54b3260..e6ff0c0 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -189,5 +189,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests
189 // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 189 // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
190 // Assert.That(retrievedPart, Is.Null); 190 // Assert.That(retrievedPart, Is.Null);
191 //} 191 //}
192
193 /// <summary>
194 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
195 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
196 /// OpenSim.
197 /// </summary>
198 [Test]
199 public void TestChangeSceneObjectUuid()
200 {
201 string rootPartName = "rootpart";
202 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
203 string childPartName = "childPart";
204 UUID childPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
205
206 SceneObjectPart rootPart
207 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
208 { Name = rootPartName, UUID = rootPartUuid };
209 SceneObjectPart linkPart
210 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
211 { Name = childPartName, UUID = childPartUuid };
212
213 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
214 sog.AddPart(linkPart);
215
216 Assert.That(sog.UUID, Is.EqualTo(rootPartUuid));
217 Assert.That(sog.RootPart.UUID, Is.EqualTo(rootPartUuid));
218 Assert.That(sog.Parts.Length, Is.EqualTo(2));
219
220 UUID newRootPartUuid = new UUID("00000000-0000-0000-0000-000000000002");
221 sog.UUID = newRootPartUuid;
222
223 Assert.That(sog.UUID, Is.EqualTo(newRootPartUuid));
224 Assert.That(sog.RootPart.UUID, Is.EqualTo(newRootPartUuid));
225 Assert.That(sog.Parts.Length, Is.EqualTo(2));
226 }
192 } 227 }
193} 228}