From 04bafd21221a789b83b039efd1c52e141944cde0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 30 Aug 2011 23:05:43 +0100
Subject: refactor: Move ScenePresence.RezAttachments() into AttachmentsModule
This adds an incomplete IScenePresence to match ISceneEntity
---
.../Region/Framework/Interfaces/IScenePresence.cs | 56 ++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 OpenSim/Region/Framework/Interfaces/IScenePresence.cs
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
new file mode 100644
index 0000000..d700d79
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using OpenSim.Framework;
+
+namespace OpenSim.Region.Framework.Interfaces
+{
+ ///
+ /// An agent in the scene.
+ ///
+ ///
+ /// Interface is a work in progress. Please feel free to add other required properties and methods.
+ ///
+ public interface IScenePresence : ISceneEntity
+ {
+ ///
+ /// The client controlling this presence
+ ///
+ IClientAPI ControllingClient { get; }
+
+ ///
+ /// Avatar appearance data.
+ ///
+ ///
+ // Because appearance setting is in a module, we actually need
+ // to give it access to our appearance directly, otherwise we
+ // get a synchronization issue.
+ ///
+ AvatarAppearance Appearance { get; set; }
+ }
+}
\ No newline at end of file
--
cgit v1.1
From ddc733cd3d940a4357eb0d235562050eb6f206bf Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 30 Aug 2011 23:32:30 +0100
Subject: refactor: move SP.SaveChangedAttachments() fully into
AttachmentsModule
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index d700d79..b07c821 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -26,7 +26,9 @@
*/
using System;
+using System.Collections.Generic;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
@@ -52,5 +54,14 @@ namespace OpenSim.Region.Framework.Interfaces
// get a synchronization issue.
///
AvatarAppearance Appearance { get; set; }
+
+ ///
+ /// The scene objects attached to this avatar.
+ ///
+ ///
+ /// Do not change this list directly - use methods such as
+ /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
+ ///
+ List Attachments { get; }
}
}
\ No newline at end of file
--
cgit v1.1
From 32444d98cb13423fdf8c874e4fbb7ea17670d7c5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 31 Aug 2011 16:29:51 +0100
Subject: Make SP.Attachments available as sp.GetAttachments() instead.
The approach here, as in other parts of OpenSim, is to return a copy of the list rather than the attachments list itself
This prevents callers from forgetting to lock the list when they read it, as was happening in various parts of the codebase.
It also improves liveness.
This might improve attachment anomolies when performing region crossings.
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index b07c821..788b36f 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -58,10 +58,13 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// The scene objects attached to this avatar.
///
+ ///
+ /// A copy of the list.
+ ///
///
/// Do not change this list directly - use methods such as
- /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
+ /// AddAttachment() and RemoveAttachment().
///
- List Attachments { get; }
+ List GetAttachments();
}
}
\ No newline at end of file
--
cgit v1.1
From 7d58b5fa157b4c3e842573d9fb02a9822034f4b0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 31 Aug 2011 17:53:58 +0100
Subject: move common code into AttachmentsModule.DeleteAttachmentsFromScene()
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 788b36f..91e4bf2 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -62,9 +62,22 @@ namespace OpenSim.Region.Framework.Interfaces
/// A copy of the list.
///
///
- /// Do not change this list directly - use methods such as
- /// AddAttachment() and RemoveAttachment().
+ /// Do not change this list directly - use the attachments module.
///
List GetAttachments();
+
+ ///
+ /// The scene objects attached to this avatar at a specific attachment point.
+ ///
+ ///
+ ///
+ List GetAttachments(uint attachmentPoint);
+
+ bool HasAttachments();
+
+ // Don't use these methods directly. Instead, use the AttachmentsModule
+ void AddAttachment(SceneObjectGroup gobj);
+ void RemoveAttachment(SceneObjectGroup gobj);
+ void ClearAttachments();
}
}
\ No newline at end of file
--
cgit v1.1
From 5c1fa968ab954bec9860023dffc8f68baf3c0620 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 3 Sep 2011 01:11:16 +0100
Subject: Stop NPCs losing attachments when the source avatar takes them off.
This was happening because we were using the source avatar's item IDs in the clone appearance.
Switch to using the asset IDs of attachments instead for NPCs.
The InventoryAccessModule and AttachmentModule had to be changed to allow rezzing of an object without an associated inventory item.
Hopefully goes some way towards resolving http://opensimulator.org/mantis/view.php?id=5653
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 91e4bf2..8913133 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces
IClientAPI ControllingClient { get; }
///
+ /// What type of presence is this? User, NPC, etc.
+ ///
+ PresenceType PresenceType { get; }
+
+ ///
/// Avatar appearance data.
///
///
--
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/Interfaces/IScenePresence.cs | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 8913133..95688ab 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -61,6 +61,14 @@ namespace OpenSim.Region.Framework.Interfaces
AvatarAppearance Appearance { get; set; }
///
+ /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
+ ///
+ ///
+ /// All add and remove attachment operations must synchronize on this for the lifetime of their operations.
+ ///
+ Object AttachmentsSyncLock { get; }
+
+ ///
/// The scene objects attached to this avatar.
///
///
--
cgit v1.1
From 294120c9d36f5c6452d5b839ef2543ed4be7af95 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Sep 2011 22:26:04 +0100
Subject: comment out some recent terrain texture logging
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 95688ab..ff39283 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// All add and remove attachment operations must synchronize on this for the lifetime of their operations.
///
Object AttachmentsSyncLock { get; }
-
+
///
/// The scene objects attached to this avatar.
///
--
cgit v1.1
From f61e54892f2284b6f89bacf3069467c05b2eea11 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 8 Dec 2011 18:34:23 +0000
Subject: On a new client circuit, send the initial reply ack to let the client
know it's live before sending other data.
This means that avatar/appearance data of other avatars and scene objects for a client will be sent after the ack rather than possibly before.
This may stop some avatars appearing grey on login.
This introduces a new OpenSim.Framework.ISceneAgent to accompany the existing OpenSim.Framework.ISceneObject and ISceneEntity
This allows IClientAPI to handle this as it can't reference OpenSim.Region.Framework.Interfaces
---
.../Region/Framework/Interfaces/IScenePresence.cs | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index ff39283..5e43843 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -38,28 +38,8 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// Interface is a work in progress. Please feel free to add other required properties and methods.
///
- public interface IScenePresence : ISceneEntity
+ public interface IScenePresence : ISceneAgent
{
- ///
- /// The client controlling this presence
- ///
- IClientAPI ControllingClient { get; }
-
- ///
- /// What type of presence is this? User, NPC, etc.
- ///
- PresenceType PresenceType { get; }
-
- ///
- /// Avatar appearance data.
- ///
- ///
- // Because appearance setting is in a module, we actually need
- // to give it access to our appearance directly, otherwise we
- // get a synchronization issue.
- ///
- AvatarAppearance Appearance { get; set; }
-
///
/// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
///
--
cgit v1.1
From d0432133172f4147f7401f214c703611978423cd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 27 Jun 2012 00:41:46 +0100
Subject: refactor: Move ScenePresence <-> AgentData attachments copying code
into AttachmentsModule.
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 5e43843..19a8236 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -41,6 +41,12 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IScenePresence : ISceneAgent
{
///
+ /// Copy of the script states while the agent is in transit. This state may
+ /// need to be placed back in case of transfer fail.
+ ///
+ List InTransitScriptStates { get; }
+
+ ///
/// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
///
///
--
cgit v1.1
From bfa6896678872a4e796ec4de22e83b6cead3ba17 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 28 Jun 2012 23:31:23 +0100
Subject: Change AttachmentsModule.DetachSingleAttachmentToInv() to accept a
SOG directly instead of an item ID to then shuffle through attachments,
saving CPU busywork.
Almost all callers already had the sog to hand.
Still checking that it's really an attachment, but now by inspecting SOG.AttachedAvatar
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 19a8236..e6b926c 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -72,6 +72,10 @@ namespace OpenSim.Region.Framework.Interfaces
///
List GetAttachments(uint attachmentPoint);
+ ///
+ /// Does this avatar have any attachments?
+ ///
+ ///
bool HasAttachments();
// Don't use these methods directly. Instead, use the AttachmentsModule
--
cgit v1.1
From e126915bc168f16f2c4462492814a1b733aefe87 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 23 Jul 2012 21:08:02 +0200
Subject: Change attachment handling to remove object from the scene first as
per justincc's original work. Sample scripts before doing so. Also refactor
some crucial common code and eliminate parameters that were only ever used
with the same constant value.
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index e6b926c..3f68ee0 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces
///
public interface IScenePresence : ISceneAgent
{
+ PresenceType PresenceType { get; }
+
///
/// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail.
@@ -83,4 +85,4 @@ namespace OpenSim.Region.Framework.Interfaces
void RemoveAttachment(SceneObjectGroup gobj);
void ClearAttachments();
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From 0d9afad3fecd13b06065af556ed9a01f8a745f44 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Jul 2012 22:15:25 +0100
Subject: Remove duplicated IScenePresence.PresenceType. This is already in
ISceneAgent.PresenceType from which IScenePresence inherits.
No other code changes required.
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 2 --
1 file changed, 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Interfaces/IScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 3f68ee0..0fe681f 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -40,8 +40,6 @@ namespace OpenSim.Region.Framework.Interfaces
///
public interface IScenePresence : ISceneAgent
{
- PresenceType PresenceType { get; }
-
///
/// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail.
--
cgit v1.1