diff options
author | John Hurliman | 2009-10-15 15:25:02 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-15 15:25:02 -0700 |
commit | d44b50ee462978b4899c0b142f6ecbfb553f06b6 (patch) | |
tree | 650046925796d20c18ed2e2028f951286d93662d | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.zip opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.gz opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.bz2 opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.xz |
* Removed some of the redundant broadcast functions in Scene and SceneGraph so it is clear who/what the broadcast is going to each time
* Removed two redundant parameters from SceneObjectPart
* Changed some code in terse update sending that was meant to work with references to work with value types (since Vector3 and Quaternion are structs)
* Committing a preview of a new method for sending object updates efficiently (all commented out for now)
9 files changed, 255 insertions, 68 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8487adc..82a2cdd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -51,6 +51,44 @@ using Nini.Config; | |||
51 | 51 | ||
52 | namespace OpenSim.Region.ClientStack.LindenUDP | 52 | namespace OpenSim.Region.ClientStack.LindenUDP |
53 | { | 53 | { |
54 | #region Enums | ||
55 | |||
56 | /// <summary> | ||
57 | /// Specifies the fields that have been changed when sending a prim or | ||
58 | /// avatar update | ||
59 | /// </summary> | ||
60 | [Flags] | ||
61 | public enum PrimUpdateFlags : uint | ||
62 | { | ||
63 | None = 0, | ||
64 | AttachmentPoint = 1 << 0, | ||
65 | Material = 1 << 1, | ||
66 | ClickAction = 1 << 2, | ||
67 | Scale = 1 << 3, | ||
68 | ParentID = 1 << 4, | ||
69 | PrimFlags = 1 << 5, | ||
70 | PrimData = 1 << 6, | ||
71 | MediaURL = 1 << 7, | ||
72 | ScratchPad = 1 << 8, | ||
73 | Textures = 1 << 9, | ||
74 | TextureAnim = 1 << 10, | ||
75 | NameValue = 1 << 11, | ||
76 | Position = 1 << 12, | ||
77 | Rotation = 1 << 13, | ||
78 | Velocity = 1 << 14, | ||
79 | Acceleration = 1 << 15, | ||
80 | AngularVelocity = 1 << 16, | ||
81 | CollisionPlane = 1 << 17, | ||
82 | Text = 1 << 18, | ||
83 | Particles = 1 << 19, | ||
84 | ExtraData = 1 << 20, | ||
85 | Sound = 1 << 21, | ||
86 | Joint = 1 << 22, | ||
87 | FullUpdate = UInt32.MaxValue | ||
88 | } | ||
89 | |||
90 | #endregion Enums | ||
91 | |||
54 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); | 92 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); |
55 | 93 | ||
56 | /// <summary> | 94 | /// <summary> |
@@ -3159,6 +3197,195 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3159 | 3197 | ||
3160 | #endregion | 3198 | #endregion |
3161 | 3199 | ||
3200 | #region Prim/Avatar Updates | ||
3201 | |||
3202 | /*void SendObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3203 | { | ||
3204 | bool canUseCompressed, canUseImproved; | ||
3205 | UpdateFlagsToPacketType(creatorFlags, updateFlags, out canUseCompressed, out canUseImproved); | ||
3206 | |||
3207 | if (!canUseImproved && !canUseCompressed) | ||
3208 | SendFullObjectUpdate(obj, creatorFlags, updateFlags); | ||
3209 | else if (!canUseImproved) | ||
3210 | SendObjectUpdateCompressed(obj, creatorFlags, updateFlags); | ||
3211 | else | ||
3212 | SendImprovedTerseObjectUpdate(obj, creatorFlags, updateFlags); | ||
3213 | } | ||
3214 | |||
3215 | void SendFullObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3216 | { | ||
3217 | IClientAPI owner; | ||
3218 | if (m_scene.ClientManager.TryGetValue(obj.OwnerID, out owner) && owner is LLClientView) | ||
3219 | { | ||
3220 | LLClientView llOwner = (LLClientView)owner; | ||
3221 | |||
3222 | // Send an update out to the owner | ||
3223 | ObjectUpdatePacket updateToOwner = new ObjectUpdatePacket(); | ||
3224 | updateToOwner.RegionData.RegionHandle = obj.RegionHandle; | ||
3225 | //updateToOwner.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); | ||
3226 | updateToOwner.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
3227 | updateToOwner.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags | creatorFlags | PrimFlags.ObjectYouOwner, 0); | ||
3228 | |||
3229 | m_udpServer.SendPacket(llOwner.UDPClient, updateToOwner, ThrottleOutPacketType.State, true); | ||
3230 | } | ||
3231 | |||
3232 | // Send an update out to everyone else | ||
3233 | ObjectUpdatePacket updateToOthers = new ObjectUpdatePacket(); | ||
3234 | updateToOthers.RegionData.RegionHandle = obj.RegionHandle; | ||
3235 | //updateToOthers.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); | ||
3236 | updateToOthers.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
3237 | updateToOthers.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags, 0); | ||
3238 | |||
3239 | m_scene.ClientManager.ForEach( | ||
3240 | delegate(IClientAPI client) | ||
3241 | { | ||
3242 | if (client.AgentId != obj.OwnerID && client is LLClientView) | ||
3243 | { | ||
3244 | LLClientView llClient = (LLClientView)client; | ||
3245 | m_udpServer.SendPacket(llClient.UDPClient, updateToOthers, ThrottleOutPacketType.State, true); | ||
3246 | } | ||
3247 | } | ||
3248 | ); | ||
3249 | } | ||
3250 | |||
3251 | void SendObjectUpdateCompressed(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3252 | { | ||
3253 | } | ||
3254 | |||
3255 | void SendImprovedTerseObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3256 | { | ||
3257 | } | ||
3258 | |||
3259 | void UpdateFlagsToPacketType(PrimFlags creatorFlags, PrimUpdateFlags updateFlags, out bool canUseCompressed, out bool canUseImproved) | ||
3260 | { | ||
3261 | canUseCompressed = true; | ||
3262 | canUseImproved = true; | ||
3263 | |||
3264 | if ((updateFlags & PrimUpdateFlags.FullUpdate) == PrimUpdateFlags.FullUpdate || creatorFlags != PrimFlags.None) | ||
3265 | { | ||
3266 | canUseCompressed = false; | ||
3267 | canUseImproved = false; | ||
3268 | } | ||
3269 | else | ||
3270 | { | ||
3271 | if ((updateFlags & PrimUpdateFlags.Velocity) != 0 || | ||
3272 | (updateFlags & PrimUpdateFlags.Acceleration) != 0 || | ||
3273 | (updateFlags & PrimUpdateFlags.CollisionPlane) != 0 || | ||
3274 | (updateFlags & PrimUpdateFlags.Joint) != 0) | ||
3275 | { | ||
3276 | canUseCompressed = false; | ||
3277 | } | ||
3278 | |||
3279 | if ((updateFlags & PrimUpdateFlags.PrimFlags) != 0 || | ||
3280 | (updateFlags & PrimUpdateFlags.ParentID) != 0 || | ||
3281 | (updateFlags & PrimUpdateFlags.Scale) != 0 || | ||
3282 | (updateFlags & PrimUpdateFlags.PrimData) != 0 || | ||
3283 | (updateFlags & PrimUpdateFlags.Text) != 0 || | ||
3284 | (updateFlags & PrimUpdateFlags.NameValue) != 0 || | ||
3285 | (updateFlags & PrimUpdateFlags.ExtraData) != 0 || | ||
3286 | (updateFlags & PrimUpdateFlags.TextureAnim) != 0 || | ||
3287 | (updateFlags & PrimUpdateFlags.Sound) != 0 || | ||
3288 | (updateFlags & PrimUpdateFlags.Particles) != 0 || | ||
3289 | (updateFlags & PrimUpdateFlags.Material) != 0 || | ||
3290 | (updateFlags & PrimUpdateFlags.ClickAction) != 0 || | ||
3291 | (updateFlags & PrimUpdateFlags.MediaURL) != 0 || | ||
3292 | (updateFlags & PrimUpdateFlags.Joint) != 0) | ||
3293 | { | ||
3294 | canUseImproved = false; | ||
3295 | } | ||
3296 | } | ||
3297 | } | ||
3298 | |||
3299 | static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlockFromPrim(SceneObjectPart prim, UUID assetID, PrimFlags flags, uint crc) | ||
3300 | { | ||
3301 | byte[] objectData = new byte[60]; | ||
3302 | prim.OffsetPosition.ToBytes(objectData, 0); | ||
3303 | prim.Velocity.ToBytes(objectData, 12); | ||
3304 | prim.Acceleration.ToBytes(objectData, 24); | ||
3305 | prim.RotationOffset.ToBytes(objectData, 36); | ||
3306 | prim.AngularVelocity.ToBytes(objectData, 48); | ||
3307 | |||
3308 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | ||
3309 | update.ClickAction = (byte)prim.ClickAction; | ||
3310 | update.CRC = crc; | ||
3311 | update.ExtraParams = prim.Shape.ExtraParams ?? Utils.EmptyBytes; | ||
3312 | update.Flags = (byte)flags; | ||
3313 | update.FullID = prim.UUID; | ||
3314 | update.ID = prim.LocalId; | ||
3315 | //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated | ||
3316 | //update.JointPivot = Vector3.Zero; | ||
3317 | //update.JointType = 0; | ||
3318 | update.Material = prim.Material; | ||
3319 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim | ||
3320 | if (prim.IsAttachment) | ||
3321 | update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + assetID); | ||
3322 | else | ||
3323 | update.NameValue = Utils.EmptyBytes; | ||
3324 | update.ObjectData = objectData; | ||
3325 | update.ParentID = prim.ParentID; | ||
3326 | update.PathBegin = prim.Shape.PathBegin; | ||
3327 | update.PathCurve = prim.Shape.PathCurve; | ||
3328 | update.PathEnd = prim.Shape.PathEnd; | ||
3329 | update.PathRadiusOffset = prim.Shape.PathRadiusOffset; | ||
3330 | update.PathRevolutions = prim.Shape.PathRevolutions; | ||
3331 | update.PathScaleX = prim.Shape.PathScaleX; | ||
3332 | update.PathScaleY = prim.Shape.PathScaleY; | ||
3333 | update.PathShearX = prim.Shape.PathShearX; | ||
3334 | update.PathShearY = prim.Shape.PathShearY; | ||
3335 | update.PathSkew = prim.Shape.PathSkew; | ||
3336 | update.PathTaperX = prim.Shape.PathTaperX; | ||
3337 | update.PathTaperY = prim.Shape.PathTaperY; | ||
3338 | update.PathTwist = prim.Shape.PathTwist; | ||
3339 | update.PathTwistBegin = prim.Shape.PathTwistBegin; | ||
3340 | update.PCode = prim.Shape.PCode; | ||
3341 | update.ProfileBegin = prim.Shape.ProfileBegin; | ||
3342 | update.ProfileCurve = prim.Shape.ProfileCurve; | ||
3343 | update.ProfileEnd = prim.Shape.ProfileEnd; | ||
3344 | update.ProfileHollow = prim.Shape.ProfileHollow; | ||
3345 | update.PSBlock = prim.ParticleSystem ?? Utils.EmptyBytes; | ||
3346 | update.TextColor = new Color4(prim.Color).GetBytes(true); | ||
3347 | update.TextureAnim = prim.TextureAnimation ?? Utils.EmptyBytes; | ||
3348 | update.TextureEntry = prim.Shape.TextureEntry ?? Utils.EmptyBytes; | ||
3349 | update.Scale = prim.Scale; | ||
3350 | update.State = prim.Shape.State; | ||
3351 | update.Text = Util.StringToBytes256(prim.Text); | ||
3352 | update.UpdateFlags = (uint)flags; | ||
3353 | |||
3354 | if (prim.Sound != UUID.Zero) | ||
3355 | { | ||
3356 | update.Sound = prim.Sound; | ||
3357 | update.OwnerID = prim.OwnerID; | ||
3358 | update.Gain = (float)prim.SoundGain; | ||
3359 | update.Radius = (float)prim.SoundRadius; | ||
3360 | } | ||
3361 | |||
3362 | switch ((PCode)prim.Shape.PCode) | ||
3363 | { | ||
3364 | case PCode.Grass: | ||
3365 | case PCode.Tree: | ||
3366 | case PCode.NewTree: | ||
3367 | update.Data = new byte[] { prim.Shape.State }; | ||
3368 | break; | ||
3369 | default: | ||
3370 | // TODO: Support ScratchPad | ||
3371 | //if (prim.ScratchPad != null) | ||
3372 | //{ | ||
3373 | // update.Data = new byte[prim.ScratchPad.Length]; | ||
3374 | // Buffer.BlockCopy(prim.ScratchPad, 0, update.Data, 0, update.Data.Length); | ||
3375 | //} | ||
3376 | //else | ||
3377 | //{ | ||
3378 | // update.Data = Utils.EmptyBytes; | ||
3379 | //} | ||
3380 | update.Data = Utils.EmptyBytes; | ||
3381 | break; | ||
3382 | } | ||
3383 | |||
3384 | return update; | ||
3385 | }*/ | ||
3386 | |||
3387 | #endregion Prim/Avatar Updates | ||
3388 | |||
3162 | #region Avatar Packet/data sending Methods | 3389 | #region Avatar Packet/data sending Methods |
3163 | 3390 | ||
3164 | /// <summary> | 3391 | /// <summary> |
@@ -3365,7 +3592,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3365 | return; | 3592 | return; |
3366 | if (primShape.PCode == 9 && primShape.State != 0 && parentID == 0) | 3593 | if (primShape.PCode == 9 && primShape.State != 0 && parentID == 0) |
3367 | return; | 3594 | return; |
3368 | 3595 | ||
3369 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) | 3596 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) |
3370 | rotation = Quaternion.Identity; | 3597 | rotation = Quaternion.Identity; |
3371 | 3598 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 66a9b5a..cd59bdb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -224,11 +224,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
224 | 224 | ||
225 | foreach (Scene s in m_scenes) | 225 | foreach (Scene s in m_scenes) |
226 | { | 226 | { |
227 | s.ForEachScenePresence(delegate(ScenePresence presence) | 227 | s.ForEachScenePresence( |
228 | { | 228 | delegate(ScenePresence presence) |
229 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, | 229 | { |
230 | c.Type, message, sourceType); | 230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); |
231 | }); | 231 | } |
232 | ); | ||
232 | } | 233 | } |
233 | } | 234 | } |
234 | 235 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 4896edf..3bb162e 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -756,7 +756,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
756 | 756 | ||
757 | public void sendRegionHandshakeToAll() | 757 | public void sendRegionHandshakeToAll() |
758 | { | 758 | { |
759 | m_scene.Broadcast(sendRegionHandshake); | 759 | m_scene.ForEachClient(sendRegionHandshake); |
760 | } | 760 | } |
761 | 761 | ||
762 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | 762 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d2b5cb1..332d3ce 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -1061,7 +1061,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1061 | { | 1061 | { |
1062 | land.LandData.OwnerID = ownerID; | 1062 | land.LandData.OwnerID = ownerID; |
1063 | 1063 | ||
1064 | m_scene.Broadcast(SendParcelOverlay); | 1064 | m_scene.ForEachClient(SendParcelOverlay); |
1065 | land.SendLandUpdateToClient(remote_client); | 1065 | land.SendLandUpdateToClient(remote_client); |
1066 | } | 1066 | } |
1067 | } | 1067 | } |
@@ -1083,7 +1083,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1083 | land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 1083 | land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
1084 | else | 1084 | else |
1085 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 1085 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
1086 | m_scene.Broadcast(SendParcelOverlay); | 1086 | m_scene.ForEachClient(SendParcelOverlay); |
1087 | land.SendLandUpdateToClient(remote_client); | 1087 | land.SendLandUpdateToClient(remote_client); |
1088 | } | 1088 | } |
1089 | } | 1089 | } |
@@ -1107,7 +1107,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1107 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 1107 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
1108 | land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 1108 | land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
1109 | land.LandData.IsGroupOwned = false; | 1109 | land.LandData.IsGroupOwned = false; |
1110 | m_scene.Broadcast(SendParcelOverlay); | 1110 | m_scene.ForEachClient(SendParcelOverlay); |
1111 | land.SendLandUpdateToClient(remote_client); | 1111 | land.SendLandUpdateToClient(remote_client); |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d3d397d..d13d4fb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1194,15 +1194,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | /// <summary> | 1196 | /// <summary> |
1197 | /// Perform delegate action on all clients subscribing to updates from this region. | ||
1198 | /// </summary> | ||
1199 | /// <returns></returns> | ||
1200 | public void Broadcast(Action<IClientAPI> whatToDo) | ||
1201 | { | ||
1202 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); | ||
1203 | } | ||
1204 | |||
1205 | /// <summary> | ||
1206 | /// Backup the scene. This acts as the main method of the backup thread. | 1197 | /// Backup the scene. This acts as the main method of the backup thread. |
1207 | /// </summary> | 1198 | /// </summary> |
1208 | /// <returns></returns> | 1199 | /// <returns></returns> |
@@ -3048,17 +3039,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3048 | } | 3039 | } |
3049 | 3040 | ||
3050 | m_eventManager.TriggerOnRemovePresence(agentID); | 3041 | m_eventManager.TriggerOnRemovePresence(agentID); |
3051 | Broadcast(delegate(IClientAPI client) | 3042 | ForEachClient( |
3052 | { | 3043 | delegate(IClientAPI client) |
3053 | try | 3044 | { |
3054 | { | 3045 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3055 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | 3046 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } |
3056 | } | 3047 | catch (NullReferenceException) { } |
3057 | catch (NullReferenceException) | 3048 | }); |
3058 | { | ||
3059 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | ||
3060 | } | ||
3061 | }); | ||
3062 | 3049 | ||
3063 | ForEachScenePresence( | 3050 | ForEachScenePresence( |
3064 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); | 3051 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
@@ -3143,7 +3130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3143 | return; | 3130 | return; |
3144 | } | 3131 | } |
3145 | } | 3132 | } |
3146 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3133 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |
3147 | } | 3134 | } |
3148 | 3135 | ||
3149 | #endregion | 3136 | #endregion |
@@ -4211,7 +4198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4211 | 4198 | ||
4212 | public void ForEachClient(Action<IClientAPI> action) | 4199 | public void ForEachClient(Action<IClientAPI> action) |
4213 | { | 4200 | { |
4214 | m_sceneGraph.ForEachClient(action); | 4201 | ClientManager.ForEach(action); |
4215 | } | 4202 | } |
4216 | 4203 | ||
4217 | public void ForEachSOG(Action<SceneObjectGroup> action) | 4204 | public void ForEachSOG(Action<SceneObjectGroup> action) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 9cd2247..04397ad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1107,23 +1107,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1107 | return UUID.Zero; | 1107 | return UUID.Zero; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | protected internal void ForEachClient(Action<IClientAPI> action) | ||
1111 | { | ||
1112 | List<ScenePresence> splist = GetScenePresences(); | ||
1113 | foreach (ScenePresence presence in splist) | ||
1114 | { | ||
1115 | try | ||
1116 | { | ||
1117 | action(presence.ControllingClient); | ||
1118 | } | ||
1119 | catch (Exception e) | ||
1120 | { | ||
1121 | // Catch it and move on. This includes situations where splist has inconsistent info | ||
1122 | m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message); | ||
1123 | } | ||
1124 | } | ||
1125 | } | ||
1126 | |||
1127 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) | 1110 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) |
1128 | { | 1111 | { |
1129 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); | 1112 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 801a7db..377cb6e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -853,16 +853,6 @@ if (m_shape != null) { | |||
853 | return m_offsetPosition + m_groupPosition; } | 853 | return m_offsetPosition + m_groupPosition; } |
854 | } | 854 | } |
855 | 855 | ||
856 | public UUID ObjectCreator | ||
857 | { | ||
858 | get { return _creatorID; } | ||
859 | } | ||
860 | |||
861 | public UUID ObjectOwner | ||
862 | { | ||
863 | get { return _ownerID; } | ||
864 | } | ||
865 | |||
866 | public SceneObjectGroup ParentGroup | 856 | public SceneObjectGroup ParentGroup |
867 | { | 857 | { |
868 | get { return m_parentGroup; } | 858 | get { return m_parentGroup; } |
@@ -1440,7 +1430,7 @@ if (m_shape != null) { | |||
1440 | // Move afterwards ResetIDs as it clears the localID | 1430 | // Move afterwards ResetIDs as it clears the localID |
1441 | dupe.LocalId = localID; | 1431 | dupe.LocalId = localID; |
1442 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1432 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1443 | dupe._lastOwnerID = ObjectOwner; | 1433 | dupe._lastOwnerID = OwnerID; |
1444 | 1434 | ||
1445 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 1435 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
1446 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 1436 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2a06f9e..387db44 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2455,11 +2455,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2455 | m_perfMonMS = Environment.TickCount; | 2455 | m_perfMonMS = Environment.TickCount; |
2456 | 2456 | ||
2457 | Vector3 pos = m_pos; | 2457 | Vector3 pos = m_pos; |
2458 | Vector3 vel = Velocity; | ||
2459 | Quaternion rot = m_bodyRot; | ||
2460 | pos.Z -= m_appearance.HipOffset; | 2458 | pos.Z -= m_appearance.HipOffset; |
2461 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), | 2459 | |
2462 | new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid); | 2460 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), |
2461 | LocalId, pos, Velocity, m_bodyRot, m_uuid); | ||
2463 | 2462 | ||
2464 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2463 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2465 | m_scene.StatsReporter.AddAgentUpdates(1); | 2464 | m_scene.StatsReporter.AddAgentUpdates(1); |
@@ -2473,7 +2472,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2473 | { | 2472 | { |
2474 | m_perfMonMS = Environment.TickCount; | 2473 | m_perfMonMS = Environment.TickCount; |
2475 | 2474 | ||
2476 | m_scene.Broadcast(SendTerseUpdateToClient); | 2475 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2477 | 2476 | ||
2478 | m_lastVelocity = m_velocity; | 2477 | m_lastVelocity = m_velocity; |
2479 | lastPhysPos = AbsolutePosition; | 2478 | lastPhysPos = AbsolutePosition; |
@@ -2774,7 +2773,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2774 | if (m_isChildAgent) | 2773 | if (m_isChildAgent) |
2775 | return; | 2774 | return; |
2776 | 2775 | ||
2777 | m_scene.Broadcast( | 2776 | m_scene.ForEachClient( |
2778 | delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); }); | 2777 | delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); }); |
2779 | } | 2778 | } |
2780 | 2779 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index ce50f9e..4521f8e 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
259 | if (e.InnerException != null) | 259 | if (e.InnerException != null) |
260 | m_log.Error("[MRM] " + e.InnerException); | 260 | m_log.Error("[MRM] " + e.InnerException); |
261 | 261 | ||
262 | m_scene.Broadcast(delegate(IClientAPI user) | 262 | m_scene.ForEachClient(delegate(IClientAPI user) |
263 | { | 263 | { |
264 | user.SendAlertMessage( | 264 | user.SendAlertMessage( |
265 | "MRM UnAuthorizedAccess: " + e); | 265 | "MRM UnAuthorizedAccess: " + e); |
@@ -268,7 +268,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
268 | catch (Exception e) | 268 | catch (Exception e) |
269 | { | 269 | { |
270 | m_log.Info("[MRM] Error: " + e); | 270 | m_log.Info("[MRM] Error: " + e); |
271 | m_scene.Broadcast(delegate(IClientAPI user) | 271 | m_scene.ForEachClient(delegate(IClientAPI user) |
272 | { | 272 | { |
273 | user.SendAlertMessage( | 273 | user.SendAlertMessage( |
274 | "Compile error while building MRM script, check OpenSim console for more information."); | 274 | "Compile error while building MRM script, check OpenSim console for more information."); |