diff options
author | Melanie | 2012-02-02 01:04:54 +0100 |
---|---|---|
committer | Melanie | 2012-02-02 01:04:54 +0100 |
commit | e5ae84b42b453feb2cf835d1c8cd91f5195dd250 (patch) | |
tree | 4d07e1cba6bfb4e496de426f8591d1aba385d46d /OpenSim/Region/CoreModules/Avatar | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-e5ae84b42b453feb2cf835d1c8cd91f5195dd250.zip opensim-SC-e5ae84b42b453feb2cf835d1c8cd91f5195dd250.tar.gz opensim-SC-e5ae84b42b453feb2cf835d1c8cd91f5195dd250.tar.bz2 opensim-SC-e5ae84b42b453feb2cf835d1c8cd91f5195dd250.tar.xz |
Re-Add the reading of attachment data hat was lost in the merge
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f7e3a59..5ca2ce4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Region.Framework; | |||
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Scenes.Serialization; | 41 | using OpenSim.Region.Framework.Scenes.Serialization; |
42 | using OpenSim.Services.Interfaces; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 44 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
44 | { | 45 | { |
@@ -116,6 +117,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
116 | 117 | ||
117 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); | 118 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); |
118 | 119 | ||
120 | XmlDocument doc = new XmlDocument(); | ||
121 | string stateData = String.Empty; | ||
122 | |||
123 | IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>(); | ||
124 | if (attServ != null) | ||
125 | { | ||
126 | m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); | ||
127 | stateData = attServ.Get(sp.UUID.ToString()); | ||
128 | if (stateData != String.Empty) | ||
129 | { | ||
130 | try | ||
131 | { | ||
132 | doc.LoadXml(stateData); | ||
133 | } | ||
134 | catch { } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | Dictionary<UUID, string> itemData = new Dictionary<UUID, string>(); | ||
139 | |||
140 | XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); | ||
141 | if (nodes.Count > 0) | ||
142 | { | ||
143 | foreach (XmlNode n in nodes) | ||
144 | { | ||
145 | XmlElement elem = (XmlElement)n; | ||
146 | string itemID = elem.GetAttribute("ItemID"); | ||
147 | string xml = elem.InnerXml; | ||
148 | |||
149 | itemData[new UUID(itemID)] = xml; | ||
150 | } | ||
151 | } | ||
152 | |||
153 | |||
119 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); | 154 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); |
120 | foreach (AvatarAttachment attach in attachments) | 155 | foreach (AvatarAttachment attach in attachments) |
121 | { | 156 | { |
@@ -135,12 +170,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
135 | 170 | ||
136 | try | 171 | try |
137 | { | 172 | { |
173 | string xmlData; | ||
174 | XmlDocument d = null; | ||
175 | UUID asset; | ||
176 | if (itemData.TryGetValue(attach.ItemID, out xmlData)) | ||
177 | { | ||
178 | d = new XmlDocument(); | ||
179 | d.LoadXml(xmlData); | ||
180 | m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID); | ||
181 | } | ||
182 | |||
138 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 183 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
139 | // inventory right now. | 184 | // inventory right now. |
140 | if (sp.PresenceType == PresenceType.Npc) | 185 | if (sp.PresenceType == PresenceType.Npc) |
141 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); | 186 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); |
142 | else | 187 | else |
143 | RezSingleAttachmentFromInventory(sp, attach.ItemID, p); | 188 | RezSingleAttachmentFromInventory(sp, attach.ItemID, p, true, d); |
144 | } | 189 | } |
145 | catch (Exception e) | 190 | catch (Exception e) |
146 | { | 191 | { |