From 416f39a561a08a92f0005495f0f804a07dc5b016 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 15:06:05 +0100 Subject: [PATCH] Implement KeyframedMotion selection behavior --- .../Region/Framework/Scenes/KeyframeMotion.cs | 31 +++++++++++++++++++ .../Framework/Scenes/Scene.PacketHandlers.cs | 6 ++-- .../Framework/Scenes/SceneObjectGroup.cs | 2 ++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 7f651aa765..5f9c8e9c68 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -72,6 +72,8 @@ namespace OpenSim.Region.Framework.Scenes private DataFormat m_data = DataFormat.Translation | DataFormat.Rotation; private bool m_running = false; + [NonSerialized()] + private bool m_selected = false; private int m_iterations = 0; @@ -82,6 +84,25 @@ namespace OpenSim.Region.Framework.Scenes get { return m_data; } } + public bool Selected + { + set + { + if (value) + { + // Once we're let go, recompute positions + if (m_selected) + UpdateSceneObject(m_group); + } + else + { + // Save selection position in case we get moved + if (!m_selected) + m_serializedPosition = tmp.AbsolutePosition; + } + m_selected = value; } + } + public static KeyframeMotion FromData(SceneObjectGroup grp, Byte[] data) { MemoryStream ms = new MemoryStream(data); @@ -276,6 +297,16 @@ namespace OpenSim.Region.Framework.Scenes m_currentFrame = m_frames[0]; } + if (m_selected) + { + if (m_group.RootPart.Velocity != Vector3.Zero) + { + m_group.RootPart.Velocity = Vector3.Zero; + m_group.SendGroupRootTerseUpdate(); + } + return; + } + // Do the frame processing double steps = (double)m_currentFrame.TimeMS / timerInterval; float complete = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index bf2e775ebd..b006045732 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -138,12 +138,12 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroup sog = part.ParentGroup; sog.SendPropertiesToClient(remoteClient); - sog.IsSelected = true; // A prim is only tainted if it's allowed to be edited by the person clicking it. if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) { + sog.IsSelected = true; EventManager.TriggerParcelPrimCountTainted(); } } @@ -215,7 +215,9 @@ namespace OpenSim.Region.Framework.Scenes // handled by group, but by prim. Legacy cruft. // TODO: Make selection flagging per prim! // - part.ParentGroup.IsSelected = false; + if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) + || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) + part.ParentGroup.IsSelected = false; if (part.ParentGroup.IsAttachment) isAttachment = true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ac2fe829cb..e509d4e36f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -726,6 +726,8 @@ namespace OpenSim.Region.Framework.Scenes child.PhysActor.Selected = value; } } + if (KeyframeMotion != null) + KeyframeMotion.Selected = value; } }