aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-27 00:41:46 +0100
committerJustin Clark-Casey (justincc)2012-06-27 00:41:46 +0100
commitd0432133172f4147f7401f214c703611978423cd (patch)
tree3677b37a4525fc5165c5b5378abe9fbff671aa0e /OpenSim/Region/CoreModules/Avatar/Attachments
parentAutomatically disable log4net before each regression test so that logging is ... (diff)
downloadopensim-SC_OLD-d0432133172f4147f7401f214c703611978423cd.zip
opensim-SC_OLD-d0432133172f4147f7401f214c703611978423cd.tar.gz
opensim-SC_OLD-d0432133172f4147f7401f214c703611978423cd.tar.bz2
opensim-SC_OLD-d0432133172f4147f7401f214c703611978423cd.tar.xz
refactor: Move ScenePresence <-> AgentData attachments copying code into AttachmentsModule.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2b0e4ab..4a7fbce 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -100,6 +100,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
100 100
101 #region IAttachmentsModule 101 #region IAttachmentsModule
102 102
103 public void CopyAttachments(IScenePresence sp, AgentData ad)
104 {
105 lock (sp.AttachmentsSyncLock)
106 {
107 // Attachment objects
108 List<SceneObjectGroup> attachments = sp.GetAttachments();
109 if (attachments.Count > 0)
110 {
111 ad.AttachmentObjects = new List<ISceneObject>();
112 ad.AttachmentObjectStates = new List<string>();
113 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
114 sp.InTransitScriptStates.Clear();
115
116 foreach (SceneObjectGroup sog in attachments)
117 {
118 // We need to make a copy and pass that copy
119 // because of transfers withn the same sim
120 ISceneObject clone = sog.CloneForNewScene();
121 // Attachment module assumes that GroupPosition holds the offsets...!
122 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
123 ((SceneObjectGroup)clone).IsAttachment = false;
124 ad.AttachmentObjects.Add(clone);
125 string state = sog.GetStateSnapshot();
126 ad.AttachmentObjectStates.Add(state);
127 sp.InTransitScriptStates.Add(state);
128 // Let's remove the scripts of the original object here
129 sog.RemoveScriptInstances(true);
130 }
131 }
132 }
133 }
134
135 public void CopyAttachments(AgentData ad, IScenePresence sp)
136 {
137 if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0)
138 {
139 lock (sp.AttachmentsSyncLock)
140 sp.ClearAttachments();
141
142 int i = 0;
143 foreach (ISceneObject so in ad.AttachmentObjects)
144 {
145 ((SceneObjectGroup)so).LocalId = 0;
146 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
147 so.SetState(ad.AttachmentObjectStates[i++], m_scene);
148 m_scene.IncomingCreateObject(Vector3.Zero, so);
149 }
150 }
151 }
152
103 /// <summary> 153 /// <summary>
104 /// RezAttachments. This should only be called upon login on the first region. 154 /// RezAttachments. This should only be called upon login on the first region.
105 /// Attachment rezzings on crossings and TPs are done in a different way. 155 /// Attachment rezzings on crossings and TPs are done in a different way.