* Extend basic scene test to retrieve the object from the scene and match uuids

* Decouple sog and sop by removing the need to pass the sog to the sop when it is created - most of the code was doing this operation (and hence duplicating it) anyway
* Remove unused constructors
0.6.1-post-fixes
Justin Clarke Casey 2008-11-10 18:10:00 +00:00
parent 6df113845e
commit 5d1d5a22a9
6 changed files with 37 additions and 72 deletions

View File

@ -784,10 +784,11 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns>null if no scene object group containing that prim is found</returns>
private SceneObjectGroup GetGroupByPrim(uint localID)
{
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{
//m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(localID))
@ -891,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes
protected internal SceneObjectPart GetSceneObjectPart(UUID fullID)
{
SceneObjectGroup group = GetGroupByPrim(fullID);
if (group != null)
return group.GetChildPart(fullID);
else

View File

@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes
private Thread HeartbeatThread;
private volatile bool shuttingdown = false;
private object m_deleting_scene_object = new object();
private object m_deleting_scene_object = new object();
#endregion
@ -4009,7 +4009,7 @@ namespace OpenSim.Region.Environment.Scenes
}
/// <summary>
///
/// Get a prim via its local id
/// </summary>
/// <param name="localID"></param>
/// <returns></returns>
@ -4019,7 +4019,7 @@ namespace OpenSim.Region.Environment.Scenes
}
/// <summary>
///
/// Get a prim via its UUID
/// </summary>
/// <param name="fullID"></param>
/// <returns></returns>

View File

@ -507,9 +507,9 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
Vector3 rootOffset = new Vector3(0, 0, 0);
SceneObjectPart newPart = new SceneObjectPart(this, ownerID, shape, pos, rot, rootOffset);
SceneObjectPart newPart = new SceneObjectPart(ownerID, shape, pos, rot, rootOffset);
newPart.LinkNum = 0;
m_parts.Add(newPart.UUID, newPart);
AddPart(newPart);
SetPartAsRoot(newPart);
}
@ -904,7 +904,6 @@ namespace OpenSim.Region.Environment.Scenes
try
{
m_parts.Add(part.UUID, part);
}
catch (Exception e)
{
@ -1757,10 +1756,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns>null if a child part with the local ID was not found</returns>
public SceneObjectPart GetChildPart(uint localID)
{
//m_log.DebugFormat("Entered looking for {0}", localID);
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
//m_log.DebugFormat("Found {0}", part.LocalId);
if (part.LocalId == localID)
{
return part;
@ -1795,10 +1796,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public bool HasChildPrim(uint localID)
{
//m_log.DebugFormat("Entered HasChildPrim looking for {0}", localID);
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
//m_log.DebugFormat("Found {0}", part.LocalId);
if (part.LocalId == localID)
{
return true;

View File

@ -216,28 +216,19 @@ namespace OpenSim.Region.Environment.Scenes
Rezzed = DateTime.Now;
}
public SceneObjectPart(SceneObjectGroup parent, UUID ownerID,
PrimitiveBaseShape shape, Vector3 groupPosition, Vector3 offsetPosition)
: this(parent, ownerID, shape, groupPosition, Quaternion.Identity, offsetPosition)
{
}
/// <summary>
/// Create a completely new SceneObjectPart (prim)
/// Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjectGroup
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="parent"></param>
/// <param name="ownerID"></param>
/// <param name="shape"></param>
/// <param name="position"></param>
/// <param name="rotationOffset"></param>
/// <param name="offsetPosition"></param>
public SceneObjectPart(
SceneObjectGroup parent, UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Quaternion rotationOffset, Vector3 offsetPosition)
{
m_name = "Primitive";
m_parentGroup = parent;
Rezzed = DateTime.Now;
_creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
@ -273,49 +264,6 @@ namespace OpenSim.Region.Environment.Scenes
//m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
}
/// <summary>
/// Re/create a SceneObjectPart (prim)
/// currently not used, and maybe won't be
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="parent"></param>
/// <param name="ownerID"></param>
/// <param name="localID"></param>
/// <param name="shape"></param>
/// <param name="position"></param>
public SceneObjectPart(SceneObjectGroup parent, int creationDate, UUID ownerID,
UUID creatorID, UUID lastOwnerID, PrimitiveBaseShape shape,
Vector3 position, Quaternion rotation, uint flags)
{
m_parentGroup = parent;
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
_creationDate = creationDate;
_ownerID = ownerID;
_creatorID = creatorID;
_lastOwnerID = lastOwnerID;
UUID = UUID.Random();
Shape = shape;
_ownershipCost = 0;
_objectSaleType = (byte) 0;
_salePrice = 0;
_category = (uint) 0;
_lastOwnerID = _creatorID;
OffsetPosition = position;
RotationOffset = rotation;
ObjectFlags = flags;
Rezzed = DateTime.Now;
m_TextureAnimation = new byte[0];
m_particleSystem = new byte[0];
// Since we don't store script state, this is only a 'temporary' objectflag now
// If the object is scripted, the script will get loaded and this will be set again
ObjectFlags &= ~(uint)(PrimFlags.Scripted | PrimFlags.Touch);
TrimPermissions();
// ApplyPhysics();
}
protected SceneObjectPart(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("SceneObjectPart Deserialize BGN");
@ -3056,7 +3004,6 @@ if (m_shape != null) {
public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom)
{
bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0);
bool wasTemporary = ((ObjectFlags & (uint)PrimFlags.TemporaryOnRez) != 0);
bool wasPhantom = ((ObjectFlags & (uint)PrimFlags.Phantom) != 0);

View File

@ -28,6 +28,7 @@
using System;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
@ -74,9 +75,21 @@ namespace OpenSim.Region.Environment.Scenes.Tests
= new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null);
SceneObjectGroup sceneObject = new SceneObjectGroup();
new SceneObjectPart(sceneObject, UUID.Zero, null, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
SceneObjectPart part
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
//part.UpdatePrimFlags(false, false, true);
part.ObjectFlags |= (uint)PrimFlags.Phantom;
sceneObject.RootPart = part;
sceneObject.AddPart(part);
scene.AddNewSceneObject(sceneObject, false);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
//System.Console.WriteLine("retrievedPart : {0}", retrievedPart);
// If the parts have the same UUID then we will consider them as one and the same
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
}
}
}

View File

@ -51,9 +51,9 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public RotatingWheel(SceneObjectGroup parent, UUID ownerID,
Vector3 groupPosition, Vector3 offsetPosition, Quaternion rotationDirection)
: base(parent, ownerID, PrimitiveBaseShape.Default, groupPosition, offsetPosition)
public RotatingWheel(
UUID ownerID, Vector3 groupPosition, Vector3 offsetPosition, Quaternion rotationDirection)
: base(ownerID, PrimitiveBaseShape.Default, groupPosition, Quaternion.Identity, offsetPosition)
{
m_rotationDirection = rotationDirection;
@ -83,24 +83,24 @@ namespace OpenSim.Region.Examples.SimpleModule
m_rotationDirection = new Quaternion(0.05f, 0.1f, 0.15f);
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(0, 0, 0.75f),
new RotatingWheel(ownerID, pos, new Vector3(0, 0, 0.75f),
new Quaternion(0.05f, 0, 0)));
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(0, 0, -0.75f),
new RotatingWheel(ownerID, pos, new Vector3(0, 0, -0.75f),
new Quaternion(-0.05f, 0, 0)));
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(0, 0.75f, 0),
new RotatingWheel(ownerID, pos, new Vector3(0, 0.75f, 0),
new Quaternion(0.5f, 0, 0.05f)));
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(0, -0.75f, 0),
new RotatingWheel(ownerID, pos, new Vector3(0, -0.75f, 0),
new Quaternion(-0.5f, 0, -0.05f)));
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(0.75f, 0, 0),
new RotatingWheel(ownerID, pos, new Vector3(0.75f, 0, 0),
new Quaternion(0, 0.5f, 0.05f)));
AddPart(
new RotatingWheel(this, ownerID, pos, new Vector3(-0.75f, 0, 0),
new RotatingWheel(ownerID, pos, new Vector3(-0.75f, 0, 0),
new Quaternion(0, -0.5f, -0.05f)));
RootPart.Flags |= PrimFlags.Touch;