Hook up Keyframe motion to almost everything. Failing to cross a sim border

may yield unexpected results in some cases. No database persistence yet,
This commit is contained in:
Melanie
2013-06-06 03:03:05 +01:00
parent e1d98c9e4c
commit 81ad9255b5
11 changed files with 229 additions and 0 deletions

View File

@@ -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

View File

@@ -1645,6 +1645,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="childPrims"></param>
protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> 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

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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();
}