Preserve attachment data while a prim is in world. Allows attachment

editing on the ground without losing attachpoint and position
avinationmerge
Melanie Thielker 2010-07-14 21:06:49 +02:00
parent d665f0ae66
commit ddfff55cc7
2 changed files with 18 additions and 0 deletions

View File

@ -219,6 +219,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
Vector3 originalPosition = objectGroup.AbsolutePosition; Vector3 originalPosition = objectGroup.AbsolutePosition;
// Restore attachment data after trip through the sim
if (objectGroup.RootPart.AttachPoint > 0)
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
objectGroup.AbsolutePosition = inventoryStoredPosition; objectGroup.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
@ -516,6 +521,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string xmlData = Utils.BytesToString(rezAsset.Data); string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group SceneObjectGroup group
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
Vector3 storedPosition = group.AbsolutePosition;
group.RootPart.FromFolderID = item.Folder; group.RootPart.FromFolderID = item.Folder;
@ -635,6 +641,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
if (group.RootPart.Shape.PCode == (byte)PCode.Prim) if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
{ {
// Save attachment data
group.RootPart.AttachPoint = group.RootPart.Shape.State;
group.RootPart.AttachOffset = storedPosition;
group.ClearPartAttachmentData(); group.ClearPartAttachmentData();
} }

View File

@ -182,6 +182,14 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore] [XmlIgnore]
public UUID FromFolderID; public UUID FromFolderID;
// The following two are to hold the attachment data
// while an object is inworld
[XmlIgnore]
public byte AttachPoint = 0;
[XmlIgnore]
public Vector3 AttachOffset = Vector3.Zero;
[XmlIgnore] [XmlIgnore]
public int STATUS_ROTATE_X; public int STATUS_ROTATE_X;