Merge branch 'avination' into careminster
commit
cfa8e9cfa7
|
@ -935,36 +935,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
private UUID GetDefaultItem(WearableType wearable)
|
||||
{
|
||||
// These are Urban male.. but it doesn't matter as long as the assets exist.
|
||||
// These are ruth
|
||||
UUID ret = UUID.Zero;
|
||||
switch (wearable)
|
||||
{
|
||||
case WearableType.Eyes:
|
||||
ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d");
|
||||
ret = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
|
||||
break;
|
||||
case WearableType.Hair:
|
||||
ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9");
|
||||
ret = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
|
||||
break;
|
||||
case WearableType.Pants:
|
||||
ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2");
|
||||
ret = new UUID("00000000-38f9-1111-024e-222222111120");
|
||||
break;
|
||||
case WearableType.Shape:
|
||||
ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce");
|
||||
ret = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
break;
|
||||
case WearableType.Shirt:
|
||||
ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9");
|
||||
break;
|
||||
case WearableType.Shoes:
|
||||
ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719");
|
||||
ret = new UUID("00000000-38f9-1111-024e-222222111110");
|
||||
break;
|
||||
case WearableType.Skin:
|
||||
ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3");
|
||||
ret = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
|
||||
break;
|
||||
case WearableType.Socks:
|
||||
ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96");
|
||||
case WearableType.Undershirt:
|
||||
ret = new UUID("16499ebb-3208-ec27-2def-481881728f47");
|
||||
break;
|
||||
case WearableType.Underpants:
|
||||
ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96");
|
||||
ret = new UUID("4ac2e9c7-3671-d229-316a-67717730841d");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,77 @@ using log4net;
|
|||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public static class KeyframeTimer
|
||||
{
|
||||
private static Timer m_timer;
|
||||
private static Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>();
|
||||
private static object m_lockObject = new object();
|
||||
private static object m_timerLock = new object();
|
||||
public const double timerInterval = 50.0;
|
||||
|
||||
static KeyframeTimer()
|
||||
{
|
||||
m_timer = new Timer();
|
||||
m_timer.Interval = timerInterval;
|
||||
m_timer.AutoReset = true;
|
||||
m_timer.Elapsed += OnTimer;
|
||||
|
||||
m_timer.Start();
|
||||
}
|
||||
|
||||
private static void OnTimer(object sender, ElapsedEventArgs ea)
|
||||
{
|
||||
if (!Monitor.TryEnter(m_timerLock))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
List<KeyframeMotion> motions;
|
||||
|
||||
lock (m_lockObject)
|
||||
{
|
||||
motions = new List<KeyframeMotion>(m_motions.Keys);
|
||||
}
|
||||
|
||||
foreach (KeyframeMotion m in motions)
|
||||
{
|
||||
try
|
||||
{
|
||||
m.OnTimer();
|
||||
}
|
||||
catch (Exception inner)
|
||||
{
|
||||
// Don't stop processing
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Keep running no matter what
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(m_timerLock);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Add(KeyframeMotion motion)
|
||||
{
|
||||
lock (m_lockObject)
|
||||
{
|
||||
m_motions[motion] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Remove(KeyframeMotion motion)
|
||||
{
|
||||
lock (m_lockObject)
|
||||
{
|
||||
m_motions.Remove(motion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class KeyframeMotion
|
||||
{
|
||||
|
@ -63,18 +134,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private Keyframe[] m_keyframes;
|
||||
|
||||
[NonSerialized()]
|
||||
protected Timer m_timer = null;
|
||||
|
||||
// timer lock
|
||||
[NonSerialized()]
|
||||
private object m_onTimerLock;
|
||||
|
||||
// timer overrun detect
|
||||
// prevents overlap or timer events threads frozen on the lock
|
||||
[NonSerialized()]
|
||||
private bool m_inOnTimer;
|
||||
|
||||
// skip timer events.
|
||||
//timer.stop doesn't assure there aren't event threads still being fired
|
||||
[NonSerialized()]
|
||||
|
@ -102,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private int m_iterations = 0;
|
||||
|
||||
private const double timerInterval = 50.0;
|
||||
private int m_skipLoops = 0;
|
||||
|
||||
public DataFormat Data
|
||||
{
|
||||
|
@ -139,31 +198,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private void StartTimer()
|
||||
{
|
||||
if (m_timer == null)
|
||||
return;
|
||||
KeyframeTimer.Add(this);
|
||||
m_timerStopped = false;
|
||||
m_timer.Start();
|
||||
}
|
||||
|
||||
private void StopTimer()
|
||||
{
|
||||
if (m_timer == null || m_timerStopped)
|
||||
return;
|
||||
m_timerStopped = true;
|
||||
m_timer.Stop();
|
||||
KeyframeTimer.Remove(this);
|
||||
}
|
||||
|
||||
private void RemoveTimer()
|
||||
{
|
||||
if (m_timer == null)
|
||||
return;
|
||||
m_timerStopped = true;
|
||||
m_timer.Stop();
|
||||
m_timer.Elapsed -= OnTimer;
|
||||
m_timer = null;
|
||||
}
|
||||
|
||||
|
||||
public static KeyframeMotion FromData(SceneObjectGroup grp, Byte[] data)
|
||||
{
|
||||
KeyframeMotion newMotion = null;
|
||||
|
@ -180,9 +224,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (grp != null && grp.IsSelected)
|
||||
newMotion.m_selected = true;
|
||||
|
||||
newMotion.m_onTimerLock = new object();
|
||||
newMotion.m_timerStopped = false;
|
||||
newMotion.m_inOnTimer = false;
|
||||
newMotion.m_isCrossing = false;
|
||||
newMotion.m_waitingCrossing = false;
|
||||
}
|
||||
|
@ -196,8 +238,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void UpdateSceneObject(SceneObjectGroup grp)
|
||||
{
|
||||
// lock (m_onTimerLock)
|
||||
{
|
||||
m_isCrossing = false;
|
||||
m_waitingCrossing = false;
|
||||
StopTimer();
|
||||
|
@ -227,7 +267,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_running)
|
||||
Start();
|
||||
}
|
||||
}
|
||||
|
||||
public KeyframeMotion(SceneObjectGroup grp, PlayMode mode, DataFormat data)
|
||||
{
|
||||
|
@ -241,9 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_baseRotation = grp.GroupRotation;
|
||||
}
|
||||
|
||||
m_onTimerLock = new object();
|
||||
m_timerStopped = true;
|
||||
m_inOnTimer = false;
|
||||
m_isCrossing = false;
|
||||
m_waitingCrossing = false;
|
||||
}
|
||||
|
@ -296,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void Delete()
|
||||
{
|
||||
m_running = false;
|
||||
RemoveTimer();
|
||||
StopTimer();
|
||||
m_isCrossing = false;
|
||||
m_waitingCrossing = false;
|
||||
m_frames.Clear();
|
||||
|
@ -309,27 +346,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_waitingCrossing = false;
|
||||
if (m_keyframes != null && m_group != null && m_keyframes.Length > 0)
|
||||
{
|
||||
if (m_timer == null)
|
||||
{
|
||||
m_timer = new Timer();
|
||||
m_timer.Interval = timerInterval;
|
||||
m_timer.AutoReset = true;
|
||||
m_timer.Elapsed += OnTimer;
|
||||
}
|
||||
else
|
||||
{
|
||||
StopTimer();
|
||||
m_timer.Interval = timerInterval;
|
||||
}
|
||||
|
||||
m_inOnTimer = false;
|
||||
StartTimer();
|
||||
m_running = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_running = false;
|
||||
RemoveTimer();
|
||||
StopTimer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +362,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_isCrossing = false;
|
||||
m_waitingCrossing = false;
|
||||
|
||||
RemoveTimer();
|
||||
StopTimer();
|
||||
|
||||
m_basePosition = m_group.AbsolutePosition;
|
||||
m_baseRotation = m_group.GroupRotation;
|
||||
|
@ -354,7 +377,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void Pause()
|
||||
{
|
||||
m_running = false;
|
||||
RemoveTimer();
|
||||
StopTimer();
|
||||
|
||||
m_group.RootPart.Velocity = Vector3.Zero;
|
||||
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
||||
|
@ -377,15 +400,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
int start = 0;
|
||||
int end = m_keyframes.Length;
|
||||
// if (m_mode == PlayMode.PingPong && m_keyframes.Length > 1)
|
||||
// end = m_keyframes.Length - 1;
|
||||
|
||||
if (direction < 0)
|
||||
{
|
||||
start = m_keyframes.Length - 1;
|
||||
end = -1;
|
||||
// if (m_mode == PlayMode.PingPong && m_keyframes.Length > 1)
|
||||
// end = 0;
|
||||
}
|
||||
|
||||
for (int i = start; i != end ; i += direction)
|
||||
|
@ -463,39 +482,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
protected void OnTimer(object sender, ElapsedEventArgs e)
|
||||
public void OnTimer()
|
||||
{
|
||||
if (m_timerStopped) // trap events still in air even after a timer.stop
|
||||
return;
|
||||
|
||||
if (m_inOnTimer) // don't let overruns to happen
|
||||
if (m_skipLoops > 0)
|
||||
{
|
||||
m_log.Warn("[KeyFrame]: timer overrun");
|
||||
m_skipLoops--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_timerStopped) // trap events still in air even after a timer.stop
|
||||
return;
|
||||
|
||||
if (m_group == null)
|
||||
return;
|
||||
|
||||
lock (m_onTimerLock)
|
||||
{
|
||||
|
||||
m_inOnTimer = true;
|
||||
|
||||
bool update = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_selected)
|
||||
{
|
||||
if (m_group.RootPart.Velocity != Vector3.Zero)
|
||||
{
|
||||
m_group.RootPart.Velocity = Vector3.Zero;
|
||||
m_group.SendGroupRootTerseUpdate();
|
||||
// m_group.RootPart.ScheduleTerseUpdate();
|
||||
|
||||
}
|
||||
m_inOnTimer = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -510,10 +520,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!m_isCrossing)
|
||||
{
|
||||
StopTimer();
|
||||
m_timer.Interval = timerInterval;
|
||||
StartTimer();
|
||||
}
|
||||
m_inOnTimer = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -524,21 +532,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_frames.Count == 0)
|
||||
{
|
||||
Stop();
|
||||
m_inOnTimer = false;
|
||||
Scene scene = m_group.Scene;
|
||||
|
||||
IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
|
||||
foreach (IScriptModule m in scriptModules)
|
||||
{
|
||||
if (m == null)
|
||||
continue;
|
||||
m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_currentFrame = m_frames[0];
|
||||
m_currentFrame.TimeMS += (int)timerInterval;
|
||||
m_currentFrame.TimeMS += (int)KeyframeTimer.timerInterval;
|
||||
|
||||
//force a update on a keyframe transition
|
||||
update = true;
|
||||
}
|
||||
|
||||
m_currentFrame.TimeMS -= (int)timerInterval;
|
||||
m_currentFrame.TimeMS -= (int)KeyframeTimer.timerInterval;
|
||||
|
||||
// Do the frame processing
|
||||
double steps = (double)m_currentFrame.TimeMS / timerInterval;
|
||||
double steps = (double)m_currentFrame.TimeMS / KeyframeTimer.timerInterval;
|
||||
|
||||
if (steps <= 0.0)
|
||||
{
|
||||
|
@ -629,23 +646,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
if (update)
|
||||
{
|
||||
m_group.SendGroupRootTerseUpdate();
|
||||
// m_group.RootPart.ScheduleTerseUpdate();
|
||||
|
||||
|
||||
}
|
||||
catch ( Exception ex)
|
||||
{
|
||||
// still happening sometimes
|
||||
// lets try to see where
|
||||
m_log.Warn("[KeyFrame]: timer overrun" + ex.Message);
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
// make sure we do not let this frozen
|
||||
m_inOnTimer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,9 +698,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_group.SendGroupRootTerseUpdate();
|
||||
// m_group.RootPart.ScheduleTerseUpdate();
|
||||
|
||||
if (m_running && m_timer != null)
|
||||
if (m_running)
|
||||
{
|
||||
m_timer.Interval = 60000;
|
||||
StopTimer();
|
||||
m_skipLoops = 1200; // 60 seconds
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue