From c173c2eed52d20916bcafd2b1b6d4a1a24c46105 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Jun 2013 19:21:21 +0100 Subject: [PATCH] try to suspend and resume keyframes on copy to inventory to take copy doesn't destroy state --- .../InventoryAccess/InventoryAccessModule.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 4c111352c3..a606d76958 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -359,13 +359,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); Dictionary originalPositions = new Dictionary(); + // this possible is not needed if keyframes are saved + Dictionary originalKeyframes = new Dictionary(); foreach (SceneObjectGroup objectGroup in objlist) { if (objectGroup.RootPart.KeyframeMotion != null) - objectGroup.RootPart.KeyframeMotion.Stop(); + { + objectGroup.RootPart.KeyframeMotion.Suspend(); + } objectGroup.RootPart.SetForce(Vector3.Zero); objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); + + originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; objectGroup.RootPart.KeyframeMotion = null; Vector3 inventoryStoredPosition = new Vector3 @@ -425,7 +431,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // Restore the position of each group now that it has been stored to inventory. foreach (SceneObjectGroup objectGroup in objlist) + { objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; + objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; + if (objectGroup.RootPart.KeyframeMotion != null) + objectGroup.RootPart.KeyframeMotion.Resume(); + } InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);