* Moved special PrimFlags.CreateSelected handling into LLClientView

* Changed many SendXUpdateToY() methods to SendUpdateToY(PrimUpdateFlags updateFlags), consolidated several methods
slimupdates
John Hurliman 2010-05-04 17:12:53 -07:00
parent 91878f79b9
commit 98a9ae40c5
8 changed files with 65 additions and 129 deletions

View File

@ -3508,7 +3508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (update.Entity is ScenePresence)
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
else
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity));
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
}
else if (!canUseImproved)
{
@ -4444,7 +4444,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return update;
}
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data)
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
{
byte[] objectData = new byte[60];
data.RelativePosition.ToBytes(objectData, 0);
@ -4502,8 +4502,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes;
update.Scale = data.Shape.Scale;
update.Text = Util.StringToBytes256(data.Text);
#region PrimFlags
PrimFlags flags = data.Flags;
// Don't send the CreateSelected flag to everyone
flags &= ~PrimFlags.CreateSelected;
if (recipientID == data.OwnerID)
{
if ((data.Flags & PrimFlags.CreateSelected) != 0)
{
// Only send this flag once, then unset it
flags |= PrimFlags.CreateSelected;
data.Flags &= ~PrimFlags.CreateSelected;
}
}
update.UpdateFlags = (uint)data.Flags;
#endregion PrimFlags
if (data.Sound != UUID.Zero)
{
update.Sound = data.Sound;

View File

@ -124,7 +124,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (((SceneObjectGroup)ent).LocalId == primLocalID)
{
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
((SceneObjectGroup)ent).SendUpdateToClient(remoteClient, PrimUpdateFlags.FullUpdate);
return;
}
}

View File

@ -1297,7 +1297,9 @@ namespace OpenSim.Region.Framework.Scenes
// so that if the object is locked the client moving the object
// get's it's position on the simulator even if it was the same as before
// This keeps the moving user's client in sync with the rest of the world.
group.SendGroupTerseUpdate();
SceneObjectPart movingPart = group.GetChildPart(objectID);
if (movingPart != null)
movingPart.SendUpdateToAllClients(PrimUpdateFlags.Position);
}
}
@ -1338,7 +1340,9 @@ namespace OpenSim.Region.Framework.Scenes
// so that if the object is locked the client moving the object
// get's it's position on the simulator even if it was the same as before
// This keeps the moving user's client in sync with the rest of the world.
group.SendGroupTerseUpdate();
SceneObjectPart rotatingPart = group.GetChildPart(objectID);
if (rotatingPart != null)
rotatingPart.SendUpdateToAllClients(PrimUpdateFlags.Rotation);
}
}

View File

@ -1488,17 +1488,17 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
public void SendFullUpdateToClient(IClientAPI remoteClient)
public void SendUpdateToClient(IClientAPI remoteClient, PrimUpdateFlags updateFlags)
{
RootPart.SendFullUpdateToClient(
remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID), PrimUpdateFlags.FullUpdate);
RootPart.SendUpdateToClient(
remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID), updateFlags);
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (part != RootPart)
part.SendFullUpdateToClient(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID), PrimUpdateFlags.FullUpdate);
part.SendUpdateToClient(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID), updateFlags);
}
}
}
@ -2035,32 +2035,18 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID);
RootPart.SendFullUpdateToAllClients();
RootPart.SendUpdateToAllClients(PrimUpdateFlags.FullUpdate);
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (part != RootPart)
part.SendFullUpdateToAllClients();
part.SendUpdateToAllClients(PrimUpdateFlags.FullUpdate);
}
}
}
/// <summary>
/// Immediately send an update for this scene object's root prim only.
/// This is for updates regarding the object as a whole, and none of its parts in particular.
/// Note: this may not be used by opensim (it probably should) but it's used by
/// external modules.
/// </summary>
public void SendGroupRootTerseUpdate()
{
if (IsDeleted)
return;
RootPart.SendTerseUpdateToAllClients();
}
public void QueueForUpdateCheck()
{
if (m_scene == null) // Need to check here as it's null during object creation
@ -2069,23 +2055,6 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.SceneGraph.AddToUpdateList(this);
}
/// <summary>
/// Immediately send a terse update for this scene object.
/// </summary>
public void SendGroupTerseUpdate()
{
if (IsDeleted)
return;
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
part.SendTerseUpdateToAllClients();
}
}
}
#endregion
#region SceneGroupPart Methods
@ -2491,7 +2460,7 @@ namespace OpenSim.Region.Framework.Scenes
public void NonPhysicalGrabMovement(Vector3 pos)
{
AbsolutePosition = pos;
m_rootPart.SendTerseUpdateToAllClients();
m_rootPart.SendUpdateToAllClients(PrimUpdateFlags.Position);
}
/// <summary>

