mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
now break several things at same time... sog/sop updates, threads options,...
This commit is contained in:
@@ -68,22 +68,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
POSITION = 32768
|
||||
}
|
||||
|
||||
// I don't really know where to put this except here.
|
||||
// Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
|
||||
[Flags]
|
||||
public enum ExtraParamType
|
||||
{
|
||||
Something1 = 1,
|
||||
Something2 = 2,
|
||||
Something3 = 4,
|
||||
Something4 = 8,
|
||||
Flexible = 16,
|
||||
Light = 32,
|
||||
Sculpt = 48,
|
||||
Something5 = 64,
|
||||
Something6 = 128
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum TextureAnimFlags : byte
|
||||
{
|
||||
@@ -109,13 +93,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SCULPT = 7
|
||||
}
|
||||
|
||||
public enum UpdateRequired : byte
|
||||
{
|
||||
NONE = 0,
|
||||
TERSE = 1,
|
||||
FULL = 2
|
||||
}
|
||||
|
||||
#endregion Enumerations
|
||||
|
||||
public class SceneObjectPart : ISceneEntity
|
||||
@@ -182,10 +159,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
!(SitTargetPosition == Vector3.Zero
|
||||
&& (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
|
||||
|| (SitTargetOrientation.W == 0f && SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f ))); // Invalid Quaternion
|
||||
// assume SitTargetOrientation is normalized (as needed elsewhere)
|
||||
if( SitTargetPosition != Vector3.Zero ||
|
||||
SitTargetOrientation.X != 0f ||
|
||||
SitTargetOrientation.Y != 0f ||
|
||||
SitTargetOrientation.Z != 0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,7 +1192,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return a * b;
|
||||
}
|
||||
|
||||
public UpdateRequired UpdateFlag { get; set; }
|
||||
public PrimUpdateFlags UpdateFlag { get; set; }
|
||||
|
||||
public PrimUpdateFlags GetAndClearUpdateFlag()
|
||||
{
|
||||
lock(UpdateFlagLock)
|
||||
{
|
||||
PrimUpdateFlags ret = UpdateFlag;
|
||||
UpdateFlag = PrimUpdateFlags.None;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
private object UpdateFlagLock = new object();
|
||||
|
||||
/// <summary>
|
||||
@@ -1503,11 +1494,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
set
|
||||
{
|
||||
UUID old = m_collisionSound;
|
||||
|
||||
m_collisionSoundType = value;
|
||||
if (value == -1)
|
||||
m_collisionSound = invalidCollisionSoundUUID;
|
||||
else if (value == 0)
|
||||
m_collisionSound = UUID.Zero;
|
||||
|
||||
if(m_collisionSound != old && ParentGroup != null)
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1516,6 +1512,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_collisionSound; }
|
||||
set
|
||||
{
|
||||
UUID olds = m_collisionSound;
|
||||
m_collisionSound = value;
|
||||
|
||||
if (value == invalidCollisionSoundUUID)
|
||||
@@ -1525,13 +1522,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else
|
||||
m_collisionSoundType = 1;
|
||||
|
||||
if(m_collisionSound != olds && ParentGroup != null)
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
public float CollisionSoundVolume
|
||||
{
|
||||
get { return m_collisionSoundVolume; }
|
||||
set { m_collisionSoundVolume = value; }
|
||||
set
|
||||
{
|
||||
float oldvalue = m_collisionSoundVolume;
|
||||
if(value >= 0)
|
||||
m_collisionSoundVolume = value;
|
||||
else
|
||||
m_collisionSoundVolume = 0.0f;
|
||||
if(m_collisionSoundVolume != oldvalue && ParentGroup != null)
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
public float Buoyancy
|
||||
@@ -1884,7 +1892,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void ClearUpdateSchedule()
|
||||
{
|
||||
lock(UpdateFlagLock)
|
||||
UpdateFlag = UpdateRequired.NONE;
|
||||
UpdateFlag = PrimUpdateFlags.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3276,40 +3284,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
|
||||
|
||||
if (ParentGroup == null)
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null)
|
||||
return;
|
||||
if (ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
|
||||
if(ParentGroup.Scene.GetNumberOfClients() == 0)
|
||||
return;
|
||||
|
||||
ParentGroup.QueueForUpdateCheck(); // just in case
|
||||
|
||||
lock(UpdateFlagLock)
|
||||
{
|
||||
if(UpdateFlag != UpdateRequired.FULL)
|
||||
{
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
UpdateFlag |= PrimUpdateFlags.FullUpdate;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
|
||||
// UUID, Name, TimeStampFull);
|
||||
|
||||
}
|
||||
}
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schedule a terse update for this prim. Terse updates only send position,
|
||||
/// rotation, velocity and rotational velocity information. WRONG!!!!
|
||||
/// rotation, velocity and rotational velocity information.
|
||||
/// </summary>
|
||||
public void ScheduleTerseUpdate()
|
||||
{
|
||||
if (ParentGroup == null)
|
||||
return;
|
||||
if (ParentGroup.Scene == null)
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
@@ -3317,28 +3312,47 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if(ParentGroup.Scene.GetNumberOfClients() == 0)
|
||||
return;
|
||||
|
||||
// This was pulled from SceneViewer. Attachments always receive full updates.
|
||||
// This is needed because otherwise if only the root prim changes position, then
|
||||
// it looks as if the entire object has moved (including the other prims).
|
||||
if (ParentGroup.IsAttachment)
|
||||
ParentGroup.QueueForUpdateCheck();
|
||||
|
||||
bool isfull = false;
|
||||
lock (UpdateFlagLock)
|
||||
{
|
||||
ScheduleFullUpdate();
|
||||
return;
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
UpdateFlag |= PrimUpdateFlags.FullUpdate;
|
||||
isfull = true;
|
||||
}
|
||||
else
|
||||
UpdateFlag |= PrimUpdateFlags.TerseUpdate;
|
||||
}
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull);
|
||||
}
|
||||
|
||||
public void ScheduleUpdate(PrimUpdateFlags update)
|
||||
{
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
|
||||
if (ParentGroup.Scene.GetNumberOfClients() == 0)
|
||||
return;
|
||||
|
||||
ParentGroup.QueueForUpdateCheck();
|
||||
lock(UpdateFlagLock)
|
||||
{
|
||||
if (UpdateFlag == UpdateRequired.NONE)
|
||||
{
|
||||
UpdateFlag = UpdateRequired.TERSE;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1}",
|
||||
// UUID, Name);
|
||||
bool isfull = false;
|
||||
lock (UpdateFlagLock)
|
||||
{
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
UpdateFlag |= update | PrimUpdateFlags.FullUpdate;
|
||||
isfull = true;
|
||||
}
|
||||
else
|
||||
UpdateFlag |= update;
|
||||
}
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
|
||||
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull);
|
||||
}
|
||||
|
||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||
@@ -3364,7 +3378,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
|
||||
if (sp != null)
|
||||
{
|
||||
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
|
||||
sp.SendAttachmentUpdate(this, PrimUpdateFlags.FullUpdate);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3373,6 +3387,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
protected internal void SendFullUpdate(IClientAPI remoteClient, PrimUpdateFlags update)
|
||||
{
|
||||
if (ParentGroup == null)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
|
||||
|
||||
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
|
||||
if (sp != null)
|
||||
{
|
||||
sp.SendAttachmentUpdate(this, update);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendUpdateToClient(remoteClient, update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a full update for this part to all clients.
|
||||
/// </summary>
|
||||
@@ -3419,7 +3456,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
|
||||
if (sp != null)
|
||||
{
|
||||
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
|
||||
sp.SendAttachmentUpdate(this, PrimUpdateFlags.FullUpdate);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3469,136 +3506,109 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void SendScheduledUpdates(double now)
|
||||
{
|
||||
bool sendterse = false;
|
||||
bool sendfull = false;
|
||||
|
||||
lock(UpdateFlagLock)
|
||||
PrimUpdateFlags current;
|
||||
lock (UpdateFlagLock)
|
||||
{
|
||||
switch (UpdateFlag)
|
||||
current = UpdateFlag;
|
||||
|
||||
if (current == PrimUpdateFlags.None)
|
||||
return;
|
||||
|
||||
if(current == PrimUpdateFlags.TerseUpdate)
|
||||
{
|
||||
case UpdateRequired.NONE:
|
||||
break;
|
||||
Vector3 curvel = Velocity;
|
||||
Vector3 curacc = Acceleration;
|
||||
Vector3 angvel = AngularVelocity;
|
||||
|
||||
case UpdateRequired.TERSE:
|
||||
sendterse = true;
|
||||
while(true) // just to avoid ugly goto
|
||||
{
|
||||
double elapsed = now - m_lastUpdateSentTime;
|
||||
if (elapsed > TIME_MS_TOLERANCE)
|
||||
break;
|
||||
|
||||
Vector3 curvel = Velocity;
|
||||
Vector3 curacc = Acceleration;
|
||||
Vector3 angvel = AngularVelocity;
|
||||
|
||||
while(true) // just to avoid ugly goto
|
||||
{
|
||||
double elapsed = now - m_lastUpdateSentTime;
|
||||
if (elapsed > TIME_MS_TOLERANCE)
|
||||
break;
|
||||
|
||||
if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE ||
|
||||
if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE)
|
||||
break;
|
||||
|
||||
if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
|
||||
break;
|
||||
|
||||
if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE)
|
||||
break;
|
||||
|
||||
float vx = Math.Abs(curvel.X);
|
||||
if(vx > 128.0)
|
||||
break;
|
||||
float vy = Math.Abs(curvel.Y);
|
||||
if(vy > 128.0)
|
||||
break;
|
||||
float vz = Math.Abs(curvel.Z);
|
||||
if(vz > 128.0)
|
||||
break;
|
||||
break;
|
||||
|
||||
if (
|
||||
float vx = Math.Abs(curvel.X);
|
||||
if(vx > 128.0)
|
||||
break;
|
||||
float vy = Math.Abs(curvel.Y);
|
||||
if(vy > 128.0)
|
||||
break;
|
||||
float vz = Math.Abs(curvel.Z);
|
||||
if(vz > 128.0)
|
||||
break;
|
||||
|
||||
if(
|
||||
vx < VELOCITY_TOLERANCE &&
|
||||
vy < VELOCITY_TOLERANCE &&
|
||||
vz < VELOCITY_TOLERANCE
|
||||
)
|
||||
{
|
||||
if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
||||
break;
|
||||
|
||||
if (vx < 1e-4 &&
|
||||
{
|
||||
if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
||||
break;
|
||||
if(vx < 1e-4 &&
|
||||
vy < 1e-4 &&
|
||||
vz < 1e-4 &&
|
||||
(
|
||||
Math.Abs(m_lastVelocity.X) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Y) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Z) > 1e-4
|
||||
Math.Abs(m_lastVelocity.X) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Y) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Z) > 1e-4
|
||||
))
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE ||
|
||||
if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE ||
|
||||
Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE ||
|
||||
Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE)
|
||||
break;
|
||||
break;
|
||||
|
||||
// viewer interpolators have a limit of 64rad/s
|
||||
float ax = Math.Abs(angvel.X);
|
||||
if(ax > 64.0)
|
||||
break;
|
||||
float ay = Math.Abs(angvel.Y);
|
||||
if(ay > 64.0)
|
||||
break;
|
||||
float az = Math.Abs(angvel.Z);
|
||||
if(az > 64.0)
|
||||
break;
|
||||
// viewer interpolators have a limit of 64rad/s
|
||||
float ax = Math.Abs(angvel.X);
|
||||
if(ax > 64.0)
|
||||
break;
|
||||
float ay = Math.Abs(angvel.Y);
|
||||
if(ay > 64.0)
|
||||
break;
|
||||
float az = Math.Abs(angvel.Z);
|
||||
if(az > 64.0)
|
||||
break;
|
||||
|
||||
if (
|
||||
if (
|
||||
ax < ANGVELOCITY_TOLERANCE &&
|
||||
ay < ANGVELOCITY_TOLERANCE &&
|
||||
az < ANGVELOCITY_TOLERANCE &&
|
||||
!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)
|
||||
)
|
||||
break;
|
||||
|
||||
sendterse = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(sendterse)
|
||||
{
|
||||
// Update the "last" values
|
||||
m_lastPosition = AbsolutePosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = curvel;
|
||||
m_lastAcceleration = curacc;
|
||||
m_lastAngularVelocity = angvel;
|
||||
m_lastUpdateSentTime = now;
|
||||
ClearUpdateSchedule();
|
||||
}
|
||||
break;
|
||||
|
||||
case UpdateRequired.FULL:
|
||||
m_lastPosition = AbsolutePosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = Velocity;
|
||||
m_lastAcceleration = Acceleration;
|
||||
m_lastAngularVelocity = AngularVelocity;
|
||||
m_lastUpdateSentTime = now;
|
||||
ClearUpdateSchedule();
|
||||
sendfull = true;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sendterse)
|
||||
{
|
||||
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
|
||||
|
||||
if((current & PrimUpdateFlags.TerseUpdate) != 0)
|
||||
{
|
||||
SendTerseUpdateToClient(client);
|
||||
});
|
||||
m_lastPosition = AbsolutePosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = Velocity;
|
||||
m_lastAcceleration = Acceleration;
|
||||
m_lastAngularVelocity = AngularVelocity;
|
||||
m_lastUpdateSentTime = now;
|
||||
}
|
||||
|
||||
UpdateFlag = PrimUpdateFlags.None;
|
||||
}
|
||||
else if(sendfull)
|
||||
|
||||
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
SendFullUpdate(avatar.ControllingClient);
|
||||
});
|
||||
}
|
||||
SendUpdateToClient(avatar.ControllingClient, current);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3608,10 +3618,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (ParentGroup == null || ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
lock(UpdateFlagLock)
|
||||
{
|
||||
if(UpdateFlag != UpdateRequired.NONE)
|
||||
return;
|
||||
UpdateFlag &= ~PrimUpdateFlags.TerseUpdate;
|
||||
|
||||
// Update the "last" values
|
||||
m_lastPosition = AbsolutePosition;
|
||||
@@ -3635,8 +3645,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock(UpdateFlagLock)
|
||||
{
|
||||
if(UpdateFlag != UpdateRequired.NONE)
|
||||
return;
|
||||
UpdateFlag &= ~PrimUpdateFlags.TerseUpdate;
|
||||
|
||||
// Update the "last" values
|
||||
m_lastPosition = AbsolutePosition;
|
||||
@@ -3652,7 +3661,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
|
||||
if (sp != null)
|
||||
{
|
||||
sp.SendAttachmentUpdate(this, UpdateRequired.TERSE);
|
||||
sp.SendAttachmentUpdate(this, PrimUpdateFlags.TerseUpdate);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3682,12 +3691,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void SetBuoyancy(float fvalue)
|
||||
{
|
||||
Buoyancy = fvalue;
|
||||
/*
|
||||
if (PhysActor != null)
|
||||
{
|
||||
PhysActor.Buoyancy = fvalue;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void SetDieAtEdge(bool p)
|
||||
@@ -4085,7 +4088,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
GroupID = groupID;
|
||||
// if (client != null)
|
||||
// SendPropertiesToClient(client);
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
lock(UpdateFlagLock)
|
||||
UpdateFlag |= PrimUpdateFlags.FullUpdate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4273,8 +4277,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Vector3 pos = GetWorldPosition();
|
||||
Quaternion rot = GetWorldRotation();
|
||||
|
||||
// Variables prefixed with AX are Axiom.Math copies of the LL variety.
|
||||
|
||||
Quaternion AXrot = rot;
|
||||
AXrot.Normalize();
|
||||
|
||||
@@ -4645,7 +4647,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (ParentGroup.RootPart.GetStatusSandbox())
|
||||
{
|
||||
if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
|
||||
if (Vector3.DistanceSquared(ParentGroup.RootPart.StatusSandboxPos, newPos) > 100)
|
||||
{
|
||||
ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
|
||||
newPos = OffsetPosition;
|
||||
@@ -5230,7 +5232,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Materials capable viewers can send a ObjectImage packet
|
||||
// when nothing in TE has changed. MaterialID should be updated
|
||||
// by the RenderMaterials CAP handler, so updating it here may cause a
|
||||
// race condtion. Therefore, if no non-materials TE fields have changed,
|
||||
// race condtion. Therefore, if no non-materials TE fields have not changed,
|
||||
// we should ignore any changes and not update Shape.TextureEntry
|
||||
|
||||
bool otherFieldsChanged = false;
|
||||
@@ -5279,7 +5281,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
if (changeFlags == 0)
|
||||
return;
|
||||
return;
|
||||
m_shape.TextureEntry = newTex.GetBytes();
|
||||
TriggerScriptChangedEvent(changeFlags);
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
@@ -5412,6 +5414,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
public void SendUpdateToClient(IClientAPI remoteClient, PrimUpdateFlags PrimUpdateFlags)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if (ParentGroup.IsAttachment &&
|
||||
(ParentGroup.RootPart != this || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint))
|
||||
return;
|
||||
|
||||
remoteClient.SendEntityUpdate(this, PrimUpdateFlags);
|
||||
|
||||
ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
|
||||
}
|
||||
|
||||
|
||||
public void SendTerseUpdateToClient(IClientAPI remoteClient)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
@@ -5424,10 +5441,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// Causes this thread to dig into the Client Thread Data.
|
||||
// Remember your locking here!
|
||||
remoteClient.SendEntityUpdate(
|
||||
this,
|
||||
PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
|
||||
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
|
||||
remoteClient.SendEntityUpdate(this, PrimUpdateFlags.TerseUpdate);
|
||||
|
||||
ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
|
||||
}
|
||||
@@ -5691,5 +5705,75 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
PhysActor.Building = true;
|
||||
UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false);
|
||||
}
|
||||
|
||||
private object animsLock = new object();
|
||||
public Dictionary<UUID, int> Animations = null;
|
||||
public Dictionary<UUID, string> AnimationsNames = null;
|
||||
|
||||
public bool AddAnimation(UUID animId, string animName)
|
||||
{
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||
return false;
|
||||
|
||||
lock (animsLock)
|
||||
{
|
||||
if (Animations == null)
|
||||
Animations = new Dictionary<UUID, int>(1);
|
||||
if (AnimationsNames == null)
|
||||
AnimationsNames = new Dictionary<UUID, string>(1);
|
||||
|
||||
if (Animations.ContainsKey(animId))
|
||||
return false;
|
||||
|
||||
Animations[animId] = ParentGroup.Scene.NextObjectAnimationSequenceNumber;
|
||||
AnimationsNames[animId] = animName;
|
||||
ScheduleUpdate(PrimUpdateFlags.Animations);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveAnimation(UUID animId)
|
||||
{
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||
return false;
|
||||
|
||||
lock (animsLock)
|
||||
{
|
||||
if (Animations == null)
|
||||
return false;
|
||||
|
||||
if (Animations.ContainsKey(animId))
|
||||
{
|
||||
Animations.Remove(animId);
|
||||
if(AnimationsNames!=null)
|
||||
AnimationsNames.Remove(animId);
|
||||
ScheduleUpdate(PrimUpdateFlags.Animations);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int GetAnimations(out UUID[] ids, out int[] seqs)
|
||||
{
|
||||
ids = null;
|
||||
seqs = null;
|
||||
|
||||
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||
return -1;
|
||||
|
||||
lock (animsLock)
|
||||
{
|
||||
if (Animations == null)
|
||||
return -1;
|
||||
if(Animations.Count == 0)
|
||||
return 0;
|
||||
ids = new UUID[Animations.Count];
|
||||
Animations.Keys.CopyTo(ids, 0);
|
||||
seqs = new int[Animations.Count];
|
||||
Animations.Values.CopyTo(seqs, 0);
|
||||
return Animations.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user