diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 149 |
2 files changed, 111 insertions, 83 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c05ef3c..54cff55 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -198,31 +198,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted) | 201 | public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted) |
202 | { | 202 | { |
203 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | ||
204 | |||
205 | if (!Enabled) | 203 | if (!Enabled) |
206 | return; | 204 | return; |
207 | 205 | ||
208 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 206 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); |
207 | |||
208 | lock (sp.AttachmentsSyncLock) | ||
209 | { | 209 | { |
210 | grp.IsAttachment = false; | 210 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
211 | grp.AbsolutePosition = grp.RootPart.AttachedPos; | 211 | { |
212 | UpdateKnownItem(sp, grp, saveAllScripted); | 212 | grp.Scene.DeleteSceneObject(grp, false); |
213 | grp.IsAttachment = true; | 213 | |
214 | if (saveChanged || saveAllScripted) | ||
215 | { | ||
216 | grp.IsAttachment = false; | ||
217 | grp.AbsolutePosition = grp.RootPart.AttachedPos; | ||
218 | UpdateKnownItem(sp, grp, saveAllScripted); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | sp.ClearAttachments(); | ||
214 | } | 223 | } |
215 | } | 224 | } |
216 | 225 | ||
217 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) | 226 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) |
218 | { | 227 | { |
219 | // m_log.DebugFormat( | ||
220 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | ||
221 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | ||
222 | |||
223 | if (!Enabled) | 228 | if (!Enabled) |
224 | return; | 229 | return; |
225 | 230 | ||
231 | // m_log.DebugFormat( | ||
232 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | ||
233 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | ||
234 | |||
226 | foreach (SceneObjectGroup sop in sp.GetAttachments()) | 235 | foreach (SceneObjectGroup sop in sp.GetAttachments()) |
227 | { | 236 | { |
228 | sop.Scene.DeleteSceneObject(sop, silent); | 237 | sop.Scene.DeleteSceneObject(sop, silent); |
@@ -477,17 +486,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
477 | if (!Enabled) | 486 | if (!Enabled) |
478 | return; | 487 | return; |
479 | 488 | ||
480 | // First we save the | ||
481 | // attachment point information, then we update the relative | ||
482 | // positioning. Then we have to mark the object as NOT an | ||
483 | // attachment. This is necessary in order to correctly save | ||
484 | // and retrieve GroupPosition information for the attachment. | ||
485 | // Finally, we restore the object's attachment status. | ||
486 | uint attachmentPoint = sog.AttachmentPoint; | ||
487 | sog.UpdateGroupPosition(pos); | 489 | sog.UpdateGroupPosition(pos); |
488 | sog.IsAttachment = false; | ||
489 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
490 | sog.AttachmentPoint = attachmentPoint; | ||
491 | sog.HasGroupChanged = true; | 490 | sog.HasGroupChanged = true; |
492 | } | 491 | } |
493 | 492 | ||
@@ -770,6 +769,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
770 | { | 769 | { |
771 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 770 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
772 | sp.RemoveAttachment(group); | 771 | sp.RemoveAttachment(group); |
772 | m_scene.DeleteSceneObject(group, false); | ||
773 | 773 | ||
774 | // Prepare sog for storage | 774 | // Prepare sog for storage |
775 | group.AttachedAvatar = UUID.Zero; | 775 | group.AttachedAvatar = UUID.Zero; |
@@ -778,7 +778,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
778 | group.AbsolutePosition = group.RootPart.AttachedPos; | 778 | group.AbsolutePosition = group.RootPart.AttachedPos; |
779 | 779 | ||
780 | UpdateKnownItem(sp, group, true); | 780 | UpdateKnownItem(sp, group, true); |
781 | m_scene.DeleteSceneObject(group, false); | ||
782 | 781 | ||
783 | return; | 782 | return; |
784 | } | 783 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index acf0089..8969006 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -58,6 +58,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
58 | private AttachmentsModule m_attMod; | 58 | private AttachmentsModule m_attMod; |
59 | private ScenePresence m_presence; | 59 | private ScenePresence m_presence; |
60 | 60 | ||
61 | /// <summary> | ||
62 | /// Standard user ID | ||
63 | /// </summary> | ||
64 | private UUID m_userId = TestHelpers.ParseTail(0x1); | ||
65 | |||
66 | // /// <summary> | ||
67 | // /// Standard attachment item ID | ||
68 | // /// </summary> | ||
69 | // private UUID m_attItemId = TestHelpers.ParseTail(0x10); | ||
70 | // | ||
71 | // /// <summary> | ||
72 | // /// Standard attachment asset ID | ||
73 | // /// </summary> | ||
74 | // private UUID m_attAssetId = TestHelpers.ParseTail(0x11); | ||
75 | |||
61 | [TestFixtureSetUp] | 76 | [TestFixtureSetUp] |
62 | public void FixtureInit() | 77 | public void FixtureInit() |
63 | { | 78 | { |
@@ -86,13 +101,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
86 | } | 101 | } |
87 | 102 | ||
88 | /// <summary> | 103 | /// <summary> |
89 | /// Add the standard presence for a test. | 104 | /// Creates an attachment item in the given user's inventory. Does not attach. |
90 | /// </summary> | 105 | /// </summary> |
91 | private void AddPresence() | 106 | /// <remarks> |
107 | /// A user with the given ID and an inventory must already exist. | ||
108 | /// </remarks> | ||
109 | /// <returns> | ||
110 | /// The attachment item. | ||
111 | /// </returns> | ||
112 | /// <param name='userId'></param> | ||
113 | /// <param name='attName'></param> | ||
114 | /// <param name='rawItemId'></param> | ||
115 | /// <param name='rawAssetId'></param> | ||
116 | private InventoryItemBase CreateAttachmentItem(UUID userId, string attName, int rawItemId, int rawAssetId) | ||
92 | { | 117 | { |
93 | UUID userId = TestHelpers.ParseTail(0x1); | 118 | return UserInventoryHelpers.CreateInventoryItem( |
94 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | 119 | scene, |
95 | m_presence = SceneHelpers.AddScenePresence(scene, userId); | 120 | attName, |
121 | TestHelpers.ParseTail(rawItemId), | ||
122 | TestHelpers.ParseTail(rawAssetId), | ||
123 | userId, | ||
124 | InventoryType.Object); | ||
96 | } | 125 | } |
97 | 126 | ||
98 | [Test] | 127 | [Test] |
@@ -101,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
101 | TestHelpers.InMethod(); | 130 | TestHelpers.InMethod(); |
102 | // TestHelpers.EnableLogging(); | 131 | // TestHelpers.EnableLogging(); |
103 | 132 | ||
104 | AddPresence(); | 133 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
134 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | ||
135 | |||
105 | string attName = "att"; | 136 | string attName = "att"; |
106 | 137 | ||
107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; | 138 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; |
@@ -140,24 +171,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
140 | TestHelpers.InMethod(); | 171 | TestHelpers.InMethod(); |
141 | // log4net.Config.XmlConfigurator.Configure(); | 172 | // log4net.Config.XmlConfigurator.Configure(); |
142 | 173 | ||
143 | AddPresence(); | 174 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
144 | 175 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | |
145 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
146 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
147 | string attName = "att"; | ||
148 | 176 | ||
149 | UserInventoryHelpers.CreateInventoryItem( | 177 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); |
150 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
151 | 178 | ||
152 | m_attMod.RezSingleAttachmentFromInventory( | 179 | m_attMod.RezSingleAttachmentFromInventory( |
153 | m_presence, attItemId, (uint)AttachmentPoint.Chest); | 180 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); |
154 | 181 | ||
155 | // Check scene presence status | 182 | // Check scene presence status |
156 | Assert.That(m_presence.HasAttachments(), Is.True); | 183 | Assert.That(m_presence.HasAttachments(), Is.True); |
157 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); | 184 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); |
158 | Assert.That(attachments.Count, Is.EqualTo(1)); | 185 | Assert.That(attachments.Count, Is.EqualTo(1)); |
159 | SceneObjectGroup attSo = attachments[0]; | 186 | SceneObjectGroup attSo = attachments[0]; |
160 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 187 | Assert.That(attSo.Name, Is.EqualTo(attItem.Name)); |
161 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | 188 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); |
162 | Assert.That(attSo.IsAttachment); | 189 | Assert.That(attSo.IsAttachment); |
163 | Assert.That(attSo.UsesPhysics, Is.False); | 190 | Assert.That(attSo.UsesPhysics, Is.False); |
@@ -165,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
165 | 192 | ||
166 | // Check appearance status | 193 | // Check appearance status |
167 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1)); | 194 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1)); |
168 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); | 195 | Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
169 | } | 196 | } |
170 | 197 | ||
171 | [Test] | 198 | [Test] |
@@ -174,17 +201,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
174 | TestHelpers.InMethod(); | 201 | TestHelpers.InMethod(); |
175 | // log4net.Config.XmlConfigurator.Configure(); | 202 | // log4net.Config.XmlConfigurator.Configure(); |
176 | 203 | ||
177 | AddPresence(); | 204 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
178 | 205 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | |
179 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
180 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
181 | string attName = "att"; | ||
182 | 206 | ||
183 | UserInventoryHelpers.CreateInventoryItem( | 207 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); |
184 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
185 | 208 | ||
186 | ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory( | 209 | ISceneEntity so |
187 | m_presence, attItemId, (uint)AttachmentPoint.Chest); | 210 | = m_attMod.RezSingleAttachmentFromInventory( |
211 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); | ||
188 | m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId); | 212 | m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId); |
189 | 213 | ||
190 | // Check scene presence status | 214 | // Check scene presence status |
@@ -196,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
196 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0)); | 220 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0)); |
197 | 221 | ||
198 | // Check item status | 222 | // Check item status |
199 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null); | 223 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); |
200 | 224 | ||
201 | // Check object in scene | 225 | // Check object in scene |
202 | Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); | 226 | Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); |
@@ -208,18 +232,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
208 | TestHelpers.InMethod(); | 232 | TestHelpers.InMethod(); |
209 | // log4net.Config.XmlConfigurator.Configure(); | 233 | // log4net.Config.XmlConfigurator.Configure(); |
210 | 234 | ||
211 | AddPresence(); | 235 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
212 | 236 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | |
213 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
214 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
215 | string attName = "att"; | ||
216 | 237 | ||
217 | UserInventoryHelpers.CreateInventoryItem( | 238 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); |
218 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
219 | 239 | ||
220 | m_attMod.RezSingleAttachmentFromInventory( | 240 | m_attMod.RezSingleAttachmentFromInventory( |
221 | m_presence, attItemId, (uint)AttachmentPoint.Chest); | 241 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); |
222 | m_attMod.DetachSingleAttachmentToInv(m_presence, attItemId); | 242 | m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID); |
223 | 243 | ||
224 | // Check status on scene presence | 244 | // Check status on scene presence |
225 | Assert.That(m_presence.HasAttachments(), Is.False); | 245 | Assert.That(m_presence.HasAttachments(), Is.False); |
@@ -227,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
227 | Assert.That(attachments.Count, Is.EqualTo(0)); | 247 | Assert.That(attachments.Count, Is.EqualTo(0)); |
228 | 248 | ||
229 | // Check item status | 249 | // Check item status |
230 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0)); | 250 | Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); |
231 | } | 251 | } |
232 | 252 | ||
233 | /// <summary> | 253 | /// <summary> |
@@ -239,17 +259,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
239 | TestHelpers.InMethod(); | 259 | TestHelpers.InMethod(); |
240 | // log4net.Config.XmlConfigurator.Configure(); | 260 | // log4net.Config.XmlConfigurator.Configure(); |
241 | 261 | ||
242 | UUID userId = TestHelpers.ParseTail(0x1); | 262 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
243 | UUID attItemId = TestHelpers.ParseTail(0x2); | 263 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); |
244 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
245 | string attName = "att"; | ||
246 | |||
247 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | ||
248 | InventoryItemBase attItem | ||
249 | = UserInventoryHelpers.CreateInventoryItem( | ||
250 | scene, attName, attItemId, attAssetId, userId, InventoryType.Object); | ||
251 | 264 | ||
252 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | 265 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); |
253 | acd.Appearance = new AvatarAppearance(); | 266 | acd.Appearance = new AvatarAppearance(); |
254 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 267 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
255 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 268 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
@@ -268,17 +281,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
268 | TestHelpers.InMethod(); | 281 | TestHelpers.InMethod(); |
269 | // log4net.Config.XmlConfigurator.Configure(); | 282 | // log4net.Config.XmlConfigurator.Configure(); |
270 | 283 | ||
271 | UUID userId = TestHelpers.ParseTail(0x1); | 284 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
272 | UUID attItemId = TestHelpers.ParseTail(0x2); | 285 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); |
273 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
274 | string attName = "att"; | ||
275 | 286 | ||
276 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | 287 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); |
277 | InventoryItemBase attItem | ||
278 | = UserInventoryHelpers.CreateInventoryItem( | ||
279 | scene, attName, attItemId, attAssetId, userId, InventoryType.Object); | ||
280 | |||
281 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
282 | acd.Appearance = new AvatarAppearance(); | 288 | acd.Appearance = new AvatarAppearance(); |
283 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 289 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
284 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 290 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
@@ -288,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
288 | 294 | ||
289 | Assert.That(attachments.Count, Is.EqualTo(1)); | 295 | Assert.That(attachments.Count, Is.EqualTo(1)); |
290 | SceneObjectGroup attSo = attachments[0]; | 296 | SceneObjectGroup attSo = attachments[0]; |
291 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 297 | Assert.That(attSo.Name, Is.EqualTo(attItem.Name)); |
292 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | 298 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); |
293 | Assert.That(attSo.IsAttachment); | 299 | Assert.That(attSo.IsAttachment); |
294 | Assert.That(attSo.UsesPhysics, Is.False); | 300 | Assert.That(attSo.UsesPhysics, Is.False); |
@@ -298,9 +304,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
298 | List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments(); | 304 | List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments(); |
299 | Assert.That(retreivedAttachments.Count, Is.EqualTo(1)); | 305 | Assert.That(retreivedAttachments.Count, Is.EqualTo(1)); |
300 | Assert.That(retreivedAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest)); | 306 | Assert.That(retreivedAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest)); |
301 | Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItemId)); | 307 | Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID)); |
302 | Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attAssetId)); | 308 | Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID)); |
303 | Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); | 309 | Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
310 | } | ||
311 | |||
312 | [Test] | ||
313 | public void TestUpdateAttachmentPosition() | ||
314 | { | ||
315 | TestHelpers.InMethod(); | ||
316 | |||
317 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | ||
318 | InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20); | ||
319 | |||
320 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); | ||
321 | acd.Appearance = new AvatarAppearance(); | ||
322 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | ||
323 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd); | ||
324 | |||
325 | SceneObjectGroup attSo = sp.GetAttachments()[0]; | ||
326 | |||
327 | Vector3 newPosition = new Vector3(1, 2, 4); | ||
328 | |||
329 | scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient); | ||
330 | |||
331 | Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition)); | ||
332 | Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition)); | ||
304 | } | 333 | } |
305 | 334 | ||
306 | // I'm commenting this test because scene setup NEEDS InventoryService to | 335 | // I'm commenting this test because scene setup NEEDS InventoryService to |