From 54e10e5b61aa543102bcc3a7415877c44aabb5df Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 7 Nov 2008 21:07:14 +0000 Subject: * Stop requiring local ids in the SOG constructors. * These are assigned when the object is attached to the scene --- OpenSim/Region/Environment/Scenes/Scene.cs | 11 ++++++----- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 16 +++++++++++----- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 15 ++++++--------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 3 +-- OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs | 2 +- OpenSim/Region/Examples/SimpleModule/ComplexObject.cs | 18 +++++++++--------- .../Region/Examples/SimpleModule/CpuCounterObject.cs | 4 ++-- .../Region/Examples/SimpleModule/FileSystemObject.cs | 4 ++-- 8 files changed, 38 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 95d9f2a..3931cf0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1735,12 +1735,13 @@ namespace OpenSim.Region.Environment.Scenes //m_log.DebugFormat( // "[SCENE]: Scene.AddNewPrim() called for agent {0} in {1}", ownerID, RegionInfo.RegionName); - SceneObjectGroup sceneOb = new SceneObjectGroup(ownerID, PrimIDAllocate(), pos, rot, shape); + SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); - SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); + SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID); // if grass or tree, make phantom //rootPart.TrimPermissions(); - if ((rootPart.Shape.PCode == (byte)PCode.Grass) || (rootPart.Shape.PCode == (byte)PCode.Tree) || (rootPart.Shape.PCode == (byte)PCode.NewTree)) + if ((rootPart.Shape.PCode == (byte)PCode.Grass) + || (rootPart.Shape.PCode == (byte)PCode.Tree) || (rootPart.Shape.PCode == (byte)PCode.NewTree)) { rootPart.AddFlag(PrimFlags.Phantom); //rootPart.ObjectFlags += (uint)PrimFlags.Phantom; @@ -1748,9 +1749,9 @@ namespace OpenSim.Region.Environment.Scenes AdaptTree(ref shape); } - AddNewSceneObject(sceneOb, true); + AddNewSceneObject(sceneObject, true); - return sceneOb; + return sceneObject; } void AdaptTree(ref PrimitiveBaseShape tree) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index dec8bf4..54ccaad 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -504,11 +504,10 @@ namespace OpenSim.Region.Environment.Scenes /// /// Constructor. This object is added to the scene later via AttachToScene() /// - public SceneObjectGroup(UUID ownerID, uint localID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) + public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { Vector3 rootOffset = new Vector3(0, 0, 0); - SceneObjectPart newPart = - new SceneObjectPart(this, ownerID, localID, shape, pos, rot, rootOffset); + SceneObjectPart newPart = new SceneObjectPart(this, ownerID, shape, pos, rot, rootOffset); newPart.LinkNum = 0; m_parts.Add(newPart.UUID, newPart); SetPartAsRoot(newPart); @@ -517,8 +516,8 @@ namespace OpenSim.Region.Environment.Scenes /// /// Constructor. /// - public SceneObjectGroup(UUID ownerID, uint localID, Vector3 pos, PrimitiveBaseShape shape) - : this(ownerID, localID, pos, Quaternion.Identity, shape) + public SceneObjectGroup(UUID ownerID, Vector3 pos, PrimitiveBaseShape shape) + : this(ownerID, pos, Quaternion.Identity, shape) { } @@ -1927,6 +1926,12 @@ namespace OpenSim.Region.Environment.Scenes DelinkFromGroup(partID, true); } + /// + /// Delink the given prim from this group. The delinked prim is established as + /// an independent SceneObjectGroup. + /// + /// + /// public void DelinkFromGroup(uint partID, bool sendEvents) { SceneObjectPart linkPart = GetChildPart(partID); @@ -2006,6 +2011,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_isBackedUp) m_scene.EventManager.OnBackup -= ProcessBackup; + m_isBackedUp = false; } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index d746ec4..d2c4253 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -216,9 +216,9 @@ namespace OpenSim.Region.Environment.Scenes Rezzed = DateTime.Now; } - public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, uint localID, + public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, Vector3 offsetPosition) - : this(parent, ownerID, localID, shape, groupPosition, Quaternion.Identity, offsetPosition) + : this(parent, ownerID, shape, groupPosition, Quaternion.Identity, offsetPosition) { } @@ -228,14 +228,13 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// /// /// /// /// - public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, uint localID, - PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset, - Vector3 offsetPosition) + public SceneObjectPart( + SceneObjectGroup parent, UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, + Quaternion rotationOffset, Vector3 offsetPosition) { m_name = "Primitive"; m_parentGroup = parent; @@ -246,7 +245,6 @@ namespace OpenSim.Region.Environment.Scenes _creatorID = _ownerID; _lastOwnerID = UUID.Zero; UUID = UUID.Random(); - LocalId = (uint) (localID); Shape = shape; // Todo: Add More Object Parameter from above! _ownershipCost = 0; @@ -286,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// public SceneObjectPart(SceneObjectGroup parent, int creationDate, UUID ownerID, - UUID creatorID, UUID lastOwnerID, uint localID, PrimitiveBaseShape shape, + UUID creatorID, UUID lastOwnerID, PrimitiveBaseShape shape, Vector3 position, Quaternion rotation, uint flags) { m_parentGroup = parent; @@ -296,7 +294,6 @@ namespace OpenSim.Region.Environment.Scenes _creatorID = creatorID; _lastOwnerID = lastOwnerID; UUID = UUID.Random(); - LocalId = (uint) (localID); Shape = shape; _ownershipCost = 0; _objectSaleType = (byte) 0; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index d37006a..beca44c 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1118,9 +1118,8 @@ namespace OpenSim.Region.Environment.Scenes m_sitAtAutoTarget = false; PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; //proxy.PCode = (byte)PCode.ParticleSystem; - uint nextUUID = m_scene.NextLocalId; - proxyObjectGroup = new SceneObjectGroup(UUID, nextUUID, Pos, Rotation, proxy); + proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy); proxyObjectGroup.AttachToScene(m_scene); // Commented out this code since it could never have executed, but might still be informative. diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs index 0b0f606..9d48802 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs @@ -74,7 +74,7 @@ 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, 1, null, Vector3.Zero, Quaternion.Identity, Vector3.Zero); + new SceneObjectPart(sceneObject, UUID.Zero, null, Vector3.Zero, Quaternion.Identity, Vector3.Zero); scene.AddNewSceneObject(sceneObject, false); } diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index 3a0b05d..607a620 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs @@ -51,9 +51,9 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public RotatingWheel(SceneObjectGroup parent, UUID ownerID, uint localID, + public RotatingWheel(SceneObjectGroup parent, UUID ownerID, Vector3 groupPosition, Vector3 offsetPosition, Quaternion rotationDirection) - : base(parent, ownerID, localID, PrimitiveBaseShape.Default, groupPosition, offsetPosition) + : base(parent, ownerID, PrimitiveBaseShape.Default, groupPosition, offsetPosition) { m_rotationDirection = rotationDirection; @@ -78,29 +78,29 @@ namespace OpenSim.Region.Examples.SimpleModule } public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) - : base(ownerID, localID, pos, PrimitiveBaseShape.Default) + : base(ownerID, pos, PrimitiveBaseShape.Default) { m_rotationDirection = new Quaternion(0.05f, 0.1f, 0.15f); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(0, 0, 0.75f), + new RotatingWheel(this, ownerID, pos, new Vector3(0, 0, 0.75f), new Quaternion(0.05f, 0, 0))); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(0, 0, -0.75f), + new RotatingWheel(this, ownerID, pos, new Vector3(0, 0, -0.75f), new Quaternion(-0.05f, 0, 0))); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(0, 0.75f, 0), + new RotatingWheel(this, ownerID, pos, new Vector3(0, 0.75f, 0), new Quaternion(0.5f, 0, 0.05f))); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(0, -0.75f, 0), + new RotatingWheel(this, ownerID, pos, new Vector3(0, -0.75f, 0), new Quaternion(-0.5f, 0, -0.05f))); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(0.75f, 0, 0), + new RotatingWheel(this, ownerID, pos, new Vector3(0.75f, 0, 0), new Quaternion(0, 0.5f, 0.05f))); AddPart( - new RotatingWheel(this, ownerID, scene.PrimIDAllocate(), pos, new Vector3(-0.75f, 0, 0), + new RotatingWheel(this, ownerID, pos, new Vector3(-0.75f, 0, 0), new Quaternion(0, -0.5f, -0.05f))); RootPart.Flags |= PrimFlags.Touch; diff --git a/OpenSim/Region/Examples/SimpleModule/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleModule/CpuCounterObject.cs index 83bced5..4038564 100644 --- a/OpenSim/Region/Examples/SimpleModule/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/CpuCounterObject.cs @@ -45,8 +45,8 @@ namespace OpenSim.Region.Examples.SimpleModule private PerformanceCounter m_counter; - public CpuCounterObject(UUID ownerID, uint localID, Vector3 pos) - : base(ownerID, localID, pos, PrimitiveBaseShape.Default) + public CpuCounterObject(UUID ownerID, Vector3 pos) + : base(ownerID, pos, PrimitiveBaseShape.Default) { String objectName = "Processor"; String counterName = "% Processor Time"; diff --git a/OpenSim/Region/Examples/SimpleModule/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleModule/FileSystemObject.cs index 0903edd..2b84f1d 100644 --- a/OpenSim/Region/Examples/SimpleModule/FileSystemObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/FileSystemObject.cs @@ -34,8 +34,8 @@ namespace OpenSim.Region.Examples.SimpleModule { public class FileSystemObject : SceneObjectGroup { - public FileSystemObject(Scene world, FileInfo fileInfo, Vector3 pos) - : base(UUID.Zero, world.NextLocalId, pos, PrimitiveBaseShape.Default) + public FileSystemObject(FileInfo fileInfo, Vector3 pos) + : base(UUID.Zero, pos, PrimitiveBaseShape.Default) { Text = fileInfo.Name; } -- cgit v1.1