* 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(
// "[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)

View File

@ -504,11 +504,10 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// Constructor. This object is added to the scene later via AttachToScene()
/// </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);
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
/// <summary>
/// Constructor.
/// </summary>
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);
}
/// <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)
{
SceneObjectPart linkPart = GetChildPart(partID);
@ -2006,6 +2011,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_isBackedUp)
m_scene.EventManager.OnBackup -= ProcessBackup;
m_isBackedUp = false;
}

View File

@ -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
/// <param name="regionHandle"></param>
/// <param name="parent"></param>
/// <param name="ownerID"></param>
/// <param name="localID"></param>
/// <param name="shape"></param>
/// <param name="position"></param>
/// <param name="rotationOffset"></param>
/// <param name="offsetPosition"></param>
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
/// <param name="shape"></param>
/// <param name="position"></param>
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;

View File

@ -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.

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);
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);
}

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)
: 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;

View File

@ -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";

View File

@ -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;
}