After an object with KeyframeMotion is copied into inventory, resume the motion (previously it remained stopped)

0.8.0.3
Oren Hurvitz 2013-11-25 19:22:53 +02:00 committed by Justin Clark-Casey (justincc)
parent 932c9e757b
commit 120f872d2b
1 changed files with 15 additions and 2 deletions

View File

@ -355,11 +355,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
// Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); // Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>();
foreach (SceneObjectGroup objectGroup in objlist) foreach (SceneObjectGroup objectGroup in objlist)
{ {
if (objectGroup.RootPart.KeyframeMotion != null) if (objectGroup.RootPart.KeyframeMotion != null)
objectGroup.RootPart.KeyframeMotion.Stop(); {
objectGroup.RootPart.KeyframeMotion = null; objectGroup.RootPart.KeyframeMotion.Pause();
group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion);
objectGroup.RootPart.KeyframeMotion = null;
}
// Vector3 inventoryStoredPosition = new Vector3 // Vector3 inventoryStoredPosition = new Vector3
// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) // (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
// ? 250 // ? 250
@ -477,6 +483,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
} }
// Restore KeyframeMotion
foreach (SceneObjectGroup objectGroup in group2Keyframe.Keys)
{
objectGroup.RootPart.KeyframeMotion = group2Keyframe[objectGroup];
objectGroup.RootPart.KeyframeMotion.Start();
}
// This is a hook to do some per-asset post-processing for subclasses that need that // This is a hook to do some per-asset post-processing for subclasses that need that
if (remoteClient != null) if (remoteClient != null)
ExportAsset(remoteClient.AgentId, asset.FullID); ExportAsset(remoteClient.AgentId, asset.FullID);