mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Preserve attachment point & position when attachment is rezzed in world
Patch taken from
http://opensimulator.org/mantis/view.php?id=4905
originally by Greg C.
Fixed to apply to r/23314 commit
ba9daf849e
(cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
This commit is contained in:
committed by
teravus
parent
a37c59b43e
commit
2dc92e7de1
@@ -422,6 +422,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// if the attachment point is the same as previous, make sure we get the saved
|
||||
// position info.
|
||||
if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
|
||||
{
|
||||
attachPos = group.RootPart.AttachedPos;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (attachmentPt == (uint)AttachmentPoint.Default)
|
||||
{
|
||||
@@ -429,6 +436,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
attachmentPt = group.AttachmentPoint;
|
||||
}
|
||||
|
||||
// if we didn't find an attach point, look for where it was last attached
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
|
||||
attachPos = group.RootPart.AttachedPos;
|
||||
group.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
@@ -619,6 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
so.ClearPartAttachmentData();
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
|
||||
so.HasGroupChanged = true;
|
||||
so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint;
|
||||
rootPart.Rezzed = DateTime.Now;
|
||||
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
so.AttachToBackup();
|
||||
@@ -1210,4 +1226,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -836,6 +836,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3");
|
||||
}
|
||||
|
||||
// if this was previously an attachment and is now being rezzed,
|
||||
// save the old attachment info.
|
||||
if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
|
||||
{
|
||||
group.RootPart.AttachedPos = group.AbsolutePosition;
|
||||
group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
// Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
|
||||
|
||||
Reference in New Issue
Block a user