* refactor: cleanup AllocateLocalPrimId() a bit more

0.6.0-stable
Justin Clarke Casey 2008-11-07 22:08:58 +00:00
parent fb694fb177
commit ba1d9ca26b
9 changed files with 19 additions and 31 deletions

View File

@ -57,14 +57,14 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
#region Constructors #region Constructors
//transparency of root part, NOT particle system. Should probably add support for changing particle system transparency. //transparency of root part, NOT particle system. Should probably add support for changing particle system transparency.
public AuraMetaEntity(Scene scene, uint LocalId, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) public AuraMetaEntity(Scene scene, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale)
: base(scene, LocalId, groupPos, transparency) : base(scene, groupPos, transparency)
{ {
SetAura(color, scale); SetAura(color, scale);
} }
public AuraMetaEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) public AuraMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale)
: base(scene, uuid, LocalId, groupPos, transparency) : base(scene, uuid, groupPos, transparency)
{ {
SetAura(color, scale); SetAura(color, scale);
} }

View File

@ -56,14 +56,14 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
{ {
#region Constructors #region Constructors
public BeamMetaEntity(Scene scene, uint LocalId, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) public BeamMetaEntity(Scene scene, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color)
: base(scene, LocalId, groupPos, transparency) : base(scene, groupPos, transparency)
{ {
SetBeamToUUID(To, color); SetBeamToUUID(To, color);
} }
public BeamMetaEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) public BeamMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color)
: base(scene, uuid, LocalId, groupPos, transparency) : base(scene, uuid, groupPos, transparency)
{ {
SetBeamToUUID(To, color); SetBeamToUUID(To, color);
} }

View File

@ -146,7 +146,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part) public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part)
{ {
AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene, AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene,
part.ParentGroup.Scene.AllocateLocalPrimId(),
part.GetWorldPosition(), part.GetWorldPosition(),
MetaEntity.TRANSLUCENT, MetaEntity.TRANSLUCENT,
new Vector3(0,254,0), new Vector3(0,254,0),

View File

@ -153,7 +153,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
else else
{ {
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
m_Entity.Scene.AllocateLocalPrimId(),
part.GetWorldPosition(), part.GetWorldPosition(),
MetaEntity.TRANSLUCENT, MetaEntity.TRANSLUCENT,
new Vector3(254,0,0), new Vector3(254,0,0),
@ -260,7 +259,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
} }
BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene, BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
m_Entity.Scene.AllocateLocalPrimId(),
m_UnchangedEntity.RootPart.GetWorldPosition(), m_UnchangedEntity.RootPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT, MetaEntity.TRANSLUCENT,
sceneEntityPart, sceneEntityPart,
@ -275,7 +273,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
m_AuraEntities.Remove(UnchangedPart.UUID); m_AuraEntities.Remove(UnchangedPart.UUID);
} }
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
m_Entity.Scene.AllocateLocalPrimId(),
UnchangedPart.GetWorldPosition(), UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT, MetaEntity.TRANSLUCENT,
new Vector3(0,0,254), new Vector3(0,0,254),
@ -309,7 +306,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
m_AuraEntities.Remove(UnchangedPart.UUID); m_AuraEntities.Remove(UnchangedPart.UUID);
} }
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
m_Entity.Scene.AllocateLocalPrimId(),
UnchangedPart.GetWorldPosition(), UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT, MetaEntity.TRANSLUCENT,
new Vector3(254,0,0), new Vector3(254,0,0),

View File

@ -166,10 +166,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
parts.Add(part.UUID, part); parts.Add(part.UUID, part);
} }
// make new localids
foreach (SceneObjectPart part in m_Entity.Children.Values)
part.LocalId = m_Entity.Scene.AllocateLocalPrimId();
//finalize //finalize
m_Entity.RootPart.PhysActor = null; m_Entity.RootPart.PhysActor = null;
m_Entity.Children = parts; m_Entity.Children = parts;

View File

