From d5c7ae5c6b55ae794f630ae55a100b19eef2362c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:40:23 +0000 Subject: refactor common sop setup parts into a single method --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 40 ++++++++++++++----------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index b7b7383..87b6389 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -454,9 +454,7 @@ namespace OpenSim.Tests.Common.Setup /// public static SceneObjectPart AddSceneObject(Scene scene, string name) { - SceneObjectPart part - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); - part.Name = name; + SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); //part.UpdatePrimFlags(false, false, true); //part.ObjectFlags |= (uint)PrimFlags.Phantom; @@ -467,6 +465,20 @@ namespace OpenSim.Tests.Common.Setup } /// + /// Create a scene object part. + /// + /// + /// + /// + /// + public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) + { + return new SceneObjectPart( + ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = name, UUID = id }; + } + + /// /// Create a scene object but do not add it to the scene. /// /// @@ -477,25 +489,19 @@ namespace OpenSim.Tests.Common.Setup /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) { - SceneObjectPart rootPart - = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "part1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; - SceneObjectGroup sog = new SceneObjectGroup(rootPart); + SceneObjectGroup sog + = new SceneObjectGroup( + CreateSceneObjectPart("part1", new UUID("00000000-0000-0000-0000-000000000001"), ownerId)); if (parts > 1) - { for (int i = 2; i <= parts; i++) - { sog.AddPart( - new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { - Name = string.Format("obj{0}", i), - UUID = new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)) - }); - } - } + CreateSceneObjectPart( + string.Format("obj{0}", i), + new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)), + ownerId)); return sog; } } -} +} \ No newline at end of file -- cgit v1.1