From c821153a4fcc0a0d806d2c9be63cf48494e4dd06 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 30 Aug 2012 00:15:46 +0100 Subject: [possible still bad] make use of keyframemotion.copy on sop.copy, replacing fromdata(seralize). for now its called with null group since sop.copy() hasn't usable new group information, so for copied keyframes be fully operational UpdateSceneObject(newgroup) needs to be called on them. --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 58 ++++++++++++---------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 12 +---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++ 3 files changed, 38 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 42e3860..e4e6f2c 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -112,20 +112,23 @@ namespace OpenSim.Region.Framework.Scenes public bool Selected { set - { - if (!value) - { - // Once we're let go, recompute positions - if (m_selected) - UpdateSceneObject(m_group); - } - else + { + if (m_group != null) { - // Save selection position in case we get moved - if (!m_selected) + if (!value) { - StopTimer(); - m_serializedPosition = m_group.AbsolutePosition; + // 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) + { + StopTimer(); + m_serializedPosition = m_group.AbsolutePosition; + } } } m_isCrossing = false; @@ -199,6 +202,9 @@ namespace OpenSim.Region.Framework.Scenes m_waitingCrossing = false; StopTimer(); + if (grp == null) + return; + m_group = grp; Vector3 grppos = grp.AbsolutePosition; Vector3 offset = grppos - m_serializedPosition; @@ -228,14 +234,16 @@ namespace OpenSim.Region.Framework.Scenes m_mode = mode; m_data = data; - m_onTimerLock = new object(); - m_group = grp; if (grp != null) { m_basePosition = grp.AbsolutePosition; m_baseRotation = grp.GroupRotation; } + + m_onTimerLock = new object(); + m_timerStopped = true; + m_inOnTimer = false; m_isCrossing = false; m_waitingCrossing = false; } @@ -249,18 +257,23 @@ namespace OpenSim.Region.Framework.Scenes { StopTimer(); - KeyframeMotion newmotion = new KeyframeMotion(newgrp, m_mode, m_data); + KeyframeMotion newmotion = new KeyframeMotion(null, m_mode, m_data); - if (newgrp != null && newgrp.IsSelected) - newmotion.m_selected = true; + newmotion.m_group = newgrp; if (m_keyframes != null) + { + newmotion.m_keyframes = new Keyframe[m_keyframes.Length]; m_keyframes.CopyTo(newmotion.m_keyframes, 0); + } newmotion.m_frames = new List(m_frames); + + newmotion.m_basePosition = m_basePosition; + newmotion.m_baseRotation = m_baseRotation; + newmotion.m_currentFrame = m_currentFrame; - newmotion.m_nextPosition = m_nextPosition; if (m_selected) newmotion.m_serializedPosition = m_serializedPosition; else @@ -272,12 +285,7 @@ namespace OpenSim.Region.Framework.Scenes } newmotion.m_iterations = m_iterations; - - newmotion.m_onTimerLock = new object(); - newmotion.m_timerStopped = false; - newmotion.m_inOnTimer = false; - newmotion.m_isCrossing = false; - newmotion.m_waitingCrossing = false; + newmotion.m_running = m_running; if (m_running && !m_waitingCrossing) StartTimer(); @@ -299,7 +307,7 @@ namespace OpenSim.Region.Framework.Scenes { m_isCrossing = false; m_waitingCrossing = false; - if (m_keyframes.Length > 0) + if (m_keyframes != null && m_group != null && m_keyframes.Length > 0) { if (m_timer == null) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 834d27b..fe34ad4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2062,6 +2062,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChangedDueToDelink = false; m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); +/* backup_group.ForEachPart(delegate(SceneObjectPart part) { if (part.KeyframeMotion != null) @@ -2070,7 +2071,7 @@ namespace OpenSim.Region.Framework.Scenes // part.KeyframeMotion.UpdateSceneObject(this); } }); - +*/ datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); backup_group.ForEachPart(delegate(SceneObjectPart part) @@ -4415,15 +4416,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual ISceneObject CloneForNewScene() { SceneObjectGroup sog = Copy(false); - sog.ForEachPart(delegate(SceneObjectPart part) - { - if (part.KeyframeMotion != null) - { - part.KeyframeMotion = KeyframeMotion.FromData(sog, part.KeyframeMotion.Serialize()); - // this is called later -// part.KeyframeMotion.UpdateSceneObject(this); - } - }); sog.IsDeleted = false; return sog; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bf5fc99..4788a24 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2110,6 +2110,9 @@ namespace OpenSim.Region.Framework.Scenes Array.Copy(Shape.ExtraParams, extraP, extraP.Length); dupe.Shape.ExtraParams = extraP; + if (KeyframeMotion != null) + dupe.KeyframeMotion = KeyframeMotion.Copy(null); + if (userExposed) { if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) -- cgit v1.1