@ -56,17 +56,17 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
{ {
#region Constructors #region Constructors
public PointMetaEntity(Scene scene, uint LocalId, Vector3 groupPos, float transparency) public PointMetaEntity(Scene scene, Vector3 groupPos, float transparency)
: base() : base()
{ {
CreatePointEntity(scene, UUID.Random(), LocalId, groupPos); CreatePointEntity(scene, UUID.Random(), groupPos);
SetPartTransparency(m_Entity.RootPart, transparency); SetPartTransparency(m_Entity.RootPart, transparency);
} }
public PointMetaEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos, float transparency) public PointMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency)
: base() : base()
{ {
CreatePointEntity(scene, uuid, LocalId, groupPos); CreatePointEntity(scene, uuid, groupPos);
SetPartTransparency(m_Entity.RootPart, transparency); SetPartTransparency(m_Entity.RootPart, transparency);
} }
@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
#region Private Methods #region Private Methods
private void CreatePointEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos) private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos)
{ {
SceneObjectGroup x = new SceneObjectGroup(); SceneObjectGroup x = new SceneObjectGroup();
SceneObjectPart y = new SceneObjectPart(); SceneObjectPart y = new SceneObjectPart();
@ -88,8 +88,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
y.LastOwnerID = UUID.Zero; y.LastOwnerID = UUID.Zero;
y.UUID = uuid; y.UUID = uuid;
y.LocalId = LocalId;
y.Shape = PrimitiveBaseShape.CreateBox(); y.Shape = PrimitiveBaseShape.CreateBox();
y.Scale = new Vector3(0.01f,0.01f,0.01f); y.Scale = new Vector3(0.01f,0.01f,0.01f);
y.LastOwnerID = UUID.Zero; y.LastOwnerID = UUID.Zero;

View File

@ -1606,6 +1606,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children",
group.Children == null ? 0 : group.Children.Count); group.Children == null ? 0 : group.Children.Count);
} }
AddRestoredSceneObject(group, true, true); AddRestoredSceneObject(group, true, true);
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted;
@ -1621,7 +1622,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Returns a new unallocated local primitive ID /// Returns a new unallocated local primitive ID
/// </summary> /// </summary>
/// <returns>A brand new local primitive ID</returns> /// <returns>A brand new local primitive ID</returns>
public uint AllocateLocalPrimId() protected internal uint AllocateLocalPrimId()
{ {
uint myID; uint myID;

View File

@ -104,8 +104,7 @@ namespace OpenSim.Region.Examples.SimpleModule
// { // {
// Vector3 posOffset = new Vector3((i % objs) * 4, ((i % (objs*objs)) / (objs)) * 4, (i / (objs*objs)) * 4); // Vector3 posOffset = new Vector3((i % objs) * 4, ((i % (objs*objs)) / (objs)) * 4, (i / (objs*objs)) * 4);
// ComplexObject complexObject = // ComplexObject complexObject =
// new ComplexObject(m_scene, regionInfo.RegionHandle, UUID.Zero, m_scene.AllocateLocalPrimId(), // new ComplexObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + posOffset);
// pos + posOffset);
// m_scene.AddNewSceneObject(complexObject, true); // m_scene.AddNewSceneObject(complexObject, true);
// } // }
// } // }
@ -113,8 +112,7 @@ namespace OpenSim.Region.Examples.SimpleModule
// private void AddCpuCounter(RegionInfo regionInfo, Vector3 pos) // private void AddCpuCounter(RegionInfo regionInfo, Vector3 pos)
// { // {
// SceneObjectGroup sceneObject = // SceneObjectGroup sceneObject =
// new CpuCounterObject(m_scene, regionInfo.RegionHandle, UUID.Zero, m_scene.AllocateLocalPrimId(), // new CpuCounterObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + new Vector3(1f, 1f, 1f));
// pos + new Vector3(1f, 1f, 1f));
// m_scene.AddNewSceneObject(sceneObject, true); // m_scene.AddNewSceneObject(sceneObject, true);
// } // }