refactor common sop setup parts into a single method

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-23 22:40:23 +00:00
parent de88227bc4
commit d5c7ae5c6b
1 changed files with 23 additions and 17 deletions

View File

@ -454,9 +454,7 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
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;
@ -466,6 +464,20 @@ namespace OpenSim.Tests.Common.Setup
return part;
}
/// <summary>
/// Create a scene object part.
/// </summary>
/// <param name="name"></param>
/// <param name="id"></param>
/// <param name="ownerId"></param>
/// <returns></returns>
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 };
}
/// <summary>
/// Create a scene object but do not add it to the scene.
/// </summary>
@ -477,25 +489,19 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
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;
}
}
}
}