aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs30
1 files changed, 28 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 29652aa..ab1e7fa 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 public class KeyframeTimer 48 public class KeyframeTimer
49 { 49 {
50 private static Dictionary<Scene, KeyframeTimer>m_timers = 50 private static Dictionary<Scene, KeyframeTimer> m_timers =
51 new Dictionary<Scene, KeyframeTimer>(); 51 new Dictionary<Scene, KeyframeTimer>();
52 52
53 private Timer m_timer; 53 private Timer m_timer;
@@ -67,8 +67,15 @@ namespace OpenSim.Region.Framework.Scenes
67 m_timer.Interval = TickDuration; 67 m_timer.Interval = TickDuration;
68 m_timer.AutoReset = true; 68 m_timer.AutoReset = true;
69 m_timer.Elapsed += OnTimer; 69 m_timer.Elapsed += OnTimer;
70 }
70 71
71 m_timer.Start(); 72 public void Start()
73 {
74 lock (m_timer)
75 {
76 if (!m_timer.Enabled)
77 m_timer.Start();
78 }
72 } 79 }
73 80
74 private void OnTimer(object sender, ElapsedEventArgs ea) 81 private void OnTimer(object sender, ElapsedEventArgs ea)
@@ -120,6 +127,25 @@ namespace OpenSim.Region.Framework.Scenes
120 { 127 {
121 timer = new KeyframeTimer(motion.Scene); 128 timer = new KeyframeTimer(motion.Scene);
122 m_timers[motion.Scene] = timer; 129 m_timers[motion.Scene] = timer;
130
131 if (!SceneManager.Instance.AllRegionsReady)
132 {
133 // Start the timers only once all the regions are ready. This is required
134 // when using megaregions, because the megaregion is correctly configured
135 // only after all the regions have been loaded. (If we don't do this then
136 // when the prim moves it might think that it crossed into a region.)
137 SceneManager.Instance.OnRegionsReadyStatusChange += delegate(SceneManager sm)
138 {
139 if (sm.AllRegionsReady)
140 timer.Start();
141 };
142 }
143
144 // Check again, in case the regions were started while we were adding the event handler
145 if (SceneManager.Instance.AllRegionsReady)
146 {
147 timer.Start();
148 }
123 } 149 }
124 } 150 }
125 151