From 81ad9255b5f44d988bf37cfaf6dc59b05fd744b7 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 6 Jun 2013 03:03:05 +0100
Subject: Hook up Keyframe motion to almost everything. Failing to cross a sim
border may yield unexpected results in some cases. No database persistence
yet,
---
OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++++++
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 +++++++++++
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 13 +++++++++++++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 +++++++++++++++
.../Scenes/Serialization/SceneObjectSerializer.cs | 16 ++++++++++++++++
5 files changed, 64 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0743ce7..a9f8a85 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2364,6 +2364,12 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList)
{
+ if (part.KeyframeMotion != null)
+ {
+ part.KeyframeMotion.Delete();
+ part.KeyframeMotion = null;
+ }
+
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
{
PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
@@ -2705,6 +2711,9 @@ namespace OpenSim.Region.Framework.Scenes
// before we restart the scripts, or else some functions won't work.
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts();
+
+ if (newObject.RootPart.KeyframeMotion != null)
+ newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
}
// Do this as late as possible so that listeners have full access to the incoming object
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a84f6d3..bb7ae7f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1645,6 +1645,12 @@ namespace OpenSim.Region.Framework.Scenes
///
protected internal void LinkObjects(SceneObjectPart root, List children)
{
+ if (root.KeyframeMotion != null)
+ {
+ root.KeyframeMotion.Stop();
+ root.KeyframeMotion = null;
+ }
+
SceneObjectGroup parentGroup = root.ParentGroup;
if (parentGroup == null) return;
@@ -1722,6 +1728,11 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part != null)
{
+ if (part.KeyframeMotion != null)
+ {
+ part.KeyframeMotion.Stop();
+ part.KeyframeMotion = null;
+ }
if (part.ParentGroup.PrimCount != 1) // Skip single
{
if (part.LinkNum < 2) // Root
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index df23cc5..da80e4f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -455,6 +455,9 @@ namespace OpenSim.Region.Framework.Scenes
|| Scene.TestBorderCross(val, Cardinals.S))
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
{
+ if (m_rootPart.KeyframeMotion != null)
+ m_rootPart.KeyframeMotion.StartCrossingCheck();
+
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
}
}
@@ -578,6 +581,8 @@ namespace OpenSim.Region.Framework.Scenes
childPa.Selected = value;
}
}
+ if (RootPart.KeyframeMotion != null)
+ RootPart.KeyframeMotion.Selected = value;
}
}
@@ -1551,6 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes
newPart.DoPhysicsPropertyUpdate(originalPartPa.IsPhysical, true);
}
+ if (part.KeyframeMotion != null)
+ newPart.KeyframeMotion = part.KeyframeMotion.Copy(dupe);
}
if (userExposed)
@@ -1578,6 +1585,12 @@ namespace OpenSim.Region.Framework.Scenes
public void ScriptSetPhysicsStatus(bool usePhysics)
{
+ if (usePhysics)
+ {
+ if (RootPart.KeyframeMotion != null)
+ RootPart.KeyframeMotion.Stop();
+ RootPart.KeyframeMotion = null;
+ }
UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ea8c3c5..ff3f738 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -354,6 +354,13 @@ namespace OpenSim.Region.Framework.Scenes
private UUID m_collisionSound;
private float m_collisionSoundVolume;
+ private KeyframeMotion m_keyframeMotion = null;
+
+ public KeyframeMotion KeyframeMotion
+ {
+ get; set;
+ }
+
#endregion Fields
// ~SceneObjectPart()
@@ -1799,6 +1806,8 @@ namespace OpenSim.Region.Framework.Scenes
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP;
+ // safeguard actual copy is done in sog.copy
+ dupe.KeyframeMotion = null;
dupe.PayPrice = (int[])PayPrice.Clone();
dupe.DynAttrs.CopyFrom(DynAttrs);
@@ -2001,6 +2010,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (UsePhysics)
{
+ if (ParentGroup.RootPart.KeyframeMotion != null)
+ ParentGroup.RootPart.KeyframeMotion.Stop();
+ ParentGroup.RootPart.KeyframeMotion = null;
ParentGroup.Scene.AddPhysicalPrim(1);
pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
@@ -4327,6 +4339,9 @@ namespace OpenSim.Region.Framework.Scenes
if (isPhysical)
{
+ if (ParentGroup.RootPart.KeyframeMotion != null)
+ ParentGroup.RootPart.KeyframeMotion.Stop();
+ ParentGroup.RootPart.KeyframeMotion = null;
ParentGroup.Scene.AddPhysicalPrim(1);
pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 39420a6..3882b45 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -262,6 +262,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
sr.Close();
}
+ XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
+ if (keymotion.Count > 0)
+ sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
+ else
+ sceneObject.RootPart.KeyframeMotion = null;
+
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
sceneObject.LoadScriptState(doc);
@@ -1182,6 +1188,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
});
writer.WriteEndElement();
+
+ if (sog.RootPart.KeyframeMotion != null)
+ {
+ Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
+
+ writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
+ writer.WriteBase64(data, 0, data.Length);
+ writer.WriteEndElement();
+ }
+
writer.WriteEndElement();
}
--
cgit v1.1