diff options
author | UbitUmarov | 2016-09-03 07:51:53 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-03 07:51:53 +0100 |
commit | 9aec227767cf726216514d0494f11b5d8bf5b807 (patch) | |
tree | 8f308f4c1eefa19954fc30a560ac780f8a8e916a /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |
parent | merge issue (diff) | |
parent | tests making sure evering thing is coerently wrong.. (diff) | |
download | opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.zip opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.gz opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.bz2 opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 187 |
1 files changed, 81 insertions, 106 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f580e5a..fad250b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2801,6 +2801,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2801 | SendAgentGroupDataUpdate(AgentId,GroupMembership); | 2801 | SendAgentGroupDataUpdate(AgentId,GroupMembership); |
2802 | } | 2802 | } |
2803 | 2803 | ||
2804 | public void SendSelectedPartsProprieties(List<ISceneEntity> parts) | ||
2805 | { | ||
2806 | // udp part | ||
2807 | ObjectPropertiesPacket packet = | ||
2808 | (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); | ||
2809 | ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count]; | ||
2810 | |||
2811 | int i = 0; | ||
2812 | foreach(SceneObjectPart sop in parts) | ||
2813 | ObjectData[i++] = CreateObjectPropertiesBlock(sop); | ||
2814 | |||
2815 | packet.ObjectData = ObjectData; | ||
2816 | packet.Header.Zerocoded = true; | ||
2817 | // udp send splits this mega packets correctly | ||
2818 | // mb later will avoid that to reduce gc stress | ||
2819 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
2820 | |||
2821 | // caps physics part | ||
2822 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
2823 | if(eq == null) | ||
2824 | return; | ||
2825 | |||
2826 | OSDArray array = new OSDArray(); | ||
2827 | foreach(SceneObjectPart sop in parts) | ||
2828 | { | ||
2829 | OSDMap physinfo = new OSDMap(6); | ||
2830 | physinfo["LocalID"] = sop.LocalId; | ||
2831 | physinfo["Density"] = sop.Density; | ||
2832 | physinfo["Friction"] = sop.Friction; | ||
2833 | physinfo["GravityMultiplier"] = sop.GravityModifier; | ||
2834 | physinfo["Restitution"] = sop.Restitution; | ||
2835 | physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType; | ||
2836 | array.Add(physinfo); | ||
2837 | } | ||
2838 | |||
2839 | OSDMap llsdBody = new OSDMap(1); | ||
2840 | llsdBody.Add("ObjectData", array); | ||
2841 | |||
2842 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); | ||
2843 | } | ||
2844 | |||
2845 | |||
2804 | public void SendPartPhysicsProprieties(ISceneEntity entity) | 2846 | public void SendPartPhysicsProprieties(ISceneEntity entity) |
2805 | { | 2847 | { |
2806 | SceneObjectPart part = (SceneObjectPart)entity; | 2848 | SceneObjectPart part = (SceneObjectPart)entity; |
@@ -2882,18 +2924,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2882 | 2924 | ||
2883 | public void SendAsset(AssetRequestToClient req) | 2925 | public void SendAsset(AssetRequestToClient req) |
2884 | { | 2926 | { |
2927 | if (req.AssetInf == null) | ||
2928 | { | ||
2929 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset is null", | ||
2930 | LogHeader); | ||
2931 | return; | ||
2932 | } | ||
2933 | |||
2885 | if (req.AssetInf.Data == null) | 2934 | if (req.AssetInf.Data == null) |
2886 | { | 2935 | { |
2887 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", | 2936 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", |
2888 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2937 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2889 | return; | 2938 | return; |
2890 | } | 2939 | } |
2940 | |||
2891 | int WearableOut = 0; | 2941 | int WearableOut = 0; |
2892 | bool isWearable = false; | 2942 | bool isWearable = false; |
2893 | 2943 | ||
2894 | if (req.AssetInf != null) | 2944 | isWearable = ((AssetType) req.AssetInf.Type == |
2895 | isWearable = | ||
2896 | ((AssetType) req.AssetInf.Type == | ||
2897 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); | 2945 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); |
2898 | 2946 | ||
2899 | 2947 | ||
@@ -3013,7 +3061,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3013 | reply.Data.ParcelID = parcelID; | 3061 | reply.Data.ParcelID = parcelID; |
3014 | reply.Data.OwnerID = land.OwnerID; | 3062 | reply.Data.OwnerID = land.OwnerID; |
3015 | reply.Data.Name = Utils.StringToBytes(land.Name); | 3063 | reply.Data.Name = Utils.StringToBytes(land.Name); |
3016 | if (land != null && land.Description != null && land.Description != String.Empty) | 3064 | if (land.Description != null && land.Description != String.Empty) |
3017 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | 3065 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); |
3018 | else | 3066 | else |
3019 | reply.Data.Desc = new Byte[0]; | 3067 | reply.Data.Desc = new Byte[0]; |
@@ -4221,46 +4269,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4221 | 4269 | ||
4222 | if (!canUseImproved && !canUseCompressed) | 4270 | if (!canUseImproved && !canUseCompressed) |
4223 | { | 4271 | { |
4272 | ObjectUpdatePacket.ObjectDataBlock ablock; | ||
4224 | if (update.Entity is ScenePresence) | 4273 | if (update.Entity is ScenePresence) |
4225 | { | 4274 | ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); |
4226 | ObjectUpdatePacket.ObjectDataBlock ablock = | ||
4227 | CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
4228 | objectUpdateBlocks.Value.Add(ablock); | ||
4229 | maxUpdatesBytes -= ablock.Length; | ||
4230 | } | ||
4231 | else | 4275 | else |
4232 | { | 4276 | ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); |
4233 | ObjectUpdatePacket.ObjectDataBlock ablock = | 4277 | objectUpdateBlocks.Value.Add(ablock); |
4234 | CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); | 4278 | objectUpdates.Value.Add(update); |
4235 | objectUpdateBlocks.Value.Add(ablock); | 4279 | maxUpdatesBytes -= ablock.Length; |
4236 | maxUpdatesBytes -= ablock.Length; | 4280 | |
4237 | } | ||
4238 | } | 4281 | } |
4239 | else if (!canUseImproved) | 4282 | else if (!canUseImproved) |
4240 | { | 4283 | { |
4241 | ObjectUpdateCompressedPacket.ObjectDataBlock ablock = | 4284 | ObjectUpdateCompressedPacket.ObjectDataBlock ablock = |
4242 | CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); | 4285 | CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); |
4243 | compressedUpdateBlocks.Value.Add(ablock); | 4286 | compressedUpdateBlocks.Value.Add(ablock); |
4287 | compressedUpdates.Value.Add(update); | ||
4244 | maxUpdatesBytes -= ablock.Length; | 4288 | maxUpdatesBytes -= ablock.Length; |
4245 | } | 4289 | } |
4246 | else | 4290 | else |
4247 | { | 4291 | { |
4292 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock; | ||
4248 | if (update.Entity is ScenePresence) | 4293 | if (update.Entity is ScenePresence) |
4249 | { | 4294 | { |
4250 | // ALL presence updates go into a special list | 4295 | // ALL presence updates go into a special list |
4251 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = | 4296 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); |
4252 | CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
4253 | terseAgentUpdateBlocks.Value.Add(ablock); | 4297 | terseAgentUpdateBlocks.Value.Add(ablock); |
4254 | maxUpdatesBytes -= ablock.Length; | 4298 | terseAgentUpdates.Value.Add(update); |
4255 | } | 4299 | } |
4256 | else | 4300 | else |
4257 | { | 4301 | { |
4258 | // Everything else goes here | 4302 | // Everything else goes here |
4259 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = | 4303 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); |
4260 | CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
4261 | terseUpdateBlocks.Value.Add(ablock); | 4304 | terseUpdateBlocks.Value.Add(ablock); |
4262 | maxUpdatesBytes -= ablock.Length; | 4305 | terseUpdates.Value.Add(update); |
4263 | } | 4306 | } |
4307 | maxUpdatesBytes -= ablock.Length; | ||
4264 | } | 4308 | } |
4265 | 4309 | ||
4266 | #endregion Block Construction | 4310 | #endregion Block Construction |
@@ -4290,7 +4334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4290 | for (int i = 0; i < blocks.Count; i++) | 4334 | for (int i = 0; i < blocks.Count; i++) |
4291 | packet.ObjectData[i] = blocks[i]; | 4335 | packet.ObjectData[i] = blocks[i]; |
4292 | 4336 | ||
4293 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4337 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); |
4294 | } | 4338 | } |
4295 | 4339 | ||
4296 | if (objectUpdateBlocks.IsValueCreated) | 4340 | if (objectUpdateBlocks.IsValueCreated) |
@@ -4305,7 +4349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4305 | for (int i = 0; i < blocks.Count; i++) | 4349 | for (int i = 0; i < blocks.Count; i++) |
4306 | packet.ObjectData[i] = blocks[i]; | 4350 | packet.ObjectData[i] = blocks[i]; |
4307 | 4351 | ||
4308 | OutPacket(packet, ThrottleOutPacketType.Task, true); | 4352 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); |
4309 | } | 4353 | } |
4310 | 4354 | ||
4311 | if (compressedUpdateBlocks.IsValueCreated) | 4355 | if (compressedUpdateBlocks.IsValueCreated) |
@@ -4320,7 +4364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4320 | for (int i = 0; i < blocks.Count; i++) | 4364 | for (int i = 0; i < blocks.Count; i++) |
4321 | packet.ObjectData[i] = blocks[i]; | 4365 | packet.ObjectData[i] = blocks[i]; |
4322 | 4366 | ||
4323 | OutPacket(packet, ThrottleOutPacketType.Task, true); | 4367 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); |
4324 | } | 4368 | } |
4325 | 4369 | ||
4326 | if (terseUpdateBlocks.IsValueCreated) | 4370 | if (terseUpdateBlocks.IsValueCreated) |
@@ -5444,22 +5488,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5444 | Quaternion rotation; | 5488 | Quaternion rotation; |
5445 | byte[] textureEntry; | 5489 | byte[] textureEntry; |
5446 | 5490 | ||
5447 | if (entity is ScenePresence) | 5491 | if (avatar) |
5448 | { | 5492 | { |
5449 | ScenePresence presence = (ScenePresence)entity; | 5493 | ScenePresence presence = (ScenePresence)entity; |
5450 | 5494 | ||
5451 | position = presence.OffsetPosition; | 5495 | position = presence.OffsetPosition; |
5496 | velocity = presence.Velocity; | ||
5497 | acceleration = Vector3.Zero; | ||
5452 | rotation = presence.Rotation; | 5498 | rotation = presence.Rotation; |
5453 | angularVelocity = presence.AngularVelocity; | 5499 | angularVelocity = presence.AngularVelocity; |
5454 | rotation = presence.Rotation; | ||
5455 | 5500 | ||
5456 | // m_log.DebugFormat( | 5501 | // m_log.DebugFormat( |
5457 | // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); | 5502 | // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); |
5458 | 5503 | ||
5459 | attachPoint = presence.State; | 5504 | attachPoint = presence.State; |
5460 | collisionPlane = presence.CollisionPlane; | 5505 | collisionPlane = presence.CollisionPlane; |
5461 | velocity = presence.Velocity; | ||
5462 | acceleration = Vector3.Zero; | ||
5463 | 5506 | ||
5464 | if (sendTexture) | 5507 | if (sendTexture) |
5465 | { | 5508 | { |
@@ -7710,20 +7753,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7710 | return true; | 7753 | return true; |
7711 | } | 7754 | } |
7712 | #endregion | 7755 | #endregion |
7713 | 7756 | List<uint> thisSelection = new List<uint>(); | |
7714 | ObjectSelect handlerObjectSelect = null; | 7757 | ObjectSelect handlerObjectSelect = null; |
7715 | uint objID; | 7758 | uint objID; |
7716 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 7759 | handlerObjectSelect = OnObjectSelect; |
7760 | if (handlerObjectSelect != null) | ||
7717 | { | 7761 | { |
7718 | objID = incomingselect.ObjectData[i].ObjectLocalID; | 7762 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
7719 | if (!SelectedObjects.Contains(objID)) | ||
7720 | SelectedObjects.Add(objID); | ||
7721 | |||
7722 | handlerObjectSelect = OnObjectSelect; | ||
7723 | if (handlerObjectSelect != null) | ||
7724 | { | 7763 | { |
7725 | handlerObjectSelect(objID, this); | 7764 | objID = incomingselect.ObjectData[i].ObjectLocalID; |
7765 | thisSelection.Add(objID); | ||
7726 | } | 7766 | } |
7767 | |||
7768 | handlerObjectSelect(thisSelection, this); | ||
7727 | } | 7769 | } |
7728 | return true; | 7770 | return true; |
7729 | } | 7771 | } |
@@ -7746,8 +7788,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7746 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 7788 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
7747 | { | 7789 | { |
7748 | objID = incomingdeselect.ObjectData[i].ObjectLocalID; | 7790 | objID = incomingdeselect.ObjectData[i].ObjectLocalID; |
7749 | if (SelectedObjects.Contains(objID)) | ||
7750 | SelectedObjects.Remove(objID); | ||
7751 | 7791 | ||
7752 | handlerObjectDeselect = OnObjectDeselect; | 7792 | handlerObjectDeselect = OnObjectDeselect; |
7753 | if (handlerObjectDeselect != null) | 7793 | if (handlerObjectDeselect != null) |
@@ -7969,6 +8009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7969 | touchArgs.Add(arg); | 8009 | touchArgs.Add(arg); |
7970 | } | 8010 | } |
7971 | } | 8011 | } |
8012 | |||
7972 | handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, | 8013 | handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, |
7973 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); | 8014 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); |
7974 | } | 8015 | } |
@@ -12409,72 +12450,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12409 | /// <param name="simclient"></param> | 12450 | /// <param name="simclient"></param> |
12410 | /// <param name="packet"></param> | 12451 | /// <param name="packet"></param> |
12411 | /// <returns></returns> | 12452 | /// <returns></returns> |
12412 | // TODO: Convert old handler to use new method | ||
12413 | /* | ||
12414 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | ||
12415 | { | ||
12416 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | ||
12417 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | ||
12418 | |||
12419 | if (cachedtex.AgentData.SessionID != SessionId) | ||
12420 | return false; | ||
12421 | |||
12422 | |||
12423 | |||
12424 | // TODO: don't create new blocks if recycling an old packet | ||
12425 | cachedresp.AgentData.AgentID = AgentId; | ||
12426 | cachedresp.AgentData.SessionID = m_sessionId; | ||
12427 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | ||
12428 | m_cachedTextureSerial++; | ||
12429 | cachedresp.WearableData = | ||
12430 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | ||
12431 | |||
12432 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
12433 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | ||
12434 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | ||
12435 | |||
12436 | // Find the cached baked textures for this user, if they're available | ||
12437 | |||
12438 | IAssetService cache = m_scene.AssetService; | ||
12439 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
12440 | |||
12441 | WearableCacheItem[] cacheItems = null; | ||
12442 | |||
12443 | if (bakedTextureModule != null && cache != null) | ||
12444 | { | ||
12445 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
12446 | if (p.Appearance != null) | ||
12447 | { | ||
12448 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
12449 | { | ||
12450 | try | ||
12451 | { | ||
12452 | cacheItems = bakedTextureModule.Get(AgentId); | ||
12453 | p.Appearance.WearableCacheItems = cacheItems; | ||
12454 | p.Appearance.WearableCacheItemsDirty = false; | ||
12455 | } | ||
12456 | catch (Exception) | ||
12457 | { | ||
12458 | cacheItems = null; | ||
12459 | } | ||
12460 | |||
12461 | } | ||
12462 | else if (p.Appearance.WearableCacheItems != null) | ||
12463 | { | ||
12464 | cacheItems = p.Appearance.WearableCacheItems; | ||
12465 | } | ||
12466 | } | ||
12467 | } | ||
12468 | |||
12469 | CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; | ||
12470 | if (handlerCachedTextureRequest != null) | ||
12471 | { | ||
12472 | handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); | ||
12473 | } | ||
12474 | |||
12475 | return true; | ||
12476 | } | ||
12477 | */ | ||
12478 | 12453 | ||
12479 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | 12454 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) |
12480 | { | 12455 | { |