From d3a20a1e9257ecec417e219ebaf079370015f06d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 21 Mar 2011 21:37:06 +0000
Subject: On initial region registration, if the user chooses the option to
make the region part of an existing estate, then list the existing region
names.
---
OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 14 ++++++++++++++
OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 14 ++++++++++++++
2 files changed, 28 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 95c9659..12ed9e3 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces
{
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
+
+ ///
+ /// Load/Get all estate settings.
+ ///
+ /// An empty list if no estates were found.
+ List LoadEstateSettingsAll();
+
void StoreEstateSettings(EstateSettings es);
List GetEstates(string search);
+
+ ///
+ /// Get the IDs of all estates.
+ ///
+ /// An empty list if no estates were found.
+ List GetEstatesAll();
+
bool LinkRegion(UUID regionID, int estateID);
List GetRegions(int estateID);
bool DeleteEstate(int estateID);
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 87c7a05..d78ad78 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -37,8 +37,22 @@ namespace OpenSim.Region.Framework.Interfaces
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
+
+ ///
+ /// Load/Get all estate settings.
+ ///
+ /// An empty list if no estates were found.
+ List LoadEstateSettingsAll();
+
void StoreEstateSettings(EstateSettings es);
List GetEstates(string search);
+
+ ///
+ /// Get the IDs of all estates.
+ ///
+ /// An empty list if no estates were found.
+ List GetEstatesAll();
+
bool LinkRegion(UUID regionID, int estateID);
List GetRegions(int estateID);
bool DeleteEstate(int estateID);
--
cgit v1.1
From 793bfb5a663879296789efa8350df0e9cabb2148 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 21 Mar 2011 22:25:20 +0000
Subject: add method doc to IEstateDataService and IEstateDataStore interfaces
---
.../Framework/Interfaces/IEstateDataService.cs | 44 +++++++++++++++++++-
.../Framework/Interfaces/IEstateDataStore.cs | 48 +++++++++++++++++++++-
2 files changed, 90 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 12ed9e3..55adef1 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -34,7 +34,19 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataService
{
+ ///
+ /// Load estate settings for a region.
+ ///
+ ///
+ /// If true, then an estate is created if one is not found. This is used in migration.
+ ///
EstateSettings LoadEstateSettings(UUID regionID, bool create);
+
+ ///
+ /// Load estate settings for an estate ID.
+ ///
+ ///
+ ///
EstateSettings LoadEstateSettings(int estateID);
///
@@ -43,7 +55,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// An empty list if no estates were found.
List LoadEstateSettingsAll();
+ ///
+ /// Store estate settings.
+ ///
+ ///
+ /// This is also called by EstateSettings.Save()
+ ///
void StoreEstateSettings(EstateSettings es);
+
+ ///
+ /// Get estate IDs.
+ ///
+ /// Name of estate to search for. This is the exact name, no parttern matching is done.
+ ///
List GetEstates(string search);
///
@@ -52,8 +76,26 @@ namespace OpenSim.Region.Framework.Interfaces
/// An empty list if no estates were found.
List GetEstatesAll();
+ ///
+ /// Link a region to an estate.
+ ///
+ ///
+ ///
+ /// true if the link succeeded, false otherwise
bool LinkRegion(UUID regionID, int estateID);
+
+ ///
+ /// Get the UUIDs of all the regions in an estate.
+ ///
+ ///
+ ///
List GetRegions(int estateID);
+
+ ///
+ /// Delete an estate
+ ///
+ ///
+ /// true if the delete succeeded, false otherwise
bool DeleteEstate(int estateID);
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index d78ad78..4974d5d 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -33,9 +33,25 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataStore
{
+ ///
+ /// Initialise the data store.
+ ///
+ ///
void Initialise(string connectstring);
+ ///
+ /// Load estate settings for a region.
+ ///
+ ///
+ /// If true, then an estate is created if one is not found. This is used in migration.
+ ///
EstateSettings LoadEstateSettings(UUID regionID, bool create);
+
+ ///
+ /// Load estate settings for an estate ID.
+ ///
+ ///
+ ///
EstateSettings LoadEstateSettings(int estateID);
///
@@ -44,7 +60,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// An empty list if no estates were found.
List LoadEstateSettingsAll();
+ ///
+ /// Store estate settings.
+ ///
+ ///
+ /// This is also called by EstateSettings.Save()
+ ///
void StoreEstateSettings(EstateSettings es);
+
+ ///
+ /// Get estate IDs.
+ ///
+ /// Name of estate to search for. This is the exact name, no parttern matching is done.
+ ///
List GetEstates(string search);
///
@@ -53,8 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces
/// An empty list if no estates were found.
List GetEstatesAll();
+ ///
+ /// Link a region to an estate.
+ ///
+ ///
+ ///
+ /// true if the link succeeded, false otherwise
bool LinkRegion(UUID regionID, int estateID);
+
+ ///
+ /// Get the UUIDs of all the regions in an estate.
+ ///
+ ///
+ ///
List GetRegions(int estateID);
+
+ ///
+ /// Delete an estate
+ ///
+ ///
+ /// true if the delete succeeded, false otherwise
bool DeleteEstate(int estateID);
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 2d1f0d224c355e92997643cf849b8e9774dddbad Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 21 Mar 2011 22:27:16 +0000
Subject: minor: slightly adjust previous method doc.
---
OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 2 +-
OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 55adef1..38c10a6 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Load estate settings for a region.
///
///
- /// If true, then an estate is created if one is not found. This is used in migration.
+ /// If true, then an estate is created if one is not found.
///
EstateSettings LoadEstateSettings(UUID regionID, bool create);
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 4974d5d..c82661d 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Load estate settings for a region.
///
///
- /// If true, then an estate is created if one is not found. This is used in migration.
+ /// If true, then an estate is created if one is not found.
///
EstateSettings LoadEstateSettings(UUID regionID, bool create);
--
cgit v1.1
From 7acade00b9b34403e63656d5e2efc94322342653 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 21 Mar 2011 23:26:35 +0000
Subject: On initial setup, include estate and regions names in questions to
make it clearer what they relate to.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1a6a70b..4d2519d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1109,7 +1109,7 @@ namespace OpenSim.Region.Framework.Scenes
//
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
- MainConsole.Instance.Output("The current estate has no owner set.");
+ MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
List excluded = new List(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
--
cgit v1.1
From b34743e5fe6b0783caa62c014ff86e2ec76c8184 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 22 Mar 2011 23:47:36 +0000
Subject: Add an initial confidence-building TestAddObject() for prim counts.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 734ba22..eca2786 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -627,7 +627,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!Entities.Remove(agentID))
{
m_log.WarnFormat(
- "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
+ "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
agentID);
}
@@ -650,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
- m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
+ m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
}
}
@@ -1079,7 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes
catch (Exception e)
{
// Catch it and move on. This includes situations where splist has inconsistent info
- m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString());
+ m_log.WarnFormat(
+ "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
}
}
}
@@ -1103,8 +1104,8 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
- m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
+ m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
+ m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
}
});
Parallel.ForEach(GetScenePresences(), protectedAction);
@@ -1119,7 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
+ m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
}
}
}
--
cgit v1.1
From d011896341d09ce6c10a801264e663b6a19f0b48 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 21:50:56 +0000
Subject: Add generic EventManager.OnObjectAddedToScene and get PrimCountModule
to listen for that rather than EventManager.OnParcelPrimCountAdd
OnParcelPrimCountAdd had the wrong semantics for the PrimCountModule - it was invoked for every entity in the scene, not just new ones, which would screw up the untainted count.
Extend automated test for this scenario.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 30 +++++++++++++++++++++++++
OpenSim/Region/Framework/Scenes/Scene.cs | 18 ++++++++++++---
2 files changed, 45 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index c321a15..fd62535 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
+
+ ///
+ /// Triggered when an object is added to the scene.
+ ///
+ public event Action OnObjectAddedToScene;
+ ///
+ /// Triggered when an object is removed from the scene.
+ ///
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
@@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
public event Attach OnAttach;
+
///
/// Called immediately after an object is loaded from storage.
///
@@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void TriggerObjectAddedToScene(SceneObjectGroup obj)
+ {
+ Action handler = OnObjectAddedToScene;
+ if (handler != null)
+ {
+ foreach (Action d in handler.GetInvocationList())
+ {
+ try
+ {
+ d(obj);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
+ e.Message, e.StackTrace);
+ }
+ }
+ }
+ }
+
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
{
ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4d2519d..d407a6f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1956,8 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes
/// If false, it is left to the caller to schedule the update
///
public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
- {
- return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
+ {
+ if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
+ {
+ EventManager.TriggerObjectAddedToScene(sceneObject);
+ return true;
+ }
+
+ return false;
}
///
@@ -1974,7 +1980,13 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
- return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
+ if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
+ {
+ EventManager.TriggerObjectAddedToScene(sceneObject);
+ return true;
+ }
+
+ return false;
}
///
--
cgit v1.1
From 7f5019b0f23959ca049f87b596bc2bd47725eb0d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 25 Mar 2011 21:47:54 +0000
Subject: Add ILandObject.IPrimCounts for the new prim count module.
Not functional yet, but tests now act against this object rather than interrogating the module directly
---
OpenSim/Region/Framework/Interfaces/ILandObject.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index eeb9d3a..9c0abde 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces
UUID RegionUUID { get; }
///
+ /// Prim counts for this land object.
+ ///
+ IPrimCounts PrimCounts { get; set; }
+
+ ///
/// The start point for the land object. This is the western-most point as one scans land working from
/// north to south.
///
--
cgit v1.1
From f30bf429c274c9d6d0cfc99513820f759ca94d3e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 26 Mar 2011 00:42:48 +0000
Subject: refactor: rename SOG collections in SceneGraph to make it clearer
that they are indexing each part's UUID, not just the root part.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 60 +++++++++++++--------------
1 file changed, 30 insertions(+), 30 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index eca2786..345ed7a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -89,8 +89,8 @@ namespace OpenSim.Region.Framework.Scenes
protected internal PhysicsScene _PhyScene;
- protected internal Dictionary SceneObjectGroupsByLocalID = new Dictionary();
- protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary();
+ protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary();
+ protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary();
private Object m_updateLock = new Object();
@@ -131,10 +131,10 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceArray = newlist;
}
- lock (SceneObjectGroupsByFullID)
- SceneObjectGroupsByFullID.Clear();
- lock (SceneObjectGroupsByLocalID)
- SceneObjectGroupsByLocalID.Clear();
+ lock (SceneObjectGroupsByFullPartID)
+ SceneObjectGroupsByFullPartID.Clear();
+ lock (SceneObjectGroupsByLocalPartID)
+ SceneObjectGroupsByLocalPartID.Clear();
Entities.Clear();
}
@@ -384,18 +384,18 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
- lock (SceneObjectGroupsByFullID)
+ lock (SceneObjectGroupsByFullPartID)
{
- SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
+ SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in children)
- SceneObjectGroupsByFullID[part.UUID] = sceneObject;
+ SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
}
- lock (SceneObjectGroupsByLocalID)
+ lock (SceneObjectGroupsByLocalPartID)
{
- SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
+ SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
- SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
+ SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
return true;
@@ -427,20 +427,20 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
- lock (SceneObjectGroupsByFullID)
+ lock (SceneObjectGroupsByFullPartID)
{
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
- SceneObjectGroupsByFullID.Remove(parts[i].UUID);
- SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
+ SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
+ SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
}
- lock (SceneObjectGroupsByLocalID)
+ lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
- SceneObjectGroupsByLocalID.Remove(parts[i].LocalId);
- SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
+ SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
+ SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
}
return Entities.Remove(uuid);
@@ -854,14 +854,14 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
- lock (SceneObjectGroupsByLocalID)
- SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
+ lock (SceneObjectGroupsByLocalPartID)
+ SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
if (sog != null)
{
if (sog.HasChildPrim(localID))
return sog;
- SceneObjectGroupsByLocalID.Remove(localID);
+ SceneObjectGroupsByLocalPartID.Remove(localID);
}
EntityBase[] entityList = GetEntities();
@@ -873,8 +873,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID))
{
- lock (SceneObjectGroupsByLocalID)
- SceneObjectGroupsByLocalID[localID] = sog;
+ lock (SceneObjectGroupsByLocalPartID)
+ SceneObjectGroupsByLocalPartID[localID] = sog;
return sog;
}
}
@@ -891,16 +891,16 @@ namespace OpenSim.Region.Framework.Scenes
private SceneObjectGroup GetGroupByPrim(UUID fullID)
{
SceneObjectGroup sog;
- lock (SceneObjectGroupsByFullID)
- SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
+ lock (SceneObjectGroupsByFullPartID)
+ SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
if (sog != null)
{
if (sog.ContainsPart(fullID))
return sog;
- lock (SceneObjectGroupsByFullID)
- SceneObjectGroupsByFullID.Remove(fullID);
+ lock (SceneObjectGroupsByFullPartID)
+ SceneObjectGroupsByFullPartID.Remove(fullID);
}
EntityBase[] entityList = GetEntities();
@@ -911,8 +911,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID))
{
- lock (SceneObjectGroupsByFullID)
- SceneObjectGroupsByFullID[fullID] = sog;
+ lock (SceneObjectGroupsByFullPartID)
+ SceneObjectGroupsByFullPartID[fullID] = sog;
return sog;
}
}
@@ -1069,7 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes
///
protected internal void ForEachSOG(Action action)
{
- List objlist = new List(SceneObjectGroupsByFullID.Values);
+ List objlist = new List(SceneObjectGroupsByFullPartID.Values);
foreach (SceneObjectGroup obj in objlist)
{
try
--
cgit v1.1
From 26d16567e1e2bf28a3eafce6d3acf8d9646aaf84 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 26 Mar 2011 00:53:19 +0000
Subject: Make SceneGraph.ForEachSOG() execute once for each SOG, not once for
each prim (e.g. a SOG with 3 prims would have the action executed three
times).
To do this, a new SceneObjectGroupsByFullID index in SceneGraph which just index's prims by their root part UUID, in order to avoid the inefficiency of filtering existing lists.
Existing callers to SceneGraph.ForEachSOG() did not fail due to the multiple per SOG action executions - they were probably just much less efficient.
Code suggests that no callers expected ForEachSOG() to execute actions on sog multiple times
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 345ed7a..1621398 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes
protected internal object m_syncRoot = new object();
protected internal PhysicsScene _PhyScene;
-
- protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary();
+
+ ///
+ /// Index the SceneObjectGroup for each part by the root part's UUID.
+ ///
+ protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary();
+
+ ///
+ /// Index the SceneObjectGroup for each part by that part's UUID.
+ ///
protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary();
+
+ ///
+ /// Index the SceneObjectGroup for each part by that part's local ID.
+ ///
+ protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary();
private Object m_updateLock = new Object();
@@ -131,6 +143,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceArray = newlist;
}
+ lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID.Clear();
lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullPartID.Clear();
lock (SceneObjectGroupsByLocalPartID)
@@ -384,6 +398,9 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
+ lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
+
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
@@ -426,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
+
+ lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID.Remove(grp.UUID);
lock (SceneObjectGroupsByFullPartID)
{
@@ -1064,12 +1084,13 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Performs action on all scene object groups.
+ /// Performs action once on all scene object groups.
///
///
protected internal void ForEachSOG(Action action)
{
- List objlist = new List(SceneObjectGroupsByFullPartID.Values);
+ // FIXME: Need to lock here, really.
+ List objlist = new List(SceneObjectGroupsByFullID.Values);
foreach (SceneObjectGroup obj in objlist)
{
try
@@ -1084,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
-
///
/// Performs action on all scene presences. This can ultimately run the actions in parallel but
--
cgit v1.1
From f2d2470c256486df585705313a7fdfdf3d344c1f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 26 Mar 2011 02:24:32 +0000
Subject: When an object is duplicated, add it to the full/local id SOG indexes
as well as Entities
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1621398..60855b2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.ContainsKey(sceneObject.UUID))
return false;
+
+// m_log.DebugFormat(
+// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
+// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
SceneObjectPart[] children = sceneObject.Parts;
@@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
{
- //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
+// m_log.DebugFormat(
+// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
+// originalPrimID, offset, AgentID);
+
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
if (original != null)
{
@@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes
copy.RootPart.SalePrice = 10;
}
+ // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
Entities.Add(copy);
+
+ lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID[copy.UUID] = copy;
+
+ SceneObjectPart[] children = copy.Parts;
+
+ lock (SceneObjectGroupsByFullPartID)
+ {
+ SceneObjectGroupsByFullPartID[copy.UUID] = copy;
+ foreach (SceneObjectPart part in children)
+ SceneObjectGroupsByFullPartID[part.UUID] = copy;
+ }
+
+ lock (SceneObjectGroupsByLocalPartID)
+ {
+ SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
+ foreach (SceneObjectPart part in children)
+ SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
+ }
+ // PROBABLE END OF FIXME
// Since we copy from a source group that is in selected
// state, but the copy is shown deselected in the viewer,
--
cgit v1.1