From d5f376a4b10ffdb5acc17d4e350a0a523ba0e9f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Aug 2016 09:51:34 +0100 Subject: [PATCH] send selected objects Proprieties udp part outside update queues and as a physics single caps message per selection request --- OpenSim/Framework/IClientAPI.cs | 2 + .../ClientStack/Linden/UDP/LLClientView.cs | 42 +++++++++++++++++++ .../Framework/Scenes/Scene.PacketHandlers.cs | 14 ++----- .../Server/IRCClientView.cs | 4 ++ .../OptionalModules/World/NPC/NPCAvatar.cs | 4 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 4 ++ 6 files changed, 59 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 6f2f834907..cafbd1f987 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1382,6 +1382,8 @@ namespace OpenSim.Framework void SendObjectPropertiesReply(ISceneEntity Entity); + void SendSelectedPartsProprieties(List parts); + void SendPartPhysicsProprieties(ISceneEntity Entity); void SendAgentOffline(UUID[] agentIDs); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 47869bdbbb..fad250b88b 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 SendAgentGroupDataUpdate(AgentId,GroupMembership); } + public void SendSelectedPartsProprieties(List parts) + { + // udp part + ObjectPropertiesPacket packet = + (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); + ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count]; + + int i = 0; + foreach(SceneObjectPart sop in parts) + ObjectData[i++] = CreateObjectPropertiesBlock(sop); + + packet.ObjectData = ObjectData; + packet.Header.Zerocoded = true; + // udp send splits this mega packets correctly + // mb later will avoid that to reduce gc stress + OutPacket(packet, ThrottleOutPacketType.Task, true); + + // caps physics part + IEventQueue eq = Scene.RequestModuleInterface(); + if(eq == null) + return; + + OSDArray array = new OSDArray(); + foreach(SceneObjectPart sop in parts) + { + OSDMap physinfo = new OSDMap(6); + physinfo["LocalID"] = sop.LocalId; + physinfo["Density"] = sop.Density; + physinfo["Friction"] = sop.Friction; + physinfo["GravityMultiplier"] = sop.GravityModifier; + physinfo["Restitution"] = sop.Restitution; + physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType; + array.Add(physinfo); + } + + OSDMap llsdBody = new OSDMap(1); + llsdBody.Add("ObjectData", array); + + eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); + } + + public void SendPartPhysicsProprieties(ISceneEntity entity) { SceneObjectPart part = (SceneObjectPart)entity; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index f8996d0505..4d491d177a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void SelectPrim(List primIDs, IClientAPI remoteClient) { - List needUpdates = new List(); + List needUpdates = new List(); foreach(uint primLocalID in primIDs) { @@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes if (sog == null) continue; - needUpdates.Add(part); + needUpdates.Add((ISceneEntity)part); // waste of time because properties do not send prim flags as they should // if a friend got or lost edit rights after login, a full update is needed @@ -196,15 +196,7 @@ namespace OpenSim.Region.Framework.Scenes } if(needUpdates.Count > 0) - { - // this will be replaced by single client function - // that will send the UDP and Caps part - foreach(SceneObjectPart part in needUpdates) - { - part.SendPropertiesToClient(remoteClient); - remoteClient.SendPartPhysicsProprieties(part); - } - } + remoteClient.SendSelectedPartsProprieties(needUpdates); } /// diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index e21d69fdb0..427b48ec73 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1753,6 +1753,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { } + public void SendSelectedPartsProprieties(List parts) + { + } + public void SendPartPhysicsProprieties(ISceneEntity entity) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 52e86609b8..07413cfd90 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1337,6 +1337,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } + public void SendSelectedPartsProprieties(List parts) + { + } + public void SendPartPhysicsProprieties(ISceneEntity entity) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 9b087c9be0..6a697f24f3 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1384,6 +1384,10 @@ namespace OpenSim.Tests.Common { } + public void SendSelectedPartsProprieties(List parts) + { + } + public void SendPartPhysicsProprieties(ISceneEntity entity) { }