* Stop requiring local ids in the SOG constructors.

* These are assigned when the object is attached to the scene
0.6.0-stable
Justin Clarke Casey 2008-11-07 21:07:14 +00:00
parent af35f4cb4a
commit 54e10e5b61
8 changed files with 38 additions and 35 deletions

View File

@ -1735,12 +1735,13 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.DebugFormat( //m_log.DebugFormat(
// "[SCENE]: Scene.AddNewPrim() called for agent {0} in {1}", ownerID, RegionInfo.RegionName); // "[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 // if grass or tree, make phantom
//rootPart.TrimPermissions(); //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.AddFlag(PrimFlags.Phantom);
//rootPart.ObjectFlags += (uint)PrimFlags.Phantom; //rootPart.ObjectFlags += (uint)PrimFlags.Phantom;
@ -1748,9 +1749,9 @@ namespace OpenSim.Region.Environment.Scenes
AdaptTree(ref shape); AdaptTree(ref shape);
} }
AddNewSceneObject(sceneOb, true); AddNewSceneObject(sceneObject, true);
return sceneOb; return sceneObject;
} }
void AdaptTree(ref PrimitiveBaseShape tree) void AdaptTree(ref PrimitiveBaseShape tree)

View File

@ -504,11 +504,10 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// Constructor. This object is added to the scene later via AttachToScene() /// Constructor. This object is added to the scene later via AttachToScene()
/// </summary> /// </summary>
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); Vector3 rootOffset = new Vector3(0, 0, 0);
SceneObjectPart newPart = SceneObjectPart newPart = new SceneObjectPart(this, ownerID, shape, pos, rot, rootOffset);
new SceneObjectPart(this, ownerID, localID, shape, pos, rot, rootOffset);
newPart.LinkNum = 0; newPart.LinkNum = 0;
m_parts.Add(newPart.UUID, newPart); m_parts.Add(newPart.UUID, newPart);
SetPartAsRoot(newPart); SetPartAsRoot(newPart);
@ -517,8 +516,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// Constructor. /// Constructor.
/// </summary> /// </summary>
public SceneObjectGroup(UUID ownerID, uint localID, Vector3 pos, PrimitiveBaseShape shape) public SceneObjectGroup(UUID ownerID, Vector3 pos, PrimitiveBaseShape shape)
: this(ownerID, localID, pos, Quaternion.Identity, shape) : this(ownerID, pos, Quaternion.Identity, shape)
{ {
} }
@ -1927,6 +1926,12 @@ namespace OpenSim.Region.Environment.Scenes
DelinkFromGroup(partID, true); DelinkFromGroup(partID, true);
} }
/// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
public void DelinkFromGroup(uint partID, bool sendEvents) public void DelinkFromGroup(uint partID, bool sendEvents)
{ {
SceneObjectPart linkPart = GetChildPart(partID); SceneObjectPart linkPart = GetChildPart(partID);
@ -2006,6 +2011,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_isBackedUp) if (m_isBackedUp)
m_scene.EventManager.OnBackup -= ProcessBackup; m_scene.EventManager.OnBackup -= ProcessBackup;
m_isBackedUp = false; m_isBackedUp = false;
} }

View File

