From cf73afec356eed30e169be3ce71edad89b4fdb37 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 5 Sep 2011 23:42:37 +0100
Subject: Try disabling the inconsistent attachment state check to see if this
actually has an impact.
The code in question is over three years old and just be catching an inconsistency rather than being wholly necessary.
This commit still carries out the check and prints all the previous log warnings but a 'failure' no longer prevents avatar region crossing or teleport, and it doesn't give the client the error message.
This will have some kind of impact on http://opensimulator.org/mantis/view.php?id=5672
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1c283c7..f231a39 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3498,7 +3498,10 @@ namespace OpenSim.Region.Framework.Scenes
m_attachments.Clear();
}
- public bool ValidateAttachments()
+ ///
+ /// This is currently just being done for information.
+ ///
+ public void ValidateAttachments()
{
lock (m_attachments)
{
@@ -3508,21 +3511,16 @@ namespace OpenSim.Region.Framework.Scenes
if (gobj == null)
{
m_log.WarnFormat(
- "[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null", Name);
- return false;
+ "[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null. Continuing", Name);
}
-
- if (gobj.IsDeleted)
+ else if (gobj.IsDeleted)
{
m_log.WarnFormat(
- "[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted",
+ "[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted. Continuing",
gobj.Name, gobj.UUID, Name);
- return false;
}
}
}
-
- return true;
}
///
--
cgit v1.1
From 4bf3adffb8d58a7a856307df3460ac3eb4bf6d91 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 6 Sep 2011 22:26:28 +0100
Subject: In SceneViewer, introduce an IsEnabled flag and perform Close() under
an m_pendingObjects lock in order to avoid the race condition seen by
danbanner in http://opensimulator.org/mantis/view.php?id=5669
---
OpenSim/Region/Framework/Scenes/SceneViewer.cs | 59 ++++++++++++++++++--------
1 file changed, 41 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index e2ea830..3e0d1db 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -38,27 +38,42 @@ namespace OpenSim.Region.Framework.Scenes
{
public class SceneViewer : ISceneViewer
{
+ ///
+ /// Is this scene viewer enabled?
+ ///
+ private bool IsEnabled { get; set; }
+
+ ///
+ /// The scene presence serviced by this viewer.
+ ///
protected ScenePresence m_presence;
+
+ ///
+ /// The queue of parts for which we need to send out updates.
+ ///
protected UpdateQueue m_partsUpdateQueue = new UpdateQueue();
+
+ ///
+ /// The queue of objects for which we need to send out updates.
+ ///
protected Queue m_pendingObjects;
+ ///
+ /// The last update assocated with a given part update.
+ ///
protected Dictionary m_updateTimes = new Dictionary();
- public SceneViewer()
- {
- }
-
public SceneViewer(ScenePresence presence)
{
m_presence = presence;
+ IsEnabled = true;
}
- ///
- /// Add the part to the queue of parts for which we need to send an update to the client
- ///
- ///
public void QueuePartForUpdate(SceneObjectPart part)
{
+ if (!IsEnabled)
+ return;
+
lock (m_partsUpdateQueue)
{
m_partsUpdateQueue.Enqueue(part);
@@ -87,6 +102,11 @@ namespace OpenSim.Region.Framework.Scenes
lock (m_pendingObjects)
{
+ // We must do this under lock so that we don't suffer a race condition if another thread closes the
+ // viewer
+ if (!IsEnabled)
+ return;
+
while (m_pendingObjects != null && m_pendingObjects.Count > 0)
{
SceneObjectGroup g = m_pendingObjects.Dequeue();
@@ -119,7 +139,6 @@ namespace OpenSim.Region.Framework.Scenes
// We deal with the possibility that two updates occur at
// the same unix time at the update point itself.
-
if ((update.LastFullUpdateTime < part.TimeStampFull) || part.ParentGroup.IsAttachment)
{
// m_log.DebugFormat(
@@ -135,9 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
// this update. If this happened, then subsequent
// updates which occurred on the same tick or the
// next tick of the last update would be ignored.
-
update.LastFullUpdateTime = part.TimeStampFull;
-
}
else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{
@@ -193,15 +210,21 @@ namespace OpenSim.Region.Framework.Scenes
public void Close()
{
- lock (m_updateTimes)
- {
- m_updateTimes.Clear();
- }
- lock (m_partsUpdateQueue)
+ lock (m_pendingObjects)
{
- m_partsUpdateQueue.Clear();
+ IsEnabled = false;
+
+ lock (m_updateTimes)
+ {
+ m_updateTimes.Clear();
+ }
+ lock (m_partsUpdateQueue)
+ {
+ m_partsUpdateQueue.Clear();
+ }
+
+ Reset();
}
- Reset();
}
public int GetPendingObjectsCount()
--
cgit v1.1
From 3d4d3427cd2c61b982b602eeba0ec7105ae9be50 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 6 Sep 2011 22:44:34 +0100
Subject: Comment out SceneViewer.Reset() and stop calling from Close() since
this is useless work as a closed scene object is never reset.
Strictly speaking, we could also stop bothering to clear the m_updateTimes and m_partsUpdateQueue if we are sure that the whole SceneViewer is shortly to be garbage collected anyway, but we'll leave them around for now.
---
OpenSim/Region/Framework/Scenes/SceneViewer.cs | 33 +++++++++++++-------------
1 file changed, 17 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 3e0d1db..9ad80b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -193,37 +193,38 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void Reset()
- {
- if (m_pendingObjects == null)
- return;
-
- lock (m_pendingObjects)
- {
- if (m_pendingObjects != null)
- {
- m_pendingObjects.Clear();
- m_pendingObjects = null;
- }
- }
- }
+// public void Reset()
+// {
+// if (m_pendingObjects == null)
+// return;
+//
+// lock (m_pendingObjects)
+// {
+// if (m_pendingObjects != null)
+// {
+// m_pendingObjects.Clear();
+// m_pendingObjects = null;
+// }
+// }
+// }
public void Close()
{
lock (m_pendingObjects)
{
+ // We perform this under the m_pendingObjects lock in order to avoid a race condition with another
+ // thread on SendPrimUpdates()
IsEnabled = false;
lock (m_updateTimes)
{
m_updateTimes.Clear();
}
+
lock (m_partsUpdateQueue)
{
m_partsUpdateQueue.Clear();
}
-
- Reset();
}
}
--
cgit v1.1
From e6cd4defdbee5d6df9cb5809ab66619ac1e51c9b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 6 Sep 2011 22:48:05 +0100
Subject: Lock m_pendingObjects when calling GetPendingObjectsCount().
This is only called by a region console command.
We should also be locking m_partsUpdateQueue when dequeueing the next part, or locking m_pendingObjects in QueuePartForUpdate().
However, I won't do this now since I don't have time to analyze how this would affect liveness.
---
OpenSim/Region/Framework/Scenes/SceneViewer.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 9ad80b8..50e1e39 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -231,7 +231,8 @@ namespace OpenSim.Region.Framework.Scenes
public int GetPendingObjectsCount()
{
if (m_pendingObjects != null)
- return m_pendingObjects.Count;
+ lock (m_pendingObjects)
+ return m_pendingObjects.Count;
return 0;
}
--
cgit v1.1
From 086bf9f15db05ca2be1cf0dda24f8ee7a368988d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 9 Sep 2011 00:29:59 +0100
Subject: Save the default terrain texture UUIDs for a new region instead of
leaving them as UUID.Zero.
Leaving them at UUID.Zero meant that when a viewer 2 logged into a region that had been freshly created, it received UUID.Zero for these textures, and hence display the land as plain white.
On a simulator restart, the problem would go away since when the database adapators loaded the new region settings, RegionSettings itself has code to use default textures instead of UUID.Zero.
This commit resolves the problem by saving the default texture UUIDs instead of Zero.
However, we currently have to do this in a roundabout way by resaving once the RegionSettings have been created by the database for the first time. This needless complexity should be addressed.
This change will also have the effect of replacing any existing UUID.Zero terrain textures with the default ones.
However, this shouldn't have any effect since the UUID.Zeros were already being replaced in memory with those same UUIDs.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 37 +++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d3de37d..f86b3b6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -588,7 +588,42 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings
// Load region settings
- m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
+ // LoadRegionSettings creates new region settings in persistence if they don't already exist for this region.
+ // However, in this case, the default textures are not set in memory properly, so we need to do it here and
+ // resave.
+ // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new
+ // region is set up and avoid these gyrations.
+ RegionSettings rs = simDataService.LoadRegionSettings(m_regInfo.RegionID);
+ bool updatedTerrainTextures = false;
+ if (rs.TerrainTexture1 == UUID.Zero)
+ {
+ rs.TerrainTexture1 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_1;
+ updatedTerrainTextures = true;
+ }
+
+ if (rs.TerrainTexture2 == UUID.Zero)
+ {
+ rs.TerrainTexture2 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_2;
+ updatedTerrainTextures = true;
+ }
+
+ if (rs.TerrainTexture3 == UUID.Zero)
+ {
+ rs.TerrainTexture3 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_3;
+ updatedTerrainTextures = true;
+ }
+
+ if (rs.TerrainTexture4 == UUID.Zero)
+ {
+ rs.TerrainTexture4 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_4;
+ updatedTerrainTextures = true;
+ }
+
+ if (updatedTerrainTextures)
+ rs.Save();
+
+ m_regInfo.RegionSettings = rs;
+
if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
--
cgit v1.1
From 1dd904b78e723af8cb4340415a8f41dcd1054541 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 5 Sep 2011 12:45:02 +0300
Subject: Delay loading scripts until the scene has finished loading
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4700c3b..9dcd10a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -57,11 +57,11 @@ namespace OpenSim.Region.Framework.Scenes
protected AsyncInventorySender m_asyncInventorySender;
///
- /// Start all the scripts in the scene which should be started.
+ /// Creates all the scripts in the scene which should be started.
///
public void CreateScriptInstances()
{
- m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
+ m_log.Info("[PRIM INVENTORY]: Creating scripts in scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase group in entities)
@@ -74,6 +74,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ///
+ /// Lets the script engines start processing scripts.
+ ///
+ public void StartScripts()
+ {
+ m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
+
+ IScriptModule[] engines = RequestModuleInterfaces();
+ if (engines != null)
+ {
+ foreach (IScriptModule engine in engines)
+ {
+ if (engine != null)
+ {
+ engine.StartProcessing();
+ }
+ }
+ }
+ }
+
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
{
IMoneyModule money = RequestModuleInterface();
--
cgit v1.1
From 9c32b131fd0b156ada1c7e2d2107d6e1061da5e0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 10 Sep 2011 00:57:52 +0100
Subject: Add extra log information when attachments fail validation
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f231a39..18ad715 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3501,8 +3501,10 @@ namespace OpenSim.Region.Framework.Scenes
///
/// This is currently just being done for information.
///
- public void ValidateAttachments()
+ public bool ValidateAttachments()
{
+ bool validated = true;
+
lock (m_attachments)
{
// Validate
@@ -3512,15 +3514,21 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.WarnFormat(
"[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null. Continuing", Name);
+
+ validated = false;
}
else if (gobj.IsDeleted)
{
m_log.WarnFormat(
"[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted. Continuing",
gobj.Name, gobj.UUID, Name);
+
+ validated = false;
}
}
}
+
+ return validated;
}
///
--
cgit v1.1
From 728fd0b1b8e1c80f6961ec06efb34727645fdc3e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 10 Sep 2011 01:09:17 +0100
Subject: lock attachments when enumerating through them in
ScenePresence.CopyTo().
May have some effect on http://opensimulator.org/mantis/view.php?id=5644
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 44 +++++++++++++-----------
1 file changed, 24 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 18ad715..d65d78d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3141,26 +3141,30 @@ namespace OpenSim.Region.Framework.Scenes
catch { }
// Attachment objects
- if (m_attachments != null && m_attachments.Count > 0)
- {
- cAgent.AttachmentObjects = new List();
- cAgent.AttachmentObjectStates = new List();
-// IScriptModule se = m_scene.RequestModuleInterface();
- m_InTransitScriptStates.Clear();
- foreach (SceneObjectGroup sog in m_attachments)
- {
- // We need to make a copy and pass that copy
- // because of transfers withn the same sim
- ISceneObject clone = sog.CloneForNewScene();
- // Attachment module assumes that GroupPosition holds the offsets...!
- ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
- ((SceneObjectGroup)clone).IsAttachment = false;
- cAgent.AttachmentObjects.Add(clone);
- string state = sog.GetStateSnapshot();
- cAgent.AttachmentObjectStates.Add(state);
- m_InTransitScriptStates.Add(state);
- // Let's remove the scripts of the original object here
- sog.RemoveScriptInstances(true);
+ lock (m_attachments)
+ {
+ if (m_attachments.Count > 0)
+ {
+ cAgent.AttachmentObjects = new List();
+ cAgent.AttachmentObjectStates = new List();
+ // IScriptModule se = m_scene.RequestModuleInterface();
+ m_InTransitScriptStates.Clear();
+
+ foreach (SceneObjectGroup sog in m_attachments)
+ {
+ // We need to make a copy and pass that copy
+ // because of transfers withn the same sim
+ ISceneObject clone = sog.CloneForNewScene();
+ // Attachment module assumes that GroupPosition holds the offsets...!
+ ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
+ ((SceneObjectGroup)clone).IsAttachment = false;
+ cAgent.AttachmentObjects.Add(clone);
+ string state = sog.GetStateSnapshot();
+ cAgent.AttachmentObjectStates.Add(state);
+ m_InTransitScriptStates.Add(state);
+ // Let's remove the scripts of the original object here
+ sog.RemoveScriptInstances(true);
+ }
}
}
}
--
cgit v1.1
From 517932722bd73de85366b4752ce0fa65776672d3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 20:06:09 +0100
Subject: minor: put tags around some method doc
---
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 77b1535..3acdaf8 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -43,11 +43,12 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Gather uuids for a given entity.
///
- ///
+ ///
/// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts
/// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets
/// are only retrieved when they are necessary to carry out the inspection (i.e. a serialized object needs to be
/// retrieved to work out which assets it references).
+ ///
public class UuidGatherer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -76,11 +77,11 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Gather all the asset uuids associated with the asset referenced by a given uuid
///
- ///
+ ///
/// This includes both those directly associated with
/// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
/// within this object).
- ///
+ ///
/// The uuid of the asset for which to gather referenced assets
/// The type of the asset for the uuid given
/// The assets gathered
@@ -123,11 +124,11 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Gather all the asset uuids associated with a given object.
///
- ///
+ ///
/// This includes both those directly associated with
/// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
/// within this object).
- ///
+ ///
/// The scene object for which to gather assets
/// The assets gathered
public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary assetUuids)
--
cgit v1.1
From ea0f78c97152d3aa54822487e5343ca2db0b47b9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 21:57:22 +0100
Subject: Start locking entire add/remove operations on an
IScenePresence.AttachmentsSyncLock object
Attach and detach packets are processed asynchronously when received from a viewer.
Bugs like http://opensimulator.org/mantis/view.php?id=5644 indicate that in some situations (such as attaching/detaching entire folders of objects at once), there are race conditions between these threads.
Since multiple data structures need to be updated on attach/detach, it's not enough to lock the individual collections.
Therefore, this commit introduces a new IScenePresence.AttachmentsSyncLock which add/remove operations lock on.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d65d78d..86e1e11 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -120,6 +120,8 @@ namespace OpenSim.Region.Framework.Scenes
///
protected List m_attachments = new List();
+ public Object AttachmentsSyncLock { get; private set; }
+
private Dictionary scriptedcontrols = new Dictionary();
private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
@@ -709,6 +711,8 @@ namespace OpenSim.Region.Framework.Scenes
public ScenePresence(
IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
{
+ AttachmentsSyncLock = new Object();
+
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
m_sceneViewer = new SceneViewer(this);
m_animator = new ScenePresenceAnimator(this);
--
cgit v1.1
From 00f8946bd420a796128e58f025f7f380887306ab Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 22:44:14 +0100
Subject: minor: if the script engine fails to find a prim for a script, also
print out that prim's local id in the error message.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6f963ac..89e6ddb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -418,6 +418,10 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByLocalPartID)
{
+// m_log.DebugFormat(
+// "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}",
+// sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName);
+
SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
--
cgit v1.1
From 56cd7d96851203efa3e84b4c8be70177e2d2d453 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 22:51:56 +0100
Subject: stop the redundant passing in of RegionInfo to SceneGraph, since the
Scene is always passed in at the same time.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 7 ++-----
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++----
3 files changed, 7 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f86b3b6..e0bc891 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -656,7 +656,7 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
- m_sceneGraph = new SceneGraph(this, m_regInfo);
+ m_sceneGraph = new SceneGraph(this);
// If the scene graph has an Unrecoverable error, restart this sim.
// Currently the only thing that causes it to happen is two kinds of specific
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 89e6ddb..40dc2f8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -74,7 +74,6 @@ namespace OpenSim.Region.Framework.Scenes
protected internal EntityManager Entities = new EntityManager();
- protected RegionInfo m_regInfo;
protected Scene m_parentScene;
protected Dictionary m_updateList = new Dictionary();
protected int m_numRootAgents = 0;
@@ -108,10 +107,9 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
- protected internal SceneGraph(Scene parent, RegionInfo regInfo)
+ protected internal SceneGraph(Scene parent)
{
m_parentScene = parent;
- m_regInfo = regInfo;
}
public PhysicsScene PhysicsScene
@@ -122,7 +120,6 @@ namespace OpenSim.Region.Framework.Scenes
// If we're not doing the initial set
// Then we've got to remove the previous
// event handler
-
if (_PhyScene != null)
_PhyScene.OnPhysicsCrash -= physicsBasedCrash;
@@ -593,7 +590,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence newAvatar = null;
// ScenePresence always defaults to child agent
- newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
+ newAvatar = new ScenePresence(client, m_parentScene, appearance, type);
AddScenePresence(newAvatar);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 86e1e11..9b8afe3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -707,9 +707,9 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region Constructor(s)
-
+
public ScenePresence(
- IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
+ IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
{
AttachmentsSyncLock = new Object();
@@ -718,14 +718,14 @@ namespace OpenSim.Region.Framework.Scenes
m_animator = new ScenePresenceAnimator(this);
PresenceType = type;
m_DrawDistance = world.DefaultDrawDistance;
- m_rootRegionHandle = reginfo.RegionHandle;
+ m_rootRegionHandle = world.RegionInfo.RegionHandle;
m_controllingClient = client;
m_firstname = m_controllingClient.FirstName;
m_lastname = m_controllingClient.LastName;
m_name = String.Format("{0} {1}", m_firstname, m_lastname);
m_scene = world;
m_uuid = client.AgentId;
- m_regionInfo = reginfo;
+ m_regionInfo = world.RegionInfo;
m_localId = m_scene.AllocateLocalId();
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
--
cgit v1.1
From 62b24505295a49b3b3ba61a1a840d0fa5825340f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 22:54:54 +0100
Subject: remove the unused SP.initializeScenePresence()
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 25 ++----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9b8afe3..1050507 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3568,29 +3568,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
-
- public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
- {
- m_controllingClient = client;
- m_regionInfo = region;
- m_scene = scene;
-
- RegisterToEvents();
-
- /*
- AbsolutePosition = client.StartPos;
-
- Animations = new AvatarAnimations();
- Animations.LoadAnims();
-
- m_animations = new List();
- m_animations.Add(Animations.AnimsUUID["STAND"]);
- m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
-
- SetDirectionVectors();
- */
- }
-
internal void PushForce(Vector3 impulse)
{
if (PhysicsActor != null)
@@ -3618,6 +3595,7 @@ namespace OpenSim.Region.Framework.Scenes
obj.ignoreControls = (ScriptControlled)controls;
obj.eventControls = (ScriptControlled)controls;
}
+
if (pass_on == 1 && accept == 1)
{
IgnoredControls = ScriptControlled.CONTROL_ZERO;
@@ -3638,6 +3616,7 @@ namespace OpenSim.Region.Framework.Scenes
scriptedcontrols[Script_item_UUID] = obj;
}
}
+
ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
}
--
cgit v1.1
From dea0935361d536da7fada83069e06a7c476b5351 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 23:00:15 +0100
Subject: eliminate redundant SP.m_regionInfo since it always has the scene.
We were already referencing through the scene in some places.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1050507..879352d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -188,7 +188,6 @@ namespace OpenSim.Region.Framework.Scenes
private float m_health = 100f;
- protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion;
private readonly Vector3[] Dir_Vectors = new Vector3[9];
@@ -725,7 +724,6 @@ namespace OpenSim.Region.Framework.Scenes
m_name = String.Format("{0} {1}", m_firstname, m_lastname);
m_scene = world;
m_uuid = client.AgentId;
- m_regionInfo = world.RegionInfo;
m_localId = m_scene.AllocateLocalId();
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
@@ -1156,7 +1154,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("Completed movement");
- m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
+ m_controllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
SendInitialData();
// Create child agents in neighbouring regions
@@ -2877,8 +2875,8 @@ namespace OpenSim.Region.Framework.Scenes
///
protected int HaveNeighbor(Cardinals car, ref int[] fix)
{
- uint neighbourx = m_regionInfo.RegionLocX;
- uint neighboury = m_regionInfo.RegionLocY;
+ uint neighbourx = m_scene.RegionInfo.RegionLocX;
+ uint neighboury = m_scene.RegionInfo.RegionLocY;
int dir = (int)car;
@@ -2898,8 +2896,8 @@ namespace OpenSim.Region.Framework.Scenes
if (neighbourRegion == null)
{
- fix[0] = (int)(m_regionInfo.RegionLocX - neighbourx);
- fix[1] = (int)(m_regionInfo.RegionLocY - neighboury);
+ fix[0] = (int)(m_scene.RegionInfo.RegionLocX - neighbourx);
+ fix[1] = (int)(m_scene.RegionInfo.RegionLocY - neighboury);
return dir * (-1);
}
else
@@ -3616,7 +3614,7 @@ namespace OpenSim.Region.Framework.Scenes
scriptedcontrols[Script_item_UUID] = obj;
}
}
-
+
ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
}
--
cgit v1.1
From 306af9934aac2aaf7fe9baa156b3cc57ff3f3f56 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 17:13:42 +0100
Subject: In an object return message, send a null-terminated empty string in
binary bucket to prevent a viewer 3 crash.
This is the message sent to the client when the object is returned.
We were sending byte[0] in the binary bucket. This didn't kill viewer 1 but did terminate viewer 3 (don't know about viewer 2).
So sending "\0" instead.
This is to address http://opensimulator.org/mantis/view.php?id=5683
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e0bc891..a0a2624 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1579,7 +1579,9 @@ namespace OpenSim.Region.Framework.Scenes
msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
msg.Position = Vector3.Zero;
msg.RegionID = RegionInfo.RegionID.Guid;
- msg.binaryBucket = new byte[0];
+
+ // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3.
+ msg.binaryBucket = Util.StringToBytes256("\0");
if (ret.Value.count > 1)
msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason);
else
--
cgit v1.1
From 88bd71b9786f5af9ce185fa1c885622f41712371 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 17:40:39 +0100
Subject: improve TestAddSceneObject() to test a multi-part object rather than
a single-part
---
.../Scenes/Tests/SceneObjectBasicTests.cs | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 1ea2329..8f2e21f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -52,22 +52,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelpers.InMethod();
Scene scene = SceneHelpers.SetupScene();
+ int partsToTestCount = 3;
- string objName = "obj1";
- UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
-
- SceneObjectPart part
- = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = objName, UUID = objUuid };
+ SceneObjectGroup so
+ = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
+ SceneObjectPart[] parts = so.Parts;
- Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part), false), Is.True);
-
- SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
+ Assert.That(scene.AddNewSceneObject(so, false), Is.True);
+ SceneObjectGroup retrievedSo = scene.GetSceneObjectGroup(so.UUID);
+ SceneObjectPart[] retrievedParts = retrievedSo.Parts;
//m_log.Debug("retrievedPart : {0}", retrievedPart);
// If the parts have the same UUID then we will consider them as one and the same
- Assert.That(retrievedPart.Name, Is.EqualTo(objName));
- Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
+ Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount));
+
+ for (int i = 0; i < partsToTestCount; i++)
+ {
+ Assert.That(retrievedParts[i].Name, Is.EqualTo(parts[i].Name));
+ Assert.That(retrievedParts[i].UUID, Is.EqualTo(parts[i].UUID));
+ }
}
[Test]
--
cgit v1.1
From c14f0a22d44c582fb277ba34dec7cee629ba7f4a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 17:52:10 +0100
Subject: Add new TestGetSceneObjectByPartLocalId() for retrieving a scene
object via the local id of one of its parts
---
.../Scenes/Tests/SceneObjectBasicTests.cs | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 8f2e21f..281b85c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -106,6 +106,33 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(retrievedPart.Name, Is.EqualTo(obj1Name));
Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
}
+
+ ///
+ /// Test retrieving a scene object via the local id of one of its parts.
+ ///
+ [Test]
+ public void TestGetSceneObjectByPartLocalId()
+ {
+ TestHelpers.InMethod();
+
+ Scene scene = SceneHelpers.SetupScene();
+ int partsToTestCount = 3;
+
+ SceneObjectGroup so
+ = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
+ SceneObjectPart[] parts = so.Parts;
+
+ scene.AddNewSceneObject(so, false);
+
+ // Test getting via the root part's local id
+ Assert.That(scene.GetGroupByPrim(so.LocalId), Is.Not.Null);
+
+ // Test getting via a non root part's local id
+ Assert.That(scene.GetGroupByPrim(parts[partsToTestCount - 1].LocalId), Is.Not.Null);
+
+ // Test that we don't get back an object for a local id that doesn't exist
+ Assert.That(scene.GetGroupByPrim(999), Is.Null);
+ }
///
/// Test deleting an object from a scene.
--
cgit v1.1
From 07ba28f1dece06309cfbf7f487b7a779e49033bb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 17:56:02 +0100
Subject: In SG.AddSceneObject(), stop unnecessarily adding the root part to
object indexes sepearately from the other parts.
The SOG.Parts property contains the root part as well as the non-root parts
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 40dc2f8..4d7bc0c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -369,12 +369,12 @@ namespace OpenSim.Region.Framework.Scenes
// "[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;
+ SceneObjectPart[] parts = sceneObject.Parts;
// Clamp child prim sizes and add child prims to the m_numPrim count
if (m_parentScene.m_clampPrimSize)
{
- foreach (SceneObjectPart part in children)
+ foreach (SceneObjectPart part in parts)
{
Vector3 scale = part.Shape.Scale;
@@ -388,7 +388,7 @@ namespace OpenSim.Region.Framework.Scenes
part.Shape.Scale = scale;
}
}
- m_numPrim += children.Length;
+ m_numPrim += parts.Length;
sceneObject.AttachToScene(m_parentScene);
@@ -408,8 +408,7 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullPartID)
{
- SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
- foreach (SceneObjectPart part in children)
+ foreach (SceneObjectPart part in parts)
SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
}
@@ -419,8 +418,7 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}",
// sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName);
- SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
- foreach (SceneObjectPart part in children)
+ foreach (SceneObjectPart part in parts)
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
--
cgit v1.1
From f09a90d8a7cf1e4b32845c3ffddbf1ca780e664c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 18:08:05 +0100
Subject: extend TestGetSceneObjectByPartLocalId() to test state after scene
object deletion
---
OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 281b85c..9586877 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -132,6 +132,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Test that we don't get back an object for a local id that doesn't exist
Assert.That(scene.GetGroupByPrim(999), Is.Null);
+
+ // Now delete the scene object and check again
+ scene.DeleteSceneObject(so, false);
+
+ Assert.That(scene.GetGroupByPrim(so.LocalId), Is.Null);
+ Assert.That(scene.GetGroupByPrim(parts[partsToTestCount - 1].LocalId), Is.Null);
}
///
--
cgit v1.1
From df73833a2c79a1a60536e386b5884581d9f2f4b3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 18:11:13 +0100
Subject: stop the duplicate remove of the root part ids from the full part and
local part indexes in SG.DeleteSceneObject()
this is unnecessary because the parts array iterated through contains the root part as well as the non-root parts
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 --
OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 4d7bc0c..46c22ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -459,7 +459,6 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
- SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalPartID)
@@ -467,7 +466,6 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
- SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
}
return Entities.Remove(uuid);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 9586877..80f198d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Now delete the scene object and check again
scene.DeleteSceneObject(so, false);
-
+
Assert.That(scene.GetGroupByPrim(so.LocalId), Is.Null);
Assert.That(scene.GetGroupByPrim(parts[partsToTestCount - 1].LocalId), Is.Null);
}
--
cgit v1.1
From 618277e797c7d501f98e884e50abd313498cf00b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 20:25:32 +0100
Subject: Comment out attachments code in Scene.IncomingCreateObject(UUID
userID, UUID itemID) for now
As far as I can see, this is only invoked by a PUT request to ObjectHandlers, which is not being used anyway.
Invoking attachments code at this point is probably inappropriate since it would still be invoked when the client entered the scene.
Being commented to simplify analysis of attachments issues. Can be uncommented when in use.
Also, small tweak to lock and log removal of a SOG from the SceneObjectGroupsByLocalPartID collection in SceneGraph.GetGroupByPrim() if an inconsistency is found.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 18 ++++++++++--------
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 25 +++++++++++++++++++++++--
2 files changed, 33 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a0a2624..c5c9260 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2461,14 +2461,16 @@ namespace OpenSim.Region.Framework.Scenes
/// False
public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
{
- //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
-
- ScenePresence sp = GetScenePresence(userID);
- if (sp != null && AttachmentsModule != null)
- {
- uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
- AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
- }
+ m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
+
+ // Commented out since this is as yet unused and is arguably not the appropriate place to do this, as
+ // attachments are being rezzed elsewhere in AddNewClient()
+// ScenePresence sp = GetScenePresence(userID);
+// if (sp != null && AttachmentsModule != null)
+// {
+// uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
+// AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
+// }
return false;
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 46c22ca..f03cf7b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -431,6 +431,10 @@ namespace OpenSim.Region.Framework.Scenes
/// true if the object was deleted, false if there was no object to delete
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{
+// m_log.DebugFormat(
+// "[SCENE GRAPH]: Deleting scene object with uuid {0}, resultOfObjectLinked = {1}",
+// uuid, resultOfObjectLinked);
+
EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
return false;
@@ -878,7 +882,8 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup;
- //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
+// m_log.DebugFormat("[SCENE GRAPH]: Entered GetGroupByPrim with localID {0}", localID);
+
SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
@@ -886,8 +891,24 @@ namespace OpenSim.Region.Framework.Scenes
if (sog != null)
{
if (sog.HasChildPrim(localID))
+ {
+// m_log.DebugFormat(
+// "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.",
+// sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
+
return sog;
- SceneObjectGroupsByLocalPartID.Remove(localID);
+ }
+ else
+ {
+ lock (SceneObjectGroupsByLocalPartID)
+ {
+ m_log.WarnFormat(
+ "[SCENE GRAPH]: Found scene object {0} {1} {2} via SceneObjectGroupsByLocalPartID index but it doesn't contain part with local id {3}. Removing from entry from index in {4}.",
+ sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
+
+ SceneObjectGroupsByLocalPartID.Remove(localID);
+ }
+ }
}
EntityBase[] entityList = GetEntities();
--
cgit v1.1
From 8880aea728af2ccb95ea2400c7d180aa4dc98112 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 22:13:58 +0100
Subject: Stop attempts to rewear already worn items from removing and
reattaching.
Viewer 2/3 will sometimes attempt to rewear attachments, even though they have already been attached during the main login process.
This change ignores those attempts.
This stops script failures during login, as the rewearing was racing with the script startup code.
It might also help with attachments being abnormally put into deleted state.
Hopefully resolves some more of http://opensimulator.org/mantis/view.php?id=5644
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 ++--
.../Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 13 +++++++++++++
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 5 +++++
3 files changed, 20 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f03cf7b..36c5c52 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -652,7 +652,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!Entities.Remove(agentID))
{
m_log.WarnFormat(
- "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
+ "[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
agentID);
}
@@ -675,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
- m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
+ m_log.WarnFormat("[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 4bca3d0..905ecc9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -389,5 +389,18 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
parts[i].Inventory.ResumeScripts();
}
+
+ ///
+ /// Returns true if any part in the scene object contains scripts, false otherwise.
+ ///
+ ///
+ public bool ContainsScripts()
+ {
+ foreach (SceneObjectPart part in Parts)
+ if (part.Inventory.ContainsScripts())
+ return true;
+
+ return false;
+ }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index e40e57d..57adda7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1035,10 +1035,15 @@ namespace OpenSim.Region.Framework.Scenes
item.BasePermissions = perms;
}
}
+
m_inventorySerial++;
HasInventoryChanged = true;
}
+ ///
+ /// Returns true if this part inventory contains any scripts. False otherwise.
+ ///
+ ///
public bool ContainsScripts()
{
lock (m_items)
--
cgit v1.1
From bd991fc95f8ec648f7dbb0086ae716e4204d1687 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 22:54:50 +0100
Subject: Don't try and delete attachments for child agent close
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 879352d..a8eff70 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3404,7 +3404,8 @@ namespace OpenSim.Region.Framework.Scenes
public void Close()
{
- m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
+ if (!IsChildAgent)
+ m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
lock (m_knownChildRegions)
{
--
cgit v1.1