aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2013-06-06 03:03:05 +0100
committerMelanie2013-06-06 03:03:05 +0100
commit81ad9255b5f44d988bf37cfaf6dc59b05fd744b7 (patch)
tree201e5f412c3f12e0f94424362fffb0c635343af3 /OpenSim/Region/Framework
parentCommitting Avination's Keyframe module. This is not hooked up yet and will do... (diff)
downloadopensim-SC_OLD-81ad9255b5f44d988bf37cfaf6dc59b05fd744b7.zip
opensim-SC_OLD-81ad9255b5f44d988bf37cfaf6dc59b05fd744b7.tar.gz
opensim-SC_OLD-81ad9255b5f44d988bf37cfaf6dc59b05fd744b7.tar.bz2
opensim-SC_OLD-81ad9255b5f44d988bf37cfaf6dc59b05fd744b7.tar.xz
Hook up Keyframe motion to almost everything. Failing to cross a sim border
may yield unexpected results in some cases. No database persistence yet,
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs16
5 files changed, 64 insertions, 0 deletions
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
2364 2364
2365 foreach (SceneObjectPart part in partList) 2365 foreach (SceneObjectPart part in partList)
2366 { 2366 {
2367 if (part.KeyframeMotion != null)
2368 {
2369 part.KeyframeMotion.Delete();
2370 part.KeyframeMotion = null;
2371 }
2372
2367 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) 2373 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
2368 { 2374 {
2369 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? 2375 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
@@ -2705,6 +2711,9 @@ namespace OpenSim.Region.Framework.Scenes
2705 // before we restart the scripts, or else some functions won't work. 2711 // before we restart the scripts, or else some functions won't work.
2706 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); 2712 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2707 newObject.ResumeScripts(); 2713 newObject.ResumeScripts();
2714
2715 if (newObject.RootPart.KeyframeMotion != null)
2716 newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
2708 } 2717 }
2709 2718
2710 // Do this as late as possible so that listeners have full access to the incoming object 2719 // 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
1645 /// <param name="childPrims"></param> 1645 /// <param name="childPrims"></param>
1646 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) 1646 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1647 { 1647 {
1648 if (root.KeyframeMotion != null)
1649 {
1650 root.KeyframeMotion.Stop();
1651 root.KeyframeMotion = null;
1652 }
1653
1648 SceneObjectGroup parentGroup = root.ParentGroup; 1654 SceneObjectGroup parentGroup = root.ParentGroup;
1649 if (parentGroup == null) return; 1655 if (parentGroup == null) return;
1650 1656
@@ -1722,6 +1728,11 @@ namespace OpenSim.Region.Framework.Scenes
1722 { 1728 {
1723 if (part != null) 1729 if (part != null)
1724 { 1730 {
1731 if (part.KeyframeMotion != null)
1732 {
1733 part.KeyframeMotion.Stop();
1734 part.KeyframeMotion = null;
1735 }
1725 if (part.ParentGroup.PrimCount != 1) // Skip single 1736 if (part.ParentGroup.PrimCount != 1) // Skip single
1726 { 1737 {
1727 if (part.LinkNum < 2) // Root 1738 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
455 || Scene.TestBorderCross(val, Cardinals.S)) 455 || Scene.TestBorderCross(val, Cardinals.S))
456 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) 456 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
457 { 457 {
458 if (m_rootPart.KeyframeMotion != null)
459 m_rootPart.KeyframeMotion.StartCrossingCheck();
460
458 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 461 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
459 } 462 }
460 } 463 }
@@ -578,6 +581,8 @@ namespace OpenSim.Region.Framework.Scenes
578 childPa.Selected = value; 581 childPa.Selected = value;
579 } 582 }
580 } 583 }
584 if (RootPart.KeyframeMotion != null)
585 RootPart.KeyframeMotion.Selected = value;
581 } 586 }
582 } 587 }
583 588
@@ -1551,6 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes
1551 1556
1552 newPart.DoPhysicsPropertyUpdate(originalPartPa.IsPhysical, true); 1557 newPart.DoPhysicsPropertyUpdate(originalPartPa.IsPhysical, true);
1553 } 1558 }
1559 if (part.KeyframeMotion != null)
1560 newPart.KeyframeMotion = part.KeyframeMotion.Copy(dupe);
1554 } 1561 }
1555 1562
1556 if (userExposed) 1563 if (userExposed)
@@ -1578,6 +1585,12 @@ namespace OpenSim.Region.Framework.Scenes
1578 1585
1579 public void ScriptSetPhysicsStatus(bool usePhysics) 1586 public void ScriptSetPhysicsStatus(bool usePhysics)
1580 { 1587 {
1588 if (usePhysics)
1589 {
1590 if (RootPart.KeyframeMotion != null)
1591 RootPart.KeyframeMotion.Stop();
1592 RootPart.KeyframeMotion = null;
1593 }
1581 UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); 1594 UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
1582 } 1595 }
1583 1596
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
354 private UUID m_collisionSound; 354 private UUID m_collisionSound;
355 private float m_collisionSoundVolume; 355 private float m_collisionSoundVolume;
356 356
357 private KeyframeMotion m_keyframeMotion = null;
358
359 public KeyframeMotion KeyframeMotion
360 {
361 get; set;
362 }
363
357 #endregion Fields 364 #endregion Fields
358 365
359// ~SceneObjectPart() 366// ~SceneObjectPart()
@@ -1799,6 +1806,8 @@ namespace OpenSim.Region.Framework.Scenes
1799 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 1806 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
1800 dupe.Shape.ExtraParams = extraP; 1807 dupe.Shape.ExtraParams = extraP;
1801 1808
1809 // safeguard actual copy is done in sog.copy
1810 dupe.KeyframeMotion = null;
1802 dupe.PayPrice = (int[])PayPrice.Clone(); 1811 dupe.PayPrice = (int[])PayPrice.Clone();
1803 1812
1804 dupe.DynAttrs.CopyFrom(DynAttrs); 1813 dupe.DynAttrs.CopyFrom(DynAttrs);
@@ -2001,6 +2010,9 @@ namespace OpenSim.Region.Framework.Scenes
2001 { 2010 {
2002 if (UsePhysics) 2011 if (UsePhysics)
2003 { 2012 {
2013 if (ParentGroup.RootPart.KeyframeMotion != null)
2014 ParentGroup.RootPart.KeyframeMotion.Stop();
2015 ParentGroup.RootPart.KeyframeMotion = null;
2004 ParentGroup.Scene.AddPhysicalPrim(1); 2016 ParentGroup.Scene.AddPhysicalPrim(1);
2005 2017
2006 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 2018 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
@@ -4327,6 +4339,9 @@ namespace OpenSim.Region.Framework.Scenes
4327 4339
4328 if (isPhysical) 4340 if (isPhysical)
4329 { 4341 {
4342 if (ParentGroup.RootPart.KeyframeMotion != null)
4343 ParentGroup.RootPart.KeyframeMotion.Stop();
4344 ParentGroup.RootPart.KeyframeMotion = null;
4330 ParentGroup.Scene.AddPhysicalPrim(1); 4345 ParentGroup.Scene.AddPhysicalPrim(1);
4331 4346
4332 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 4347 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
262 sr.Close(); 262 sr.Close();
263 } 263 }
264 264
265 XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
266 if (keymotion.Count > 0)
267 sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
268 else
269 sceneObject.RootPart.KeyframeMotion = null;
270
265 // Script state may, or may not, exist. Not having any, is NOT 271 // Script state may, or may not, exist. Not having any, is NOT
266 // ever a problem. 272 // ever a problem.
267 sceneObject.LoadScriptState(doc); 273 sceneObject.LoadScriptState(doc);
@@ -1182,6 +1188,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1182 }); 1188 });
1183 1189
1184 writer.WriteEndElement(); 1190 writer.WriteEndElement();
1191
1192 if (sog.RootPart.KeyframeMotion != null)
1193 {
1194 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1195
1196 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1197 writer.WriteBase64(data, 0, data.Length);
1198 writer.WriteEndElement();
1199 }
1200
1185 writer.WriteEndElement(); 1201 writer.WriteEndElement();
1186 } 1202 }
1187 1203