@ -216,9 +216,9 @@ namespace OpenSim.Region.Environment.Scenes
Rezzed = DateTime.Now; Rezzed = DateTime.Now;
} }
public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, uint localID, public SceneObjectPart(SceneObjectGroup parent, UUID ownerID,
PrimitiveBaseShape shape, Vector3 groupPosition, Vector3 offsetPosition) 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
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="parent"></param> /// <param name="parent"></param>
/// <param name="ownerID"></param> /// <param name="ownerID"></param>
/// <param name="localID"></param>
/// <param name="shape"></param> /// <param name="shape"></param>
/// <param name="position"></param> /// <param name="position"></param>
/// <param name="rotationOffset"></param> /// <param name="rotationOffset"></param>
/// <param name="offsetPosition"></param> /// <param name="offsetPosition"></param>
public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, uint localID, public SceneObjectPart(
PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset, SceneObjectGroup parent, UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Vector3 offsetPosition) Quaternion rotationOffset, Vector3 offsetPosition)
{ {
m_name = "Primitive"; m_name = "Primitive";
m_parentGroup = parent; m_parentGroup = parent;
@ -246,7 +245,6 @@ namespace OpenSim.Region.Environment.Scenes
_creatorID = _ownerID; _creatorID = _ownerID;
_lastOwnerID = UUID.Zero; _lastOwnerID = UUID.Zero;
UUID = UUID.Random(); UUID = UUID.Random();
LocalId = (uint) (localID);
Shape = shape; Shape = shape;
// Todo: Add More Object Parameter from above! // Todo: Add More Object Parameter from above!
_ownershipCost = 0; _ownershipCost = 0;
@ -286,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="shape"></param> /// <param name="shape"></param>
/// <param name="position"></param> /// <param name="position"></param>
public SceneObjectPart(SceneObjectGroup parent, int creationDate, UUID ownerID, 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) Vector3 position, Quaternion rotation, uint flags)
{ {
m_parentGroup = parent; m_parentGroup = parent;
@ -296,7 +294,6 @@ namespace OpenSim.Region.Environment.Scenes
_creatorID = creatorID; _creatorID = creatorID;
_lastOwnerID = lastOwnerID; _lastOwnerID = lastOwnerID;
UUID = UUID.Random(); UUID = UUID.Random();
LocalId = (uint) (localID);
Shape = shape; Shape = shape;
_ownershipCost = 0; _ownershipCost = 0;
_objectSaleType = (byte) 0; _objectSaleType = (byte) 0;

View File

@ -1118,9 +1118,8 @@ namespace OpenSim.Region.Environment.Scenes
m_sitAtAutoTarget = false; m_sitAtAutoTarget = false;
PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
//proxy.PCode = (byte)PCode.ParticleSystem; //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); proxyObjectGroup.AttachToScene(m_scene);
// Commented out this code since it could never have executed, but might still be informative. // Commented out this code since it could never have executed, but might still be informative.

View File

@ -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); = new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null);
SceneObjectGroup sceneObject = new SceneObjectGroup(); 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); scene.AddNewSceneObject(sceneObject, false);
} }

View File

@ -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) Vector3 groupPosition, Vector3 offsetPosition, Quaternion rotationDirection)
: base(parent, ownerID, localID, PrimitiveBaseShape.Default, groupPosition, offsetPosition) : base(parent, ownerID, PrimitiveBaseShape.Default, groupPosition, offsetPosition)
{ {
m_rotationDirection = rotationDirection; m_rotationDirection = rotationDirection;
@ -78,29 +78,29 @@ namespace OpenSim.Region.Examples.SimpleModule
} }
public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) 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); m_rotationDirection = new Quaternion(0.05f, 0.1f, 0.15f);
AddPart( 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))); new Quaternion(0.05f, 0, 0)));
AddPart( 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))); new Quaternion(-0.05f, 0, 0)));
AddPart( 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))); new Quaternion(0.5f, 0, 0.05f)));
AddPart( 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))); new Quaternion(-0.5f, 0, -0.05f)));
AddPart( 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))); new Quaternion(0, 0.5f, 0.05f)));
AddPart( 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))); new Quaternion(0, -0.5f, -0.05f)));
RootPart.Flags |= PrimFlags.Touch; RootPart.Flags |= PrimFlags.Touch;

View File

@ -45,8 +45,8 @@ namespace OpenSim.Region.Examples.SimpleModule
private PerformanceCounter m_counter; private PerformanceCounter m_counter;
public CpuCounterObject(UUID ownerID, uint localID, Vector3 pos) public CpuCounterObject(UUID ownerID, Vector3 pos)
: base(ownerID, localID, pos, PrimitiveBaseShape.Default) : base(ownerID, pos, PrimitiveBaseShape.Default)
{ {
String objectName = "Processor"; String objectName = "Processor";
String counterName = "% Processor Time"; String counterName = "% Processor Time";

View File

@ -34,8 +34,8 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
public class FileSystemObject : SceneObjectGroup public class FileSystemObject : SceneObjectGroup
{ {
public FileSystemObject(Scene world, FileInfo fileInfo, Vector3 pos) public FileSystemObject(FileInfo fileInfo, Vector3 pos)
: base(UUID.Zero, world.NextLocalId, pos, PrimitiveBaseShape.Default) : base(UUID.Zero, pos, PrimitiveBaseShape.Default)
{ {
Text = fileInfo.Name; Text = fileInfo.Name;
} }