View File

@ -2851,11 +2851,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Send a full update for this part to all clients.
/// </summary>
public void SendFullUpdateToAllClients()
public void SendUpdateToAllClients(PrimUpdateFlags updateFlags)
{
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
SendFullUpdateToClient(avatar.ControllingClient, avatar.GenerateClientFlags(UUID), PrimUpdateFlags.FullUpdate);
SendUpdateToClient(avatar.ControllingClient, avatar.GenerateClientFlags(UUID), updateFlags);
});
}
@ -2863,13 +2863,13 @@ namespace OpenSim.Region.Framework.Scenes
/// Send a full update to all clients except the one nominated.
/// </summary>
/// <param name="agentID"></param>
public void SendFullUpdateToAllClientsExcept(UUID agentID)
public void SendUpdateToAllClientsExcept(PrimUpdateFlags updateFlags, UUID agentID)
{
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
// Ugly reference :(
if (avatar.UUID != agentID)
SendFullUpdateToClient(avatar.ControllingClient, avatar.GenerateClientFlags(UUID), PrimUpdateFlags.FullUpdate);
SendUpdateToClient(avatar.ControllingClient, avatar.GenerateClientFlags(UUID), updateFlags);
});
}
@ -2879,57 +2879,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
/// <param name="lPos"></param>
/// <param name="clientFlags"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientFlags, PrimUpdateFlags updateFlags)
{
// Suppress full updates during attachment editing
//
if (ParentGroup.IsSelected && IsAttachment)
return;
if (ParentGroup.IsDeleted)
return;
clientFlags &= ~(uint) PrimFlags.CreateSelected;
if (remoteClient.AgentId == _ownerID)
{
if ((uint) (_flags & PrimFlags.CreateSelected) != 0)
{
clientFlags |= (uint) PrimFlags.CreateSelected;
_flags &= ~PrimFlags.CreateSelected;
}
}
//bool isattachment = IsAttachment;
//if (LocalId != ParentGroup.RootPart.LocalId)
//isattachment = ParentGroup.RootPart.IsAttachment;
remoteClient.SendEntityUpdate(ParentGroup.GetUpdatePriority(remoteClient), this, updateFlags);
}
public void SendTerseUpdateToClient(IClientAPI remoteClient)
public void SendUpdateToClient(IClientAPI remoteClient, uint clientFlags, PrimUpdateFlags updateFlags)
{
// Sanity check
if (ParentGroup == null || ParentGroup.IsDeleted)
return;
Vector3 lPos = OffsetPosition;
// Suppress full updates during attachment editing
if (ParentGroup.IsSelected && IsAttachment && updateFlags == PrimUpdateFlags.FullUpdate)
return;
if (IsAttachment)
{
if (ParentGroup.RootPart != this)
return;
lPos = ParentGroup.RootPart.AttachedPos;
}
else
{
if (ParentGroup.RootPart == this)
lPos = AbsolutePosition;
}
// Causes this thread to dig into the Client Thread Data.
// Remember your locking here!
remoteClient.SendEntityUpdate(ParentGroup.GetUpdatePriority(remoteClient), this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation |
PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
remoteClient.SendEntityUpdate(ParentGroup.GetUpdatePriority(remoteClient), this, updateFlags);
}
/// <summary>
@ -3075,17 +3035,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Send a terse update to all clients
/// </summary>
public void SendTerseUpdateToAllClients()
{
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
SendTerseUpdateToClient(avatar.ControllingClient);
});
}
public void SetAttachmentPoint(uint AttachmentPoint)
{
this.AttachmentPoint = AttachmentPoint;
@ -4111,10 +4060,9 @@ namespace OpenSim.Region.Framework.Scenes
baseMask;
break;
}
SendFullUpdateToAllClients();
SendUpdateToAllClients(PrimUpdateFlags.PrimFlags);
SendObjectPropertiesToClient(AgentID);
}
}

View File

@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampFull);
part.SendFullUpdateToClient(m_presence.ControllingClient,
part.SendUpdateToClient(m_presence.ControllingClient,
m_presence.GenerateClientFlags(part.UUID), PrimUpdateFlags.FullUpdate);
// We'll update to the part's timestamp rather than
@ -137,7 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampTerse);
part.SendTerseUpdateToClient(m_presence.ControllingClient);
part.SendUpdateToClient(m_presence.ControllingClient, m_presence.GenerateClientFlags(part.UUID), PrimUpdateFlags.Position | PrimUpdateFlags.Rotation |
PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
update.LastTerseUpdateTime = part.TimeStampTerse;
}
@ -157,11 +158,11 @@ namespace OpenSim.Region.Framework.Scenes
if (part != part.ParentGroup.RootPart)
continue;
part.ParentGroup.SendFullUpdateToClient(m_presence.ControllingClient);
part.ParentGroup.SendUpdateToClient(m_presence.ControllingClient, PrimUpdateFlags.FullUpdate);
continue;
}
part.SendFullUpdateToClient(m_presence.ControllingClient, m_presence.GenerateClientFlags(part.UUID), PrimUpdateFlags.FullUpdate);
part.SendUpdateToClient(m_presence.ControllingClient, m_presence.GenerateClientFlags(part.UUID), PrimUpdateFlags.FullUpdate);
}
}
}

View File

@ -193,20 +193,14 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
public void SendFullUpdate(IClientAPI client)
{
// Not sure what clientFlags should be but 0 seems to work
SendFullUpdate(client, 0);
}
public void SendFullUpdate(IClientAPI client, uint clientFlags)
{
m_Entity.SendFullUpdateToClient(client);
m_Entity.SendUpdateToClient(client, PrimUpdateFlags.FullUpdate);
}
public void SendFullUpdateToAll()
{
m_Entity.Scene.ForEachClient(
delegate(IClientAPI controller)
{ m_Entity.SendFullUpdateToClient(controller); }
delegate(IClientAPI client)
{ m_Entity.SendUpdateToClient(client, PrimUpdateFlags.FullUpdate); }
);
}

View File

@ -1329,7 +1329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tmp.Y = (float)scale.y;
tmp.Z = (float)scale.z;
part.Scale = tmp;
part.SendFullUpdateToAllClients();
part.SendUpdateToAllClients(PrimUpdateFlags.Scale);
}
public LSL_Vector llGetScale()
@ -2246,7 +2246,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
m_host.ScheduleFullUpdate();
m_host.SendFullUpdateToAllClients();
m_host.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
public void llLoopSoundMaster(string sound, double volume)
@ -2266,7 +2266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
prim.ScheduleFullUpdate();
prim.SendFullUpdateToAllClients();
prim.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
}
if (m_host.Sound != UUID.Zero)
@ -2278,7 +2278,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
m_host.ScheduleFullUpdate();
m_host.SendFullUpdateToAllClients();
m_host.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
public void llLoopSoundSlave(string sound, double volume)
@ -2320,7 +2320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.SoundFlags = 0;
part.SoundRadius = 0;
part.ScheduleFullUpdate();
part.SendFullUpdateToAllClients();
part.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
m_host.ParentGroup.LoopSoundMasterPrim = null;
m_host.ParentGroup.LoopSoundSlavePrims.Clear();
@ -2332,7 +2332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SoundFlags = 0;
m_host.SoundRadius = 0;
m_host.ScheduleFullUpdate();
m_host.SendFullUpdateToAllClients();
m_host.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
}
else
@ -2342,7 +2342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SoundFlags = 0;
m_host.SoundRadius = 0;
m_host.ScheduleFullUpdate();
m_host.SendFullUpdateToAllClients();
m_host.SendUpdateToAllClients(PrimUpdateFlags.Sound);
}
}
@ -3241,7 +3241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate));
m_host.ScheduleTerseUpdate();
m_host.SendTerseUpdateToAllClients();
m_host.SendUpdateToAllClients(PrimUpdateFlags.AngularVelocity);
m_host.ParentGroup.HasGroupChanged = true;
}
@ -5467,7 +5467,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
pTexAnim.Start = (float)start;
part.AddTextureAnimation(pTexAnim);
part.SendFullUpdateToAllClients();
part.SendUpdateToAllClients(PrimUpdateFlags.TextureAnim);
part.ParentGroup.HasGroupChanged = true;
}
@ -6029,7 +6029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.AddNewParticleSystem(prules);
part.ParentGroup.HasGroupChanged = true;
}
part.SendFullUpdateToAllClients();
part.SendUpdateToAllClients(PrimUpdateFlags.Particles);
}
public void llGroundRepel(double height, int water, double tau)