reinstate IAttachmentsModule.UpdateAttachmentPosition() since this is being used by a 3rd party region module and contains non-obvious attachment specific code

There are no functional changes.  UpdateAttachmentPosition() is adapted to the new approach of only saving attachment state on logout
viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2010-12-14 00:11:41 +00:00
parent 7f0350b988
commit e62b3dba8a
3 changed files with 27 additions and 13 deletions

View File

@ -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;
}
/// <summary> /// <summary>
/// Update the attachment asset for the new sog details if they have changed. /// Update the attachment asset for the new sog details if they have changed.
/// </summary> /// </summary>

View File

@ -113,14 +113,17 @@ namespace OpenSim.Region.Framework.Interfaces
/// <summary> /// <summary>
/// Update the user inventory to show a detach. /// Update the user inventory to show a detach.
/// </summary> /// </summary>
/// <param name="itemID"> /// <param name="itemID">/param>
/// A <see cref="UUID"/> /// <param name="remoteClient"></param>
/// </param>
/// <param name="remoteClient">
/// A <see cref="IClientAPI"/>
/// </param>
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
/// <summary>
/// Update the position of an attachment.
/// </summary>
/// <param name="sog"></param>
/// <param name="pos"></param>
void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos);
/// <summary> /// <summary>
/// Update the user inventory with a changed attachment /// Update the user inventory with a changed attachment
/// </summary> /// </summary>

View File

@ -1281,13 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{ {
// Set the new attachment point data in the object if (m_parentScene.AttachmentsModule != null)
byte attachmentPoint = group.GetAttachmentPoint(); m_parentScene.AttachmentsModule.UpdateAttachmentPosition(group, pos);
group.UpdateGroupPosition(pos);
group.RootPart.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
group.SetAttachmentPoint(attachmentPoint);
group.HasGroupChanged = true;
} }
else else
{ {