change locking on sop updates
parent
e9b7971929
commit
82e2e1e00c
|
@ -657,6 +657,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!m_scene.IsRunning)
|
||||||
|
return sog;
|
||||||
|
|
||||||
if (root.KeyframeMotion != null)
|
if (root.KeyframeMotion != null)
|
||||||
root.KeyframeMotion.StartCrossingCheck();
|
root.KeyframeMotion.StartCrossingCheck();
|
||||||
|
|
||||||
|
@ -3018,12 +3021,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// If we somehow got here to updating the SOG and its root part is not scheduled for update,
|
// If we somehow got here to updating the SOG and its root part is not scheduled for update,
|
||||||
// check to see if the physical position or rotation warrant an update.
|
// check to see if the physical position or rotation warrant an update.
|
||||||
|
/*
|
||||||
if (m_rootPart.UpdateFlag == UpdateRequired.NONE)
|
if (m_rootPart.UpdateFlag == UpdateRequired.NONE)
|
||||||
{
|
{
|
||||||
// rootpart SendScheduledUpdates will check if a update is needed
|
// rootpart SendScheduledUpdates will check if a update is needed
|
||||||
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
|
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (IsAttachment)
|
if (IsAttachment)
|
||||||
{
|
{
|
||||||
ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
|
ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
|
||||||
|
|
|
@ -238,12 +238,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool SoundQueueing { get; set; }
|
public bool SoundQueueing { get; set; }
|
||||||
|
|
||||||
public uint TimeStampFull;
|
|
||||||
|
|
||||||
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
|
||||||
|
|
||||||
public uint TimeStampTerse;
|
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Quaternion AttachRotation = Quaternion.Identity;
|
public Quaternion AttachRotation = Quaternion.Identity;
|
||||||
|
|
||||||
|
@ -1219,6 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateRequired UpdateFlag { get; set; }
|
public UpdateRequired UpdateFlag { get; set; }
|
||||||
|
private object UpdateFlagLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for media on a prim.
|
/// Used for media on a prim.
|
||||||
|
@ -1641,8 +1636,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysActor.SetMaterial((int)value);
|
PhysActor.SetMaterial((int)value);
|
||||||
}
|
}
|
||||||
if(ParentGroup != null)
|
if(ParentGroup != null)
|
||||||
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
ScheduleFullUpdateIfNone();
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1727,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public byte PhysicsShapeType
|
public byte PhysicsShapeType
|
||||||
{
|
{
|
||||||
get { return m_physicsShapeType; }
|
get
|
||||||
|
{
|
||||||
|
// if (PhysActor != null)
|
||||||
|
// m_physicsShapeType = PhysActor.PhysicsShapeType;
|
||||||
|
return m_physicsShapeType;
|
||||||
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
byte oldv = m_physicsShapeType;
|
byte oldv = m_physicsShapeType;
|
||||||
|
@ -1781,10 +1783,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_density = value;
|
m_density = value;
|
||||||
|
|
||||||
ScheduleFullUpdateIfNone();
|
|
||||||
|
|
||||||
if (ParentGroup != null)
|
if (ParentGroup != null)
|
||||||
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -1802,10 +1806,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_gravitymod = value;
|
m_gravitymod = value;
|
||||||
|
|
||||||
ScheduleFullUpdateIfNone();
|
|
||||||
|
|
||||||
if (ParentGroup != null)
|
if (ParentGroup != null)
|
||||||
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -1823,10 +1828,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_friction = value;
|
m_friction = value;
|
||||||
|
|
||||||
ScheduleFullUpdateIfNone();
|
|
||||||
|
|
||||||
if (ParentGroup != null)
|
if (ParentGroup != null)
|
||||||
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -1844,10 +1850,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_bounce = value;
|
m_bounce = value;
|
||||||
|
|
||||||
ScheduleFullUpdateIfNone();
|
|
||||||
|
|
||||||
if (ParentGroup != null)
|
if (ParentGroup != null)
|
||||||
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -1876,6 +1883,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearUpdateSchedule()
|
public void ClearUpdateSchedule()
|
||||||
{
|
{
|
||||||
|
lock(UpdateFlagLock)
|
||||||
UpdateFlag = UpdateRequired.NONE;
|
UpdateFlag = UpdateRequired.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3239,17 +3247,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
APIDActive = false;
|
APIDActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScheduleFullUpdateIfNone()
|
|
||||||
{
|
|
||||||
if (ParentGroup == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// ??? ParentGroup.HasGroupChanged = true;
|
|
||||||
|
|
||||||
if (UpdateFlag != UpdateRequired.FULL)
|
|
||||||
ScheduleFullUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Schedules this prim for a full update
|
/// Schedules this prim for a full update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -3260,22 +3257,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup == null)
|
if (ParentGroup == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ParentGroup.QueueForUpdateCheck();
|
lock(UpdateFlagLock)
|
||||||
|
|
||||||
int timeNow = Util.UnixTimeSinceEpoch();
|
|
||||||
|
|
||||||
// If multiple updates are scheduled on the same second, we still need to perform all of them
|
|
||||||
// So we'll force the issue by bumping up the timestamp so that later processing sees these need
|
|
||||||
// to be performed.
|
|
||||||
if (timeNow <= TimeStampFull)
|
|
||||||
{
|
{
|
||||||
TimeStampFull += 1;
|
ParentGroup.QueueForUpdateCheck(); // just in case
|
||||||
}
|
if(UpdateFlag != UpdateRequired.FULL)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
TimeStampFull = (uint)timeNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateFlag = UpdateRequired.FULL;
|
UpdateFlag = UpdateRequired.FULL;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -3285,6 +3271,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup.Scene != null)
|
if (ParentGroup.Scene != null)
|
||||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
|
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Schedule a terse update for this prim. Terse updates only send position,
|
/// Schedule a terse update for this prim. Terse updates only send position,
|
||||||
|
@ -3304,12 +3292,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
if (UpdateFlag == UpdateRequired.NONE)
|
if (UpdateFlag == UpdateRequired.NONE)
|
||||||
{
|
{
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
ParentGroup.QueueForUpdateCheck();
|
ParentGroup.QueueForUpdateCheck();
|
||||||
|
|
||||||
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
|
|
||||||
UpdateFlag = UpdateRequired.TERSE;
|
UpdateFlag = UpdateRequired.TERSE;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -3320,6 +3309,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup.Scene != null)
|
if (ParentGroup.Scene != null)
|
||||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
|
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||||
{
|
{
|
||||||
|
@ -3362,12 +3352,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update the "last" values
|
// Update the "last" values
|
||||||
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
m_lastPosition = AbsolutePosition;
|
m_lastPosition = AbsolutePosition;
|
||||||
m_lastRotation = RotationOffset;
|
m_lastRotation = RotationOffset;
|
||||||
m_lastVelocity = Velocity;
|
m_lastVelocity = Velocity;
|
||||||
m_lastAcceleration = Acceleration;
|
m_lastAcceleration = Acceleration;
|
||||||
m_lastAngularVelocity = AngularVelocity;
|
m_lastAngularVelocity = AngularVelocity;
|
||||||
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
||||||
|
}
|
||||||
|
|
||||||
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
@ -3381,12 +3374,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update the "last" values
|
// Update the "last" values
|
||||||
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
m_lastPosition = AbsolutePosition;
|
m_lastPosition = AbsolutePosition;
|
||||||
m_lastRotation = RotationOffset;
|
m_lastRotation = RotationOffset;
|
||||||
m_lastVelocity = Velocity;
|
m_lastVelocity = Velocity;
|
||||||
m_lastAcceleration = Acceleration;
|
m_lastAcceleration = Acceleration;
|
||||||
m_lastAngularVelocity = AngularVelocity;
|
m_lastAngularVelocity = AngularVelocity;
|
||||||
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
||||||
|
}
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment)
|
if (ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
|
@ -3443,16 +3439,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendScheduledUpdates()
|
public void SendScheduledUpdates()
|
||||||
{
|
{
|
||||||
switch (UpdateFlag)
|
UpdateRequired currentUpdate;
|
||||||
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
|
currentUpdate = UpdateFlag;
|
||||||
|
ClearUpdateSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (currentUpdate)
|
||||||
{
|
{
|
||||||
case UpdateRequired.NONE:
|
case UpdateRequired.NONE:
|
||||||
ClearUpdateSchedule();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UpdateRequired.TERSE:
|
case UpdateRequired.TERSE:
|
||||||
|
|
||||||
ClearUpdateSchedule();
|
|
||||||
bool needupdate = true;
|
bool needupdate = true;
|
||||||
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
double now = Util.GetTimeStampMS();
|
double now = Util.GetTimeStampMS();
|
||||||
Vector3 curvel = Velocity;
|
Vector3 curvel = Velocity;
|
||||||
Vector3 curacc = Acceleration;
|
Vector3 curacc = Acceleration;
|
||||||
|
@ -3543,7 +3545,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_lastAcceleration = curacc;
|
m_lastAcceleration = curacc;
|
||||||
m_lastAngularVelocity = angvel;
|
m_lastAngularVelocity = angvel;
|
||||||
m_lastUpdateSentTime = now;
|
m_lastUpdateSentTime = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(needupdate)
|
||||||
|
{
|
||||||
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
|
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToClient(client);
|
SendTerseUpdateToClient(client);
|
||||||
|
@ -3552,7 +3558,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UpdateRequired.FULL:
|
case UpdateRequired.FULL:
|
||||||
ClearUpdateSchedule();
|
|
||||||
SendFullUpdateToAllClientsInternal();
|
SendFullUpdateToAllClientsInternal();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3567,7 +3572,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup == null || ParentGroup.Scene == null)
|
if (ParentGroup == null || ParentGroup.Scene == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClearUpdateSchedule();
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
|
if(UpdateFlag != UpdateRequired.NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
// Update the "last" values
|
// Update the "last" values
|
||||||
m_lastPosition = AbsolutePosition;
|
m_lastPosition = AbsolutePosition;
|
||||||
|
@ -3576,6 +3584,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_lastAcceleration = Acceleration;
|
m_lastAcceleration = Acceleration;
|
||||||
m_lastAngularVelocity = AngularVelocity;
|
m_lastAngularVelocity = AngularVelocity;
|
||||||
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
||||||
|
}
|
||||||
|
|
||||||
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
|
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
@ -3588,7 +3597,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup == null || ParentGroup.Scene == null)
|
if (ParentGroup == null || ParentGroup.Scene == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClearUpdateSchedule();
|
lock(UpdateFlagLock)
|
||||||
|
{
|
||||||
|
if(UpdateFlag != UpdateRequired.NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
// Update the "last" values
|
// Update the "last" values
|
||||||
m_lastPosition = AbsolutePosition;
|
m_lastPosition = AbsolutePosition;
|
||||||
|
@ -3597,6 +3609,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_lastAcceleration = Acceleration;
|
m_lastAcceleration = Acceleration;
|
||||||
m_lastAngularVelocity = AngularVelocity;
|
m_lastAngularVelocity = AngularVelocity;
|
||||||
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
m_lastUpdateSentTime = Util.GetTimeStampMS();
|
||||||
|
}
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment)
|
if (ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue