From 9e00e2ddecdafa489de0ae67b78cf6971e55fe80 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.
---
.../Region/Framework/Interfaces/IAttachmentsModule.cs | 2 +-
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 4 +++-
OpenSim/Region/Framework/Scenes/Scene.cs | 12 +-----------
.../Scenes/Serialization/SceneObjectSerializer.cs | 18 ++++++++++++++++++
4 files changed, 23 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 410eda0..11a13e1 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// The presence closing
/// Save changed attachments.
/// Save attachments with scripts even if they haven't changed.
- void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted);
+ void DeRezAttachments(IScenePresence sp);
///
/// Delete all the presence's attachments from the scene
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
+}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f501828..ad9e91d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3461,17 +3461,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (AttachmentsModule != null)
{
- // Don't save attachments for HG visitors, it
- // messes up their inventory. When a HG visitor logs
- // out on a foreign grid, their attachments will be
- // reloaded in the state they were in when they left
- // the home grid. This is best anyway as the visited
- // grid may use an incompatible script engine.
- bool saveChanged
- = avatar.PresenceType != PresenceType.Npc
- && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
-
- AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
+ AttachmentsModule.DeRezAttachments(avatar);
}
ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 2372d6b..0d292e7 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -151,6 +151,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
}
+ public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState)
+ {
+ using (StringWriter sw = new StringWriter())
+ {
+ using (XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
+
+ ToOriginalXmlFormat(sceneObject, writer, false, true);
+
+ writer.WriteRaw(scriptedState);
+
+ writer.WriteEndElement();
+ }
+ return sw.ToString();
+ }
+ }
+
///
/// Serialize a scene object to the original xml format
///
--
cgit v1.1