diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1f49a015da..360a0145ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -484,6 +484,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } + public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) + { + // First we save the + // attachment point information, then we update the relative + // positioning. Then we have to mark the object as NOT an + // attachment. This is necessary in order to correctly save + // and retrieve GroupPosition information for the attachment. + // Finally, we restore the object's attachment status. + byte attachmentPoint = sog.GetAttachmentPoint(); + sog.UpdateGroupPosition(pos); + sog.RootPart.IsAttachment = false; + sog.AbsolutePosition = sog.RootPart.AttachedPos; + sog.SetAttachmentPoint(attachmentPoint); + sog.HasGroupChanged = true; + } + /// /// Update the attachment asset for the new sog details if they have changed. /// diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index b3576c5c73..6cc64c6113 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -113,14 +113,17 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Update the user inventory to show a detach. /// - /// - /// A - /// - /// - /// A - /// + /// /param> + /// void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); + /// + /// Update the position of an attachment. + /// + /// + /// + void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos); + /// /// Update the user inventory with a changed attachment /// diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 78e5da3afc..a2ed54ff9b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1281,13 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { - // Set the new attachment point data in the object - byte attachmentPoint = group.GetAttachmentPoint(); - group.UpdateGroupPosition(pos); - group.RootPart.IsAttachment = false; - group.AbsolutePosition = group.RootPart.AttachedPos; - group.SetAttachmentPoint(attachmentPoint); - group.HasGroupChanged = true; + if (m_parentScene.AttachmentsModule != null) + m_parentScene.AttachmentsModule.UpdateAttachmentPosition(group, pos); } else {