try to suspend and resume keyframes on copy to inventory to take copy

doesn't destroy state
avinationmerge
UbitUmarov 2013-06-06 19:21:21 +01:00
parent 8bfd5c8927
commit c173c2eed5
1 changed files with 12 additions and 1 deletions

View File

@ -359,13 +359,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
// this possible is not needed if keyframes are saved
Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
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);