From ddfff55cc76144607086fbca03c86df57a271ed0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 21:06:49 +0200 Subject: Preserve attachment data while a prim is in world. Allows attachment editing on the ground without losing attachpoint and position --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 1a7da61..1bf3a66 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -219,6 +219,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess 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; string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); @@ -516,6 +521,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess string xmlData = Utils.BytesToString(rezAsset.Data); SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); + Vector3 storedPosition = group.AbsolutePosition; group.RootPart.FromFolderID = item.Folder; @@ -635,6 +641,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { if (group.RootPart.Shape.PCode == (byte)PCode.Prim) { + // Save attachment data + group.RootPart.AttachPoint = group.RootPart.Shape.State; + group.RootPart.AttachOffset = storedPosition; + group.ClearPartAttachmentData(); } -- cgit v1.1