aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments
diff options
context:
space:
mode:
authorMelanie2012-06-04 21:05:56 +0200
committerMelanie2012-06-04 21:05:56 +0200
commit28e5abd9176aeba3b5004d07748ae88cccbcd57a (patch)
tree77df0dc831f32e55059c5f7f582ed7e66bc35284 /OpenSim/Region/CoreModules/Avatar/Attachments
parentWhen regions are set to shut down the instance, always send notifications to (diff)
downloadopensim-SC_OLD-28e5abd9176aeba3b5004d07748ae88cccbcd57a.zip
opensim-SC_OLD-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.gz
opensim-SC_OLD-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.bz2
opensim-SC_OLD-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.xz
Fix llAttachToAvatar and "Attach" viewer option to preserve saved attach positions.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
2 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index d7c7283..fd7cad2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
227 sp.ClearAttachments(); 227 sp.ClearAttachments();
228 } 228 }
229 229
230 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 230 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData)
231 { 231 {
232 lock (sp.AttachmentsSyncLock) 232 lock (sp.AttachmentsSyncLock)
233 { 233 {
@@ -273,9 +273,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
273 attachPos = Vector3.Zero; 273 attachPos = Vector3.Zero;
274 } 274 }
275 275
276 if (useAttachData)
277 {
278 group.RootPart.RotationOffset = group.RootPart.AttachRotation;
279 attachPos = group.RootPart.AttachOffset;
280 if (attachmentPt == 0)
281 {
282 attachmentPt = group.RootPart.AttachPoint;
283 if (attachmentPt == 0)
284 {
285 attachmentPt = (uint)AttachmentPoint.LeftHand;
286 attachPos = Vector3.Zero;
287 }
288 }
289 else if (group.RootPart.AttachPoint != attachmentPt)
290 {
291 attachPos = Vector3.Zero;
292 }
293 }
276 group.AttachmentPoint = attachmentPt; 294 group.AttachmentPoint = attachmentPt;
277 group.AbsolutePosition = attachPos; 295 group.AbsolutePosition = attachPos;
278 296
279 // We also don't want to do any of the inventory operations for an NPC. 297 // We also don't want to do any of the inventory operations for an NPC.
280 if (sp.PresenceType != PresenceType.Npc) 298 if (sp.PresenceType != PresenceType.Npc)
281 { 299 {
@@ -792,7 +810,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
792 // This will throw if the attachment fails 810 // This will throw if the attachment fails
793 try 811 try
794 { 812 {
795 AttachObject(sp, objatt, attachmentPt, false); 813 AttachObject(sp, objatt, attachmentPt, false, false);
796 } 814 }
797 catch (Exception e) 815 catch (Exception e)
798 { 816 {
@@ -947,7 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
947 AttachmentPt &= 0x7f; 965 AttachmentPt &= 0x7f;
948 966
949 // Calls attach with a Zero position 967 // Calls attach with a Zero position
950 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) 968 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true))
951 { 969 {
952 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); 970 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
953 971
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index bfe5e4a..7119ad2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
106 106
107 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; 107 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
108 108
109 m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); 109 m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false, false);
110 110
111 // Check status on scene presence 111 // Check status on scene presence
112 Assert.That(m_presence.HasAttachments(), Is.True); 112 Assert.That(m_presence.HasAttachments(), Is.True);
@@ -317,4 +317,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
317// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 317// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
318// } 318// }
319 } 319 }
320} \ No newline at end of file 320}