From fca8c82232a42191270cb8d18dba6b54d382a2c2 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 26 Feb 2012 18:11:38 +0100
Subject: Move KeyframeMotion from SOG to SOP because we can't persist it any
other way because SOG doesn't technically exist in the DB
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 +++++++++
.../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++++++-------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 +++++++++---
.../Scenes/Serialization/SceneObjectSerializer.cs | 8 +++----
5 files changed, 38 insertions(+), 25 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c20da4b..11a41aa 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2421,8 +2421,8 @@ namespace OpenSim.Region.Framework.Scenes
if (newPosition != Vector3.Zero)
newObject.RootPart.GroupPosition = newPosition;
- if (newObject.KeyframeMotion != null)
- newObject.KeyframeMotion.UpdateSceneObject(newObject);
+ if (newObject.RootPart.KeyframeMotion != null)
+ newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
if (!AddSceneObject(newObject))
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 5a7f124..a320601 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1731,6 +1731,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;
@@ -1823,6 +1829,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 e509d4e..fefae9d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -114,12 +114,6 @@ namespace OpenSim.Region.Framework.Scenes
private Random m_rand;
private bool m_suspendUpdates;
private List m_linkedAvatars = new List();
- private KeyframeMotion m_keyframeMotion = null;
-
- public KeyframeMotion KeyframeMotion
- {
- get; set;
- }
public bool areUpdatesSuspended
{
@@ -726,8 +720,8 @@ namespace OpenSim.Region.Framework.Scenes
child.PhysActor.Selected = value;
}
}
- if (KeyframeMotion != null)
- KeyframeMotion.Selected = value;
+ if (RootPart.KeyframeMotion != null)
+ RootPart.KeyframeMotion.Selected = value;
}
}
@@ -1829,11 +1823,6 @@ namespace OpenSim.Region.Framework.Scenes
// Name, UUID, m_scene.RegionInfo.RegionName);
SceneObjectGroup backup_group = Copy(false);
- if (KeyframeMotion != null)
- {
- backup_group.KeyframeMotion = KeyframeMotion.FromData(backup_group, KeyframeMotion.Serialize());
- KeyframeMotion.UpdateSceneObject(this);
- }
backup_group.RootPart.Velocity = RootPart.Velocity;
backup_group.RootPart.Acceleration = RootPart.Acceleration;
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
@@ -1846,6 +1835,11 @@ namespace OpenSim.Region.Framework.Scenes
backup_group.ForEachPart(delegate(SceneObjectPart part)
{
+ if (part.KeyframeMotion != null)
+ {
+ part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize());
+ part.KeyframeMotion.UpdateSceneObject(this);
+ }
part.Inventory.ProcessInventoryBackup(datastore);
});
@@ -2001,9 +1995,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (usePhysics)
{
- if (KeyframeMotion != null)
- KeyframeMotion.Stop();
- KeyframeMotion = null;
+ 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 0728042..ea3d716 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -315,6 +315,14 @@ namespace OpenSim.Region.Framework.Scenes
private SOPVehicle m_vehicle = null;
+ private KeyframeMotion m_keyframeMotion = null;
+
+ public KeyframeMotion KeyframeMotion
+ {
+ get; set;
+ }
+
+
#endregion Fields
// ~SceneObjectPart()
@@ -1924,9 +1932,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (UsePhysics)
{
- if (ParentGroup.KeyframeMotion != null)
- ParentGroup.KeyframeMotion.Stop();
- ParentGroup.KeyframeMotion = null;
+ if (ParentGroup.RootPart.KeyframeMotion != null)
+ ParentGroup.RootPart.KeyframeMotion.Stop();
+ ParentGroup.RootPart.KeyframeMotion = null;
ParentGroup.Scene.AddPhysicalPrim(1);
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 118a63a..51a3320 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -246,9 +246,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
if (keymotion.Count > 0)
- sceneObject.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
+ sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
else
- sceneObject.KeyframeMotion = null;
+ sceneObject.RootPart.KeyframeMotion = null;
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
@@ -1174,9 +1174,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteEndElement();
- if (sog.KeyframeMotion != null)
+ if (sog.RootPart.KeyframeMotion != null)
{
- Byte[] data = sog.KeyframeMotion.Serialize();
+ Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
writer.WriteBase64(data, 0, data.Length);
--
cgit v1.1