* refactor: Expose SOG.SetRootPart for outsiders to use rather than setting RootPart and adding the part separately

* Make RootPart read only
0.6.1-post-fixes
Justin Clarke Casey 2008-11-10 20:04:55 +00:00
parent 014eb26426
commit 0e180b0ad3
9 changed files with 19 additions and 29 deletions

View File

@ -210,8 +210,8 @@ namespace OpenSim.Data.MSSQL
"No shape found for prim in storage, so setting default box shape"); "No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
group.AddPart(prim);
group.RootPart = prim; group.SetRootPart(prim);
createdObjects.Add(group.UUID, group); createdObjects.Add(group.UUID, group);
retvals.Add(group); retvals.Add(group);

View File

@ -421,8 +421,8 @@ namespace OpenSim.Data.MySQL
"No shape found for prim in storage, so setting default box shape"); "No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
group.AddPart(prim);
group.RootPart = prim; group.SetRootPart(prim);
createdObjects.Add(group.UUID, group); createdObjects.Add(group.UUID, group);
retvals.Add(group); retvals.Add(group);
LoadItems(prim); LoadItems(prim);

View File

@ -195,8 +195,7 @@ namespace OpenSim.Data.NHibernate
// root part // root part
if (p.UUID == uuid) if (p.UUID == uuid)
{ {
group.AddPart(p); group.SetRootPart(p);
group.RootPart = p;
} }
else else
{ {
@ -244,8 +243,7 @@ namespace OpenSim.Data.NHibernate
if (p.UUID == p.ParentUUID) if (p.UUID == p.ParentUUID)
{ {
SceneObjectGroup group = new SceneObjectGroup(); SceneObjectGroup group = new SceneObjectGroup();
group.AddPart(p); group.SetRootPart(p);
group.RootPart = p;
SOG.Add(p.ParentUUID, group); SOG.Add(p.ParentUUID, group);
} }
else else

View File

@ -436,8 +436,8 @@ namespace OpenSim.Data.SQLite
"[REGION DB]: No shape found for prim in storage, so setting default box shape"); "[REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
group.AddPart(prim);
group.RootPart = prim; group.SetRootPart(prim);
createdObjects.Add(group.UUID, group); createdObjects.Add(group.UUID, group);
retvals.Add(group); retvals.Add(group);
LoadItems(prim); LoadItems(prim);
@ -1102,8 +1102,7 @@ namespace OpenSim.Data.SQLite
// sop.TouchName = ""; // sop.TouchName = "";
// sop.UUID = UUID.Random(); // sop.UUID = UUID.Random();
// sop.Shape = PrimitiveBaseShape.Default; // sop.Shape = PrimitiveBaseShape.Default;
// sog.AddPart(sop); // sog.SetRootPart(sop);
// sog.RootPart = sop;
// Add breakpoint in above line. Check sop fields. // Add breakpoint in above line. Check sop fields.
// TODO: this doesn't work yet because something more // TODO: this doesn't work yet because something more

View File

@ -315,8 +315,7 @@ namespace OpenSim.Data.Tests
sop.ObjectFlags = 0; sop.ObjectFlags = 0;
SceneObjectGroup sog = new SceneObjectGroup(); SceneObjectGroup sog = new SceneObjectGroup();
sog.AddPart(sop); sog.SetRootPart(sop);
sog.RootPart = sop;
// Inserts group in DB // Inserts group in DB
db.StoreObject(sog,region3); db.StoreObject(sog,region3);
@ -795,8 +794,7 @@ namespace OpenSim.Data.Tests
sop.Shape = PrimitiveBaseShape.Default; sop.Shape = PrimitiveBaseShape.Default;
SceneObjectGroup sog = new SceneObjectGroup(); SceneObjectGroup sog = new SceneObjectGroup();
sog.AddPart(sop); sog.SetRootPart(sop);
sog.RootPart = sop;
return sog; return sog;
} }

View File

@ -132,7 +132,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
public SceneObjectPart RootPart public SceneObjectPart RootPart
{ {
get { return m_Entity.RootPart; } get { return m_Entity.RootPart; }
set { m_Entity.RootPart = value; }
} }
public Scene Scene public Scene Scene

View File

@ -104,11 +104,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
//Initialize group and add part as root part //Initialize group and add part as root part
x.SetScene(scene); x.SetScene(scene);
y.SetParent(x); x.SetRootPart(y);
y.ParentID = 0;
y.LinkNum = 0;
x.Children.Add(y.UUID, y);
x.RootPart = y;
x.RegionHandle = scene.RegionInfo.RegionHandle; x.RegionHandle = scene.RegionInfo.RegionHandle;
x.SetScene(scene); x.SetScene(scene);

View File

@ -184,10 +184,12 @@ namespace OpenSim.Region.Environment.Scenes
set { m_parts = value; } set { m_parts = value; }
} }
/// <value>
/// The root part of this scene object
/// </value>
public SceneObjectPart RootPart public SceneObjectPart RootPart
{ {
get { return m_rootPart; } get { return m_rootPart; }
set { m_rootPart = value; }
} }
public ulong RegionHandle public ulong RegionHandle
@ -877,7 +879,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Set a part to act as the root part for this scene object /// Set a part to act as the root part for this scene object
/// </summary> /// </summary>
/// <param name="part"></param> /// <param name="part"></param>
private void SetRootPart(SceneObjectPart part) public void SetRootPart(SceneObjectPart part)
{ {
part.SetParent(this); part.SetParent(this);
part.ParentID = 0; part.ParentID = 0;
@ -1886,7 +1888,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.UnlinkSceneObject(objectGroup.UUID, true); m_scene.UnlinkSceneObject(objectGroup.UUID, true);
objectGroup.Children.Clear(); objectGroup.Children.Clear();
objectGroup.RootPart = null; objectGroup.m_rootPart = null;
// TODO Deleting the original group object may cause problems later on if they have already // TODO Deleting the original group object may cause problems later on if they have already
// made it into the update queue. However, sending out updates for those parts is now // made it into the update queue. However, sending out updates for those parts is now

View File

@ -79,9 +79,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
//part.UpdatePrimFlags(false, false, true); //part.UpdatePrimFlags(false, false, true);
part.ObjectFlags |= (uint)PrimFlags.Phantom; part.ObjectFlags |= (uint)PrimFlags.Phantom;
sceneObject.SetRootPart(part);
sceneObject.RootPart = part;
sceneObject.AddPart(part);
scene.AddNewSceneObject(sceneObject, false); scene.AddNewSceneObject(sceneObject, false);