From ba1d9ca26b7b5e865824e16dc8930e85ef27eb54 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 7 Nov 2008 22:08:58 +0000 Subject: * refactor: cleanup AllocateLocalPrimId() a bit more --- .../Modules/ContentManagementSystem/AuraMetaEntity.cs | 8 ++++---- .../Modules/ContentManagementSystem/BeamMetaEntity.cs | 8 ++++---- .../Modules/ContentManagementSystem/CMEntityCollection.cs | 1 - .../Environment/Modules/ContentManagementSystem/CMModel.cs | 2 +- .../ContentManagementSystem/ContentManagementEntity.cs | 6 +----- .../Modules/ContentManagementSystem/MetaEntity.cs | 4 ---- .../Modules/ContentManagementSystem/PointMetaEntity.cs | 12 +++++------- OpenSim/Region/Environment/Scenes/Scene.cs | 3 ++- OpenSim/Region/Examples/SimpleModule/RegionModule.cs | 6 ++---- 9 files changed, 19 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs index aab863a..64b48fe 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/AuraMetaEntity.cs @@ -57,14 +57,14 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement #region Constructors //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) - : base(scene, LocalId, groupPos, transparency) + public AuraMetaEntity(Scene scene, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) + : base(scene, groupPos, transparency) { SetAura(color, scale); } - public AuraMetaEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) - : base(scene, uuid, LocalId, groupPos, transparency) + public AuraMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale) + : base(scene, uuid, groupPos, transparency) { SetAura(color, scale); } diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs index ca20ee6..d0015f7 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/BeamMetaEntity.cs @@ -56,14 +56,14 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement { #region Constructors - public BeamMetaEntity(Scene scene, uint LocalId, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) - : base(scene, LocalId, groupPos, transparency) + public BeamMetaEntity(Scene scene, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) + : base(scene, groupPos, transparency) { SetBeamToUUID(To, color); } - public BeamMetaEntity(Scene scene, UUID uuid, uint LocalId, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) - : base(scene, uuid, LocalId, groupPos, transparency) + public BeamMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color) + : base(scene, uuid, groupPos, transparency) { SetBeamToUUID(To, color); } diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs index f8c8a96..c1f8a8a 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMEntityCollection.cs @@ -146,7 +146,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part) { AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene, - part.ParentGroup.Scene.AllocateLocalPrimId(), part.GetWorldPosition(), MetaEntity.TRANSLUCENT, new Vector3(0,254,0), diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs index 9d81262..e58d945 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement { if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID)) continue; - newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart)); + newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart)); } m_log.Info("Number of missing objects found: " + newList.Count); return newList; diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs index ac2af34..d0b5929 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs @@ -153,7 +153,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement else { AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, - m_Entity.Scene.AllocateLocalPrimId(), part.GetWorldPosition(), MetaEntity.TRANSLUCENT, new Vector3(254,0,0), @@ -260,7 +259,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); } BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene, - m_Entity.Scene.AllocateLocalPrimId(), m_UnchangedEntity.RootPart.GetWorldPosition(), MetaEntity.TRANSLUCENT, sceneEntityPart, @@ -275,7 +273,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement m_AuraEntities.Remove(UnchangedPart.UUID); } AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, - m_Entity.Scene.AllocateLocalPrimId(), UnchangedPart.GetWorldPosition(), MetaEntity.TRANSLUCENT, new Vector3(0,0,254), @@ -309,7 +306,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement m_AuraEntities.Remove(UnchangedPart.UUID); } AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, - m_Entity.Scene.AllocateLocalPrimId(), UnchangedPart.GetWorldPosition(), MetaEntity.TRANSLUCENT, new Vector3(254,0,0), @@ -317,7 +313,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement ); m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); - + DiffersFromSceneGroup = true; } } diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs index a96547b..801f8ff 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs @@ -166,10 +166,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement parts.Add(part.UUID, part); } - // make new localids - foreach (SceneObjectPart part in m_Entity.Children.Values) - part.LocalId = m_Entity.Scene.AllocateLocalPrimId(); - //finalize m_Entity.RootPart.PhysActor = null; m_Entity.Children = parts; diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/PointMetaEntity.cs index 81746c5..bf7d944 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/PointMetaEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/PointMetaEntity.cs @@ -56,17 +56,17 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement { #region Constructors - public PointMetaEntity(Scene scene, uint LocalId, Vector3 groupPos, float transparency) + public PointMetaEntity(Scene scene, Vector3 groupPos, float transparency) : base() { - CreatePointEntity(scene, UUID.Random(), LocalId, groupPos); + CreatePointEntity(scene, UUID.Random(), groupPos); 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() { - CreatePointEntity(scene, uuid, LocalId, groupPos); + CreatePointEntity(scene, uuid, groupPos); SetPartTransparency(m_Entity.RootPart, transparency); } @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement #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(); SceneObjectPart y = new SceneObjectPart(); @@ -88,8 +88,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement y.LastOwnerID = UUID.Zero; y.UUID = uuid; - y.LocalId = LocalId; - y.Shape = PrimitiveBaseShape.CreateBox(); y.Scale = new Vector3(0.01f,0.01f,0.01f); y.LastOwnerID = UUID.Zero; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cb4c2f5..833b765 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1606,6 +1606,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", group.Children == null ? 0 : group.Children.Count); } + AddRestoredSceneObject(group, true, true); SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; @@ -1621,7 +1622,7 @@ namespace OpenSim.Region.Environment.Scenes /// Returns a new unallocated local primitive ID /// /// A brand new local primitive ID - public uint AllocateLocalPrimId() + protected internal uint AllocateLocalPrimId() { uint myID; diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index b3965d7..1bb6cae 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -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); // ComplexObject complexObject = - // new ComplexObject(m_scene, regionInfo.RegionHandle, UUID.Zero, m_scene.AllocateLocalPrimId(), - // pos + posOffset); + // new ComplexObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + posOffset); // m_scene.AddNewSceneObject(complexObject, true); // } // } @@ -113,8 +112,7 @@ namespace OpenSim.Region.Examples.SimpleModule // private void AddCpuCounter(RegionInfo regionInfo, Vector3 pos) // { // SceneObjectGroup sceneObject = - // new CpuCounterObject(m_scene, regionInfo.RegionHandle, UUID.Zero, m_scene.AllocateLocalPrimId(), - // pos + new Vector3(1f, 1f, 1f)); + // new CpuCounterObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + new Vector3(1f, 1f, 1f)); // m_scene.AddNewSceneObject(sceneObject, true); // } -- cgit v1.1