From bf17da3d6182e7b5621318a220aa229036db98a1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Sep 2016 22:51:25 +0100 Subject: check for null target, minor cleanup --- .../Scripting/WorldComm/WorldCommModule.cs | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 483c25f..e314730 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -374,9 +374,11 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm if (channel == DEBUG_CHANNEL) return; - // Is id an avatar? - ScenePresence sp = m_scene.GetScenePresence(target); + if(target == UUID.Zero) + return; + // Is target an avatar? + ScenePresence sp = m_scene.GetScenePresence(target); if (sp != null) { // Send message to avatar @@ -407,13 +409,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm // Need to check each attachment foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { - if (li.GetHostID().Equals(id)) + UUID liHostID = li.GetHostID(); + if (liHostID.Equals(id)) continue; - - if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) + if (m_scene.GetSceneObjectPart(liHostID) == null) continue; - - if (targets.Contains(li.GetHostID())) + + if (targets.Contains(liHostID)) QueueMessage(new ListenerInfo(li, name, id, msg)); } @@ -426,16 +428,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { + UUID liHostID = li.GetHostID(); // Dont process if this message is from yourself! - if (li.GetHostID().Equals(id)) + if (liHostID.Equals(id)) continue; - SceneObjectPart sPart = m_scene.GetSceneObjectPart( - li.GetHostID()); - if (sPart == null) + if (m_scene.GetSceneObjectPart(liHostID) == null) continue; - if (li.GetHostID().Equals(target)) + if (liHostID.Equals(target)) { QueueMessage(new ListenerInfo(li, name, id, msg)); break; -- cgit v1.1 From bbe8ef0528248c64026aa262676c11b0448b68a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Sep 2016 02:05:25 +0100 Subject: mantis 8027: allow messages to be sent to attachments child prims in llRegionSayTo --- OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index e314730..e1c0cd7 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -403,10 +403,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm foreach (SceneObjectGroup sog in attachments) { if (!sog.IsDeleted) - targets.Add(sog.UUID); + { + SceneObjectPart[] parts = sog.Parts; + foreach(SceneObjectPart p in parts) + targets.Add(p.UUID); + } } - // Need to check each attachment foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { UUID liHostID = li.GetHostID(); -- cgit v1.1 From 94e983c95f2cb0d0366a856047c1b0dcab3b25ee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Sep 2016 17:05:05 +0100 Subject: mantis 8027: let osMessageAttachments also send to attachments child prims.. also changed its code structure and could not test --- .../Shared/Api/Implementation/OSSL_Api.cs | 158 +++++++++------------ 1 file changed, 65 insertions(+), 93 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4af4339..abb7d70 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3878,11 +3878,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); UUID targetUUID; + if(!UUID.TryParse(avatar.ToString(), out targetUUID)) + return; + + if(targetUUID == UUID.Zero) + return; + ScenePresence target; + if(!World.TryGetScenePresence(targetUUID, out target)) + return; - if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) + if(target.IsDeleted || target.IsInTransit) + return; + + List aps = new List(); + if(attachmentPoints.Length != 0) { - List aps = new List(); foreach (object point in attachmentPoints.Data) { int ipoint; @@ -3891,115 +3902,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api aps.Add(ipoint); } } + // parsing failed + if(aps.Count != attachmentPoints.Length) + return; + } - List attachments = new List(); - - bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); - bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; + List attachments = new List(); - if (msgAll && invertPoints) - { - return; - } - else if (msgAll || invertPoints) - { - attachments = target.GetAttachments(); - } - else - { - foreach (int point in aps) - { - if (point > 0) - { - attachments.AddRange(target.GetAttachments((uint)point)); - } - } - } + bool msgAll; + bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; - // if we have no attachments at this point, exit now - if (attachments.Count == 0) - { + if(aps.Count == 0) + { + if(!invertPoints) return; - } + msgAll = true; + invertPoints = false; + } + else + msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); - List ignoreThese = new List(); + if (msgAll && invertPoints) + return; - if (invertPoints) + if (msgAll || invertPoints) + { + attachments = target.GetAttachments(); + } + else + { + foreach (int point in aps) { - foreach (SceneObjectGroup attachment in attachments) + if (point > 0) { - if (aps.Contains((int)attachment.AttachmentPoint)) - { - ignoreThese.Add(attachment); - } + attachments.AddRange(target.GetAttachments((uint)point)); } } + } - foreach (SceneObjectGroup attachment in ignoreThese) - { - attachments.Remove(attachment); - } - ignoreThese.Clear(); - - // if inverting removed all attachments to check, exit now - if (attachments.Count < 1) - { - return; - } + // if we have no attachments at this point, exit now + if (attachments.Count == 0) + { + return; + } - if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0) - { - foreach (SceneObjectGroup attachment in attachments) - { - if (attachment.RootPart.CreatorID != m_host.CreatorID) - { - ignoreThese.Add(attachment); - } - } + bool optionObjCreator = (options & + ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0; + bool optionScriptCreator = (options & + ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0; - foreach (SceneObjectGroup attachment in ignoreThese) - { - attachments.Remove(attachment); - } - ignoreThese.Clear(); + UUID hostCreatorID = m_host.CreatorID; + UUID itemCreatorID = m_item.CreatorID; - // if filtering by same object creator removed all - // attachments to check, exit now - if (attachments.Count == 0) - { - return; - } - } + foreach (SceneObjectGroup sog in attachments) + { + if(sog.IsDeleted || sog.inTransit) + continue; - if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0) - { - foreach (SceneObjectGroup attachment in attachments) - { - if (attachment.RootPart.CreatorID != m_item.CreatorID) - { - ignoreThese.Add(attachment); - } - } + if (invertPoints && aps.Contains((int)sog.AttachmentPoint)) + continue; - foreach (SceneObjectGroup attachment in ignoreThese) - { - attachments.Remove(attachment); - } - ignoreThese.Clear(); + UUID CreatorID = sog.RootPart.CreatorID; + if (optionObjCreator && CreatorID != hostCreatorID) + continue; - // if filtering by object creator must match originating - // script creator removed all attachments to check, - // exit now - if (attachments.Count == 0) - { - return; - } - } + if (optionScriptCreator && CreatorID != itemCreatorID) + continue; - foreach (SceneObjectGroup attachment in attachments) - { - MessageObject(attachment.RootPart.UUID, message); - } + SceneObjectPart[] parts = sog.Parts; + foreach(SceneObjectPart p in parts) + MessageObject(p.UUID, message); } } -- cgit v1.1 From d3627c4f33d59568b909f4db5a7456e737e32250 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Sep 2016 19:25:04 +0100 Subject: no need to send wind on avatar arrival when it is sent periodicly --- OpenSim/Region/CoreModules/World/Wind/WindModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 35014f5..2f401bf 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; - m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; +// m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface(this); @@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules // Remove our hooks m_scene.EventManager.OnFrame -= WindUpdate; - m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; +// m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; } @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules SendWindAllClients(); } - +/* public void OnAgentEnteredRegion(ScenePresence avatar) { if (m_ready) @@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules avatar.ControllingClient.SendWindData(windSpeeds); } } - +*/ private void SendWindAllClients() { if (m_ready) -- cgit v1.1 From 720135207405be15b94a006de155353259a64944 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Sep 2016 22:08:21 +0100 Subject: bug fix: add a missing return; add some error messages --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index abb7d70..57bff6e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2664,13 +2664,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Key NpcCreate( string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent, bool hostGroupID) { - if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) + { + OSSLError("no permission to rez NPC at requested location"); return new LSL_Key(UUID.Zero.ToString()); + } INPCModule module = World.RequestModuleInterface(); if(module == null) - new LSL_Key(UUID.Zero.ToString()); + { + OSSLError("NPC module not enabled"); + return new LSL_Key(UUID.Zero.ToString()); + } string groupTitle = String.Empty; UUID groupID = UUID.Zero; -- cgit v1.1 From 984cb385831e6613fade75046d352a2f68f3ae2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 12:32:40 +0100 Subject: move wind generation out of heartbeat to a pool job. Use that to send to all clients and not one per client --- .../World/Wind/Plugins/ConfigurableWind.cs | 9 ++- .../World/Wind/Plugins/SimpleRandomWind.cs | 21 +++--- .../Region/CoreModules/World/Wind/WindModule.cs | 83 +++++++++++----------- .../Framework/Interfaces/IWindModelPlugin.cs | 2 +- 4 files changed, 56 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs index 6af4050..65691fe 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs @@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins } } - public void WindUpdate(uint frame) + public bool WindUpdate(uint frame) { double avgAng = m_avgDirection * (Math.PI/180.0f); double varDir = m_varDirection * (Math.PI/180.0f); @@ -125,10 +125,8 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins offset = Math.Sin(theta) * Math.Sin(theta*4) + (Math.Sin(theta*13) / 3); double windSpeed = m_avgStrength + (m_varStrength * offset); - if (windSpeed<0) - windSpeed=0; - - + if (windSpeed < 0) + windSpeed = -windSpeed; m_curPredominateWind.X = (float)Math.Cos(windDir); m_curPredominateWind.Y = (float)Math.Sin(windDir); @@ -144,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins m_windSpeeds[y * 16 + x] = m_curPredominateWind; } } + return true; } public Vector3 WindSpeed(float fX, float fY, float fZ) diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs index fcb0c10..d2ff7b3 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs @@ -82,22 +82,23 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins } } - public void WindUpdate(uint frame) + public bool WindUpdate(uint frame) { //Make sure our object is valid (we haven't been disposed of yet) - if (m_windSpeeds != null) + if (m_windSpeeds == null) + return false; + + for (int y = 0; y < 16; y++) { - for (int y = 0; y < 16; y++) + for (int x = 0; x < 16; x++) { - for (int x = 0; x < 16; x++) - { - m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 - m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 - m_windSpeeds[y * 16 + x].X *= m_strength; - m_windSpeeds[y * 16 + x].Y *= m_strength; - } + m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 + m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 + m_windSpeeds[y * 16 + x].X *= m_strength; + m_windSpeeds[y * 16 + x].Y *= m_strength; } } + return true; } public Vector3 WindSpeed(float fX, float fY, float fZ) diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 2f401bf..9f13d90 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules //private Random m_rndnums = new Random(Environment.TickCount); private Scene m_scene = null; private bool m_ready = false; + private bool m_inUpdate = false; private bool m_enabled = false; private IConfig m_windConfig; @@ -160,7 +161,7 @@ namespace OpenSim.Region.CoreModules m_scene.RegisterModuleInterface(this); // Generate initial wind values - GenWindPos(); + GenWind(); // Mark Module Ready for duty m_ready = true; @@ -416,67 +417,63 @@ namespace OpenSim.Region.CoreModules /// public void WindUpdate() { - if (((m_frame++ % m_frameUpdateRate) != 0) || !m_ready) - { + if ((!m_ready || m_inUpdate || (m_frame++ % m_frameUpdateRate) != 0)) return; - } - GenWindPos(); - - SendWindAllClients(); - } -/* - public void OnAgentEnteredRegion(ScenePresence avatar) - { - if (m_ready) + m_inUpdate = true; + Util.FireAndForget(delegate { - if (m_activeWindPlugin != null) + try { - // Ask wind plugin to generate a LL wind array to be cached locally - // Try not to update this too often, as it may involve array copies - if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate)) - { - windSpeeds = m_activeWindPlugin.WindLLClientArray(); - m_frameLastUpdateClientArray = m_frame; - } - } + if(GenWind()) + windSpeeds = m_activeWindPlugin.WindLLClientArray(); - avatar.ControllingClient.SendWindData(windSpeeds); - } + m_scene.ForEachRootClient(delegate(IClientAPI client) + { + client.SendWindData(windSpeeds); + }); + + } + finally + { + m_inUpdate = false; + } + }, + null, "WindModuleUpdate"); } -*/ +/* private void SendWindAllClients() { - if (m_ready) - { - if (m_scene.GetRootAgentCount() > 0) - { - // Ask wind plugin to generate a LL wind array to be cached locally - // Try not to update this too often, as it may involve array copies - if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate)) - { - windSpeeds = m_activeWindPlugin.WindLLClientArray(); - m_frameLastUpdateClientArray = m_frame; - } + if (!m_ready || m_scene.GetRootAgentCount() == 0) + return; - m_scene.ForEachRootClient(delegate(IClientAPI client) - { - client.SendWindData(windSpeeds); - }); - } + // Ask wind plugin to generate a LL wind array to be cached locally + // Try not to update this too often, as it may involve array copies + if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate)) + { + windSpeeds = m_activeWindPlugin.WindLLClientArray(); + m_frameLastUpdateClientArray = m_frame; } + + m_scene.ForEachRootClient(delegate(IClientAPI client) + { + client.SendWindData(windSpeeds); + }); } +*/ /// - /// Calculate the sun's orbital position and its velocity. + /// Calculate new wind + /// returns false if no change /// - private void GenWindPos() + private bool GenWind() { if (m_activeWindPlugin != null) { // Tell Wind Plugin to update it's wind data - m_activeWindPlugin.WindUpdate(m_frame); + return m_activeWindPlugin.WindUpdate(m_frame); } + return false; } } } diff --git a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs index 16b6024..b4bc15c 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Update wind. /// - void WindUpdate(uint frame); + bool WindUpdate(uint frame); /// /// Returns the wind vector at the given local region coordinates. -- cgit v1.1 From a6df626868c9715288b2ef025efe18a015256a74 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 13:03:16 +0100 Subject: add a version tag to wind and cloud data updates to iclient --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 +++++++---- OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs | 2 +- OpenSim/Region/CoreModules/World/Wind/WindModule.cs | 2 +- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 4 ++-- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2d337f1..15f1004 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1379,16 +1379,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send the wind matrix to the client /// /// 16x16 array of wind speeds +/* public virtual void SendWindData(Vector2[] windSpeeds) { Util.FireAndForget(DoSendWindData, windSpeeds, "LLClientView.SendWindData"); + DoSendWindData(windSpeeds); } - +*/ /// /// Send the cloud matrix to the client /// /// 16x16 array of cloud densities - public virtual void SendCloudData(float[] cloudDensity) + public virtual void SendCloudData(int version, float[] cloudDensity) { Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); } @@ -1397,9 +1399,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send wind layer information to the client. /// /// - private void DoSendWindData(object o) +// private void DoSendWindData(object o) + public virtual void SendWindData(int version, Vector2[] windSpeeds) { - Vector2[] windSpeeds = (Vector2[])o; +// Vector2[] windSpeeds = (Vector2[])o; TerrainPatch[] patches = new TerrainPatch[2]; patches[0] = new TerrainPatch { Data = new float[16 * 16] }; patches[1] = new TerrainPatch { Data = new float[16 * 16] }; diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index d217f36..f304307 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.World { if (m_ready) { - client.SendCloudData(cloudCover); + client.SendCloudData(0, cloudCover); } } diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 9f13d90..f1de0bc 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules m_scene.ForEachRootClient(delegate(IClientAPI client) { - client.SendWindData(windSpeeds); + client.SendWindData(0, windSpeeds); }); } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 427b48e..15d31bd 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1023,12 +1023,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendWindData(Vector2[] windSpeeds) + public void SendWindData(int version, Vector2[] windSpeeds) { } - public void SendCloudData(float[] cloudCover) + public void SendCloudData(int version, float[] cloudCover) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 07413cf..1ad71ba 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -724,9 +724,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public virtual void SendWindData(Vector2[] windSpeeds) { } + public virtual void SendWindData(int version, Vector2[] windSpeeds) { } - public virtual void SendCloudData(float[] cloudCover) { } + public virtual void SendCloudData(int version, float[] cloudCover) { } public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { -- cgit v1.1 From 8d7f10e36bbb4de101b900f6b455de09c47d079c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 13:55:23 +0100 Subject: cache wind compressed data so cpu burning compression is only done after a change. Not happy with version scheme for several regions on same instance, but should be ok for now --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 48 ++++++++++++++++------ .../Region/CoreModules/World/Wind/WindModule.cs | 47 ++++++--------------- 2 files changed, 49 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 15f1004..5f8d8f1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1395,6 +1395,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); } + // wind caching + private static int lastWindVersion = 0; + private static List lastWindPackets = new List(); + + /// /// Send wind layer information to the client. /// @@ -1403,22 +1408,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void SendWindData(int version, Vector2[] windSpeeds) { // Vector2[] windSpeeds = (Vector2[])o; - TerrainPatch[] patches = new TerrainPatch[2]; - patches[0] = new TerrainPatch { Data = new float[16 * 16] }; - patches[1] = new TerrainPatch { Data = new float[16 * 16] }; + + bool isNewData; + lock(lastWindPackets) + isNewData = lastWindVersion != version; - for (int x = 0; x < 16 * 16; x++) + if(isNewData) { - patches[0].Data[x] = windSpeeds[x].X; - patches[1].Data[x] = windSpeeds[x].Y; - } + TerrainPatch[] patches = new TerrainPatch[2]; + patches[0] = new TerrainPatch { Data = new float[16 * 16] }; + patches[1] = new TerrainPatch { Data = new float[16 * 16] }; - // neither we or viewers have extended wind - byte layerType = (byte)TerrainPatch.LayerType.Wind; + for (int x = 0; x < 16 * 16; x++) + { + patches[0].Data[x] = windSpeeds[x].X; + patches[1].Data[x] = windSpeeds[x].Y; + } - LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); - layerpack.Header.Zerocoded = true; - OutPacket(layerpack, ThrottleOutPacketType.Wind); + // neither we or viewers have extended wind + byte layerType = (byte)TerrainPatch.LayerType.Wind; + + LayerDataPacket layerpack = + OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize( + patches, layerType); + layerpack.Header.Zerocoded = true; + lock(lastWindPackets) + { + lastWindPackets.Clear(); + lastWindPackets.Add(layerpack); + lastWindVersion = version; + } + } + + lock(lastWindPackets) + foreach(LayerDataPacket pkt in lastWindPackets) + OutPacket(pkt, ThrottleOutPacketType.Wind); } /// diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index f1de0bc..bc92582 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -46,7 +46,8 @@ namespace OpenSim.Region.CoreModules private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private uint m_frame = 0; - private uint m_frameLastUpdateClientArray = 0; + private int m_dataVersion = 0; + private int m_regionID = 0; private int m_frameUpdateRate = 150; //private Random m_rndnums = new Random(Environment.TickCount); private Scene m_scene = null; @@ -97,7 +98,6 @@ namespace OpenSim.Region.CoreModules m_scene = scene; m_frame = 0; - // Register all the Wind Model Plug-ins foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) { @@ -119,7 +119,6 @@ namespace OpenSim.Region.CoreModules } } - // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { @@ -155,14 +154,14 @@ namespace OpenSim.Region.CoreModules // Register event handlers for when Avatars enter the region, and frame ticks m_scene.EventManager.OnFrame += WindUpdate; -// m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; // Register the wind module m_scene.RegisterModuleInterface(this); // Generate initial wind values GenWind(); - + // hopefully this will not be the same for all regions on same instance + m_dataVersion = (int)m_scene.AllocateLocalId(); // Mark Module Ready for duty m_ready = true; } @@ -425,13 +424,11 @@ namespace OpenSim.Region.CoreModules { try { - if(GenWind()) - windSpeeds = m_activeWindPlugin.WindLLClientArray(); - - m_scene.ForEachRootClient(delegate(IClientAPI client) - { - client.SendWindData(0, windSpeeds); - }); + GenWind(); + m_scene.ForEachRootClient(delegate(IClientAPI client) + { + client.SendWindData(m_dataVersion, windSpeeds); + }); } finally @@ -441,26 +438,7 @@ namespace OpenSim.Region.CoreModules }, null, "WindModuleUpdate"); } -/* - private void SendWindAllClients() - { - if (!m_ready || m_scene.GetRootAgentCount() == 0) - return; - // Ask wind plugin to generate a LL wind array to be cached locally - // Try not to update this too often, as it may involve array copies - if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate)) - { - windSpeeds = m_activeWindPlugin.WindLLClientArray(); - m_frameLastUpdateClientArray = m_frame; - } - - m_scene.ForEachRootClient(delegate(IClientAPI client) - { - client.SendWindData(windSpeeds); - }); - } -*/ /// /// Calculate new wind /// returns false if no change @@ -468,10 +446,11 @@ namespace OpenSim.Region.CoreModules private bool GenWind() { - if (m_activeWindPlugin != null) + if (m_activeWindPlugin != null && m_activeWindPlugin.WindUpdate(m_frame)) { - // Tell Wind Plugin to update it's wind data - return m_activeWindPlugin.WindUpdate(m_frame); + windSpeeds = m_activeWindPlugin.WindLLClientArray(); + m_dataVersion++; + return true; } return false; } -- cgit v1.1 From f5189b2cdd672734137a76f46379d225ed7c79e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 16:04:43 +0100 Subject: do the same for legacy clouds (still visible on older viewer ie singu 1.8.7). Fix clouds update. Send clouds and wind also to child agents. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 ++++++++++++++------ .../Region/CoreModules/World/Cloud/CloudModule.cs | 57 +++++++++++++++++----- .../Region/CoreModules/World/Wind/WindModule.cs | 2 +- 3 files changed, 84 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5f8d8f1..90f0336 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1390,11 +1390,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send the cloud matrix to the client /// /// 16x16 array of cloud densities +/* public virtual void SendCloudData(int version, float[] cloudDensity) { Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); } - +*/ // wind caching private static int lastWindVersion = 0; private static List lastWindPackets = new List(); @@ -1445,30 +1446,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(pkt, ThrottleOutPacketType.Wind); } + // cloud caching + private static int lastCloudVersion = 0; + private static List lastCloudPackets = new List(); + /// /// Send cloud layer information to the client. /// /// - private void DoSendCloudData(object o) +// private void DoSendCloudData(object o) + public virtual void SendCloudData(int version, float[] cloudDensity) { - float[] cloudCover = (float[])o; - TerrainPatch[] patches = new TerrainPatch[1]; - patches[0] = new TerrainPatch(); - patches[0].Data = new float[16 * 16]; +// float[] cloudDensity = (float[])o; + bool isNewData; + lock(lastCloudPackets) + isNewData = lastCloudVersion != version; - for (int y = 0; y < 16; y++) + if(isNewData) { - for (int x = 0; x < 16; x++) + TerrainPatch[] patches = new TerrainPatch[1]; + patches[0] = new TerrainPatch(); + patches[0].Data = new float[16 * 16]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + patches[0].Data[y * 16 + x] = cloudDensity[y * 16 + x]; + } + } + // neither we or viewers have extended clouds + byte layerType = (byte)TerrainPatch.LayerType.Cloud; + + LayerDataPacket layerpack = + OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize( + patches, layerType); + layerpack.Header.Zerocoded = true; + lock(lastCloudPackets) { - patches[0].Data[y * 16 + x] = cloudCover[y * 16 + x]; + lastCloudPackets.Clear(); + lastCloudPackets.Add(layerpack); + lastCloudVersion = version; } } - // neither we or viewers have extended clouds - byte layerType = (byte)TerrainPatch.LayerType.Cloud; - LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); - layerpack.Header.Zerocoded = true; - OutPacket(layerpack, ThrottleOutPacketType.Cloud); + lock(lastCloudPackets) + foreach(LayerDataPacket pkt in lastCloudPackets) + OutPacket(pkt, ThrottleOutPacketType.Cloud); } /// diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index f304307..3c2884b 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Threading; using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -49,6 +50,10 @@ namespace OpenSim.Region.CoreModules.World private bool m_enabled = false; private float m_cloudDensity = 1.0F; private float[] cloudCover = new float[16 * 16]; + private int m_dataVersion; + private bool m_busy; + private object cloudlock = new object(); + public void Initialise(IConfigSource config) { @@ -70,11 +75,13 @@ namespace OpenSim.Region.CoreModules.World m_scene = scene; - scene.EventManager.OnNewClient += CloudsToClient; scene.RegisterModuleInterface(this); - scene.EventManager.OnFrame += CloudUpdate; GenerateCloudCover(); + m_dataVersion = (int)m_scene.AllocateLocalId(); + + scene.EventManager.OnNewClient += CloudsToClient; + scene.EventManager.OnFrame += CloudUpdate; m_ready = true; } @@ -89,7 +96,6 @@ namespace OpenSim.Region.CoreModules.World m_scene.EventManager.OnNewClient -= CloudsToClient; m_scene.EventManager.OnFrame -= CloudUpdate; m_scene.UnregisterModuleInterface(this); - m_scene = null; } @@ -127,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World if (cloudCover != null) { - cover = cloudCover[y * 16 + x]; + lock(cloudlock) + cover = cloudCover[y * 16 + x]; } return cover; @@ -188,22 +195,48 @@ namespace OpenSim.Region.CoreModules.World } } Array.Copy(newCover, cloudCover, 16 * 16); + m_dataVersion++; } - private void CloudUpdate() - { - if (((m_frame++ % m_frameUpdateRate) != 0) || !m_ready || (m_cloudDensity == 0)) - { - return; - } - UpdateCloudCover(); + private void CloudUpdate() + { + if ((!m_ready || m_cloudDensity == 0 || (m_frame++ % m_frameUpdateRate) != 0)) + { + return; + } + + if(Monitor.TryEnter(cloudlock)) + { + m_busy = true; + Util.FireAndForget(delegate + { + try + { + lock(cloudlock) + { + UpdateCloudCover(); + m_scene.ForEachClient(delegate(IClientAPI client) + { + client.SendCloudData(m_dataVersion, cloudCover); + }); + } + } + finally + { + m_busy = false; + } + }, + null, "CloudModuleUpdate"); + Monitor.Exit(cloudlock); + } } public void CloudsToClient(IClientAPI client) { if (m_ready) { - client.SendCloudData(0, cloudCover); + lock(cloudlock) + client.SendCloudData(m_dataVersion, cloudCover); } } diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index bc92582..95cf57d 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules try { GenWind(); - m_scene.ForEachRootClient(delegate(IClientAPI client) + m_scene.ForEachClient(delegate(IClientAPI client) { client.SendWindData(m_dataVersion, windSpeeds); }); -- cgit v1.1 From 22b531f2e4918589cb337a5a429215aa40a50fa5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 17:13:59 +0100 Subject: make clouds a bit diferent on regions running on same instance.. well should be diferent .. :) --- OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index 3c2884b..a18225b 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.CoreModules.World // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private uint m_frame = 0; private int m_frameUpdateRate = 1000; - private Random m_rndnums = new Random(Environment.TickCount); + private Random m_rndnums; private Scene m_scene = null; private bool m_ready = false; private bool m_enabled = false; @@ -76,6 +76,10 @@ namespace OpenSim.Region.CoreModules.World m_scene = scene; scene.RegisterModuleInterface(this); + int seed = Environment.TickCount; + seed += (int)(scene.RegionInfo.RegionLocX << 16); + seed += (int)(scene.RegionInfo.RegionLocY); + m_rndnums = new Random(seed); GenerateCloudCover(); m_dataVersion = (int)m_scene.AllocateLocalId(); -- cgit v1.1 From f613b5f5177d153eaf3180ebf286fdd1a149cc8c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 18:28:46 +0100 Subject: fix caching of wind and cloud packets in the case of several regions on a instance, that got broken with the necessary send to child agents. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 87 +++++++++++----------- .../Region/CoreModules/World/Cloud/CloudModule.cs | 5 +- 2 files changed, 46 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 90f0336..8194260 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1375,44 +1375,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - /// - /// Send the wind matrix to the client - /// - /// 16x16 array of wind speeds -/* - public virtual void SendWindData(Vector2[] windSpeeds) - { - Util.FireAndForget(DoSendWindData, windSpeeds, "LLClientView.SendWindData"); - DoSendWindData(windSpeeds); - } -*/ - /// - /// Send the cloud matrix to the client - /// - /// 16x16 array of cloud densities -/* - public virtual void SendCloudData(int version, float[] cloudDensity) - { - Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); - } -*/ + // wind caching - private static int lastWindVersion = 0; - private static List lastWindPackets = new List(); + private static Dictionary lastWindVersion = new Dictionary(); + private static Dictionary> lastWindPackets = + new Dictionary>(); /// - /// Send wind layer information to the client. + /// Send the wind matrix to the client /// - /// -// private void DoSendWindData(object o) + /// 16x16 array of wind speeds public virtual void SendWindData(int version, Vector2[] windSpeeds) { // Vector2[] windSpeeds = (Vector2[])o; + ulong handle = this.Scene.RegionInfo.RegionHandle; bool isNewData; lock(lastWindPackets) - isNewData = lastWindVersion != version; + { + if(!lastWindVersion.ContainsKey(handle) || + !lastWindPackets.ContainsKey(handle)) + { + lastWindVersion[handle] = 0; + lastWindPackets[handle] = new List(); + isNewData = true; + } + else + isNewData = lastWindVersion[handle] != version; + } if(isNewData) { @@ -1435,32 +1426,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP layerpack.Header.Zerocoded = true; lock(lastWindPackets) { - lastWindPackets.Clear(); - lastWindPackets.Add(layerpack); - lastWindVersion = version; + lastWindPackets[handle].Clear(); + lastWindPackets[handle].Add(layerpack); + lastWindVersion[handle] = version; } } lock(lastWindPackets) - foreach(LayerDataPacket pkt in lastWindPackets) + foreach(LayerDataPacket pkt in lastWindPackets[handle]) OutPacket(pkt, ThrottleOutPacketType.Wind); } // cloud caching - private static int lastCloudVersion = 0; - private static List lastCloudPackets = new List(); + private static Dictionary lastCloudVersion = new Dictionary(); + private static Dictionary> lastCloudPackets = + new Dictionary>(); /// - /// Send cloud layer information to the client. + /// Send the cloud matrix to the client /// - /// -// private void DoSendCloudData(object o) + /// 16x16 array of cloud densities public virtual void SendCloudData(int version, float[] cloudDensity) { -// float[] cloudDensity = (float[])o; + ulong handle = this.Scene.RegionInfo.RegionHandle; bool isNewData; - lock(lastCloudPackets) - isNewData = lastCloudVersion != version; + lock(lastWindPackets) + { + if(!lastCloudVersion.ContainsKey(handle) || + !lastCloudPackets.ContainsKey(handle)) + { + lastCloudVersion[handle] = 0; + lastCloudPackets[handle] = new List(); + isNewData = true; + } + else + isNewData = lastCloudVersion[handle] != version; + } if(isNewData) { @@ -1484,14 +1485,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP layerpack.Header.Zerocoded = true; lock(lastCloudPackets) { - lastCloudPackets.Clear(); - lastCloudPackets.Add(layerpack); - lastCloudVersion = version; + lastCloudPackets[handle].Clear(); + lastCloudPackets[handle].Add(layerpack); + lastCloudVersion[handle] = version; } } lock(lastCloudPackets) - foreach(LayerDataPacket pkt in lastCloudPackets) + foreach(LayerDataPacket pkt in lastCloudPackets[handle]) OutPacket(pkt, ThrottleOutPacketType.Cloud); } diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index a18225b..617c348 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -204,10 +204,9 @@ namespace OpenSim.Region.CoreModules.World private void CloudUpdate() { - if ((!m_ready || m_cloudDensity == 0 || (m_frame++ % m_frameUpdateRate) != 0)) - { + if ((!m_ready || m_busy || m_cloudDensity == 0 || + (m_frame++ % m_frameUpdateRate) != 0)) return; - } if(Monitor.TryEnter(cloudlock)) { -- cgit v1.1 From d196958cc4cb3da580e0bd5b807074a560b677ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 18:56:47 +0100 Subject: make sendRegionInfoPacketToAll really send to all ( inc child agents) thx Jak Daniels --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 425562f..87fb0db 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1360,7 +1360,8 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - Scene.ForEachRootClient(delegate(IClientAPI client) +// Scene.ForEachRootClient(delegate(IClientAPI client) + Scene.ForEachClient(delegate(IClientAPI client) { HandleRegionInfoRequest(client); }); -- cgit v1.1 From 42989176ec374cdaaac3dd27eb6203601fa6a5d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 19:27:25 +0100 Subject: mute a debug message to mute jak daniels --- OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs index ec5af2b..1dcaed3 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Estate sr.Close(); body = body.Trim(); - m_log.DebugFormat("[XESTATE HANDLER]: query String: {0}", body); + // m_log.DebugFormat("[XESTATE HANDLER]: query String: {0}", body); try { -- cgit v1.1 From 9e074988f0f3ffb78171db7fabb65839afdc48f1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 24 Sep 2016 18:16:30 +0100 Subject: remove a redundant and potencially dangerous child.AbsolutePosition = child.AbsolutePosition --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 77c66b6..8fc807a 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1865,7 +1865,8 @@ namespace OpenSim.Region.Framework.Scenes // this is here so physics gets updated! // Don't remove! Bad juju! Stay away! or fix physics! - child.AbsolutePosition = child.AbsolutePosition; + // already done in LinkToGroup +// child.AbsolutePosition = child.AbsolutePosition; } } -- cgit v1.1 From 6779f41e217ac2d401c3adf319ff307c46bc4dd3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 24 Sep 2016 22:21:51 +0100 Subject: fix linknumbers when unlink the root prim --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 116 +++++++++------------ .../Region/Framework/Scenes/SceneObjectGroup.cs | 111 +++++++++++++++++++- 2 files changed, 157 insertions(+), 70 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8fc807a..238ec8e 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1913,31 +1913,36 @@ namespace OpenSim.Region.Framework.Scenes // foreach (SceneObjectPart part in prims) { - if (part != null) + if(part == null) + continue; + SceneObjectGroup parentSOG = part.ParentGroup; + if(parentSOG == null || + parentSOG.IsDeleted || + parentSOG.inTransit || + parentSOG.PrimCount == 1) + continue; + + if (!affectedGroups.Contains(parentSOG)) { - if (part.KeyframeMotion != null) - { - part.KeyframeMotion.Stop(); - part.KeyframeMotion = null; - } - if (part.ParentGroup.PrimCount != 1) // Skip single - { - if (part.LinkNum < 2) // Root - { - rootParts.Add(part); - } - else - { - part.LastOwnerID = part.ParentGroup.RootPart.LastOwnerID; - childParts.Add(part); - } + affectedGroups.Add(parentSOG); + if(parentSOG.RootPart.PhysActor != null) + parentSOG.RootPart.PhysActor.Building = true; + } - SceneObjectGroup group = part.ParentGroup; - if (!affectedGroups.Contains(group)) - { - affectedGroups.Add(group); - } - } + if (part.KeyframeMotion != null) + { + part.KeyframeMotion.Stop(); + part.KeyframeMotion = null; + } + + if (part.LinkNum < 2) // Root + { + rootParts.Add(part); + } + else + { + part.LastOwnerID = part.ParentGroup.RootPart.LastOwnerID; + childParts.Add(part); } } @@ -1946,8 +1951,8 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart child in childParts) { // Unlink all child parts from their groups - // child.ParentGroup.DelinkFromGroup(child, true); + //child.ParentGroup is now other child.ParentGroup.HasGroupChanged = true; child.ParentGroup.ScheduleGroupForFullUpdate(); } @@ -1960,74 +1965,51 @@ namespace OpenSim.Region.Framework.Scenes // However, editing linked parts and unlinking may be different // SceneObjectGroup group = root.ParentGroup; - + List newSet = new List(group.Parts); - int numChildren = newSet.Count; - if (numChildren == 1) + newSet.Remove(root); + int numChildren = newSet.Count; + if(numChildren == 0) break; - // If there are prims left in a link set, but the root is - // slated for unlink, we need to do this - // Unlink the remaining set - // - bool sendEventsToRemainder = false; - if (numChildren == 2) // only one child prim no re-link needed - sendEventsToRemainder = true; - foreach (SceneObjectPart p in newSet) - { - if (p != group.RootPart) - { - group.DelinkFromGroup(p, sendEventsToRemainder); - if (sendEventsToRemainder) // finish single child prim now - { - p.ParentGroup.HasGroupChanged = true; - p.ParentGroup.ScheduleGroupForFullUpdate(); - } - } - } + group.DelinkFromGroup(p, false); + SceneObjectPart newRoot = newSet[0]; + // If there is more than one prim remaining, we // need to re-link // - if (numChildren > 2) + if (numChildren > 1) { - // Remove old root - // - if (newSet.Contains(root)) - newSet.Remove(root); - - // Preserve link ordering - // - newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b) - { - return a.LinkNum.CompareTo(b.LinkNum); - }); - // Determine new root // - SceneObjectPart newRoot = newSet[0]; newSet.RemoveAt(0); - - foreach (SceneObjectPart newChild in newSet) - newChild.ClearUpdateSchedule(); + foreach (SceneObjectPart newChild in newSet) + newChild.ClearUpdateSchedule(); LinkObjects(newRoot, newSet); -// if (!affectedGroups.Contains(newRoot.ParentGroup)) -// affectedGroups.Add(newRoot.ParentGroup); + } + else + { + newRoot.TriggerScriptChangedEvent(Changed.LINK); + newRoot.ParentGroup.HasGroupChanged = true; + newRoot.ParentGroup.ScheduleGroupForFullUpdate(); } } - // Finally, trigger events in the roots + // trigger events in the roots // foreach (SceneObjectGroup g in affectedGroups) { + if(g.RootPart.PhysActor != null) + g.RootPart.PhysActor.Building = false; + g.AdjustChildPrimPermissions(false); // Child prims that have been unlinked and deleted will // return unless the root is deleted. This will remove them // from the database. They will be rewritten immediately, // minus the rows for the unlinked child prims. - g.AdjustChildPrimPermissions(false); m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); g.TriggerScriptChangedEvent(Changed.LINK); g.HasGroupChanged = true; // Persist diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 17dfb85..53a9441 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3168,10 +3168,11 @@ namespace OpenSim.Region.Framework.Scenes if (insert) { linkNum = 2; + int insertSize = objectGroup.PrimCount; foreach (SceneObjectPart part in Parts) { if (part.LinkNum > 1) - part.LinkNum++; + part.LinkNum += insertSize; } } else @@ -3200,14 +3201,14 @@ namespace OpenSim.Region.Framework.Scenes linkPart.LinkNum = linkNum++; linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); - // Get a list of the SOP's in the old group in order of their linknum's. + // Get a list of the SOP's in the source group in order of their linknum's. SceneObjectPart[] ogParts = objectGroup.Parts; Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) { return a.LinkNum - b.LinkNum; }); - // Add each of the SOP's from the old linkset to our linkset + // Add each of the SOP's from the source linkset to our linkset for (int i = 0; i < ogParts.Length; i++) { SceneObjectPart part = ogParts[i]; @@ -3415,6 +3416,110 @@ namespace OpenSim.Region.Framework.Scenes return objectGroup; } +/* working on it + public void DelinkFromGroup(List linkParts, bool sendEvents) + { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", +// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); + + if(PrimCount == 1) + return; + + if (m_rootPart.PhysActor != null) + m_rootPart.PhysActor.Building = true; + + bool unlinkroot = false; + foreach(SceneObjectPart linkPart in linkParts) + { + // first we only remove child parts + if(linkPart.LocalId == m_rootPart.LocalId) + { + unlinkroot = true; + continue; + } + + lock (m_parts.SyncRoot) + if(!m_parts.Remove(linkPart.UUID)) + continue; + + linkPart.ClearUndoState(); + + Vector3 worldPos = linkPart.GetWorldPosition(); + Quaternion worldRot = linkPart.GetWorldRotation(); + + linkPart.ParentID = 0; + linkPart.LinkNum = 0; + + PhysicsActor linkPartPa = linkPart.PhysActor; + + // Remove the SOP from the physical scene. + // If the new SOG is physical, it is re-created later. + // (There is a problem here in that we have not yet told the physics + // engine about the delink. Someday, linksets should be made first + // class objects in the physics engine interface). + if (linkPartPa != null) + { + m_scene.PhysicsScene.RemovePrim(linkPartPa); + linkPart.PhysActor = null; + } + + linkPart.setGroupPosition(worldPos); + linkPart.setOffsetPosition(Vector3.Zero); + linkPart.setRotationOffset(worldRot); + + // Create a new SOG to go around this unlinked and unattached SOP + SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); + + m_scene.AddNewSceneObject(objectGroup, true); + + linkPart.Rezzed = RootPart.Rezzed; + + // this is as it seems to be in sl now + if(linkPart.PhysicsShapeType == (byte)PhysShapeType.none) + linkPart.PhysicsShapeType = linkPart.DefaultPhysicsShapeType(); // root prims can't have type none for now + + objectGroup.HasGroupChangedDueToDelink = true; + if (sendEvents) + linkPart.TriggerScriptChangedEvent(Changed.LINK); + } + + if(unlinkroot) + { + //TODO + } + + lock (m_parts.SyncRoot) + { + SceneObjectPart[] parts = m_parts.GetArray(); + if (parts.Length == 1) + { + // Single prim left + m_rootPart.LinkNum = 0; + } + else + { + m_rootPart.LinkNum = 1; + int linknum = 2; + for (int i = 1; i < parts.Length; i++) + parts[i].LinkNum = linknum++; + } + } + + InvalidBoundsRadius(); + + if (m_rootPart.PhysActor != null) + m_rootPart.PhysActor.Building = false; + + // When we delete a group, we currently have to force persist to the database if the object id has changed + // (since delete works by deleting all rows which have a given object id) + + Scene.SimulationDataService.RemoveObject(UUID, Scene.RegionInfo.RegionID); + HasGroupChangedDueToDelink = true; + TriggerScriptChangedEvent(Changed.LINK); + return; + } +*/ /// /// Stop this object from being persisted over server restarts. /// -- cgit v1.1 From f6e77e3935bd444eaaf6e24a4b538c3250546577 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 27 Sep 2016 15:24:05 +0100 Subject: load oar; activate area cliping if bounding-origin option is given. as help says --- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 2d590fc..f523af1 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -227,8 +227,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (boOption != m_boundingOrigin) { m_boundingOrigin = boOption; - m_boundingBox = true; } + m_boundingBox = true; } if (options.ContainsKey("bounding-size")) @@ -936,14 +936,24 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (m_assetService.GetMetadata(uuid) != null) { + sbyte asype = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; + if(asype == -2) + { + + } + // m_log.DebugFormat("[ARCHIVER]: found existing asset {0}",uuid); return true; } - + if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) { sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; + if(assetType == -2) + { + + } if (assetType == (sbyte)AssetType.Unknown) { m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); -- cgit v1.1 From 3e47df735b86bc17dde156bff38fda38319f7297 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 27 Sep 2016 16:41:13 +0100 Subject: exclude invalid collision sound (used as collision type flag) from assets UUIDGather --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index d8928ee..37b91d3 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -178,8 +178,10 @@ namespace OpenSim.Region.Framework.Scenes if (part.Shape.ProjectionTextureUUID != UUID.Zero) GatheredUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture; - if (part.CollisionSound != UUID.Zero) - GatheredUuids[part.CollisionSound] = (sbyte)AssetType.Sound; + UUID collisionSound = part.CollisionSound; + if ( collisionSound != UUID.Zero && + collisionSound != part.invalidCollisionSoundUUID) + GatheredUuids[collisionSound] = (sbyte)AssetType.Sound; if (part.ParticleSystem.Length > 0) { -- cgit v1.1 From 58513fab8f7357e85ecb6f5f99aa1aa74f40b732 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 27 Sep 2016 16:49:55 +0100 Subject: save oar: simplify confusing successefull assets saving message --- OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 895b55d..1526b1c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -285,10 +285,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired) { m_requestState = RequestState.Completed; - - m_log.DebugFormat( - "[ARCHIVER]: Successfully added {0} assets ({1} assets not found but these may be expected invalid references)", + if(m_notFoundAssetUuids.Count == 0) + m_log.DebugFormat( + "[ARCHIVER]: Successfully added {0} assets", + m_foundAssetUuids.Count); + else + m_log.DebugFormat( + "[ARCHIVER]: Successfully added {0} assets ({1} assets not found but these may be expected invalid references)", m_foundAssetUuids.Count, m_notFoundAssetUuids.Count); + // We want to stop using the asset cache thread asap // as we now need to do the work of producing the rest of the archive -- cgit v1.1 From c7e4b14a26c2c3a265b268a9e6c43e6c93db205e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 30 Sep 2016 19:35:44 -0700 Subject: BulletSim: fix problem with avatar velocity going to zero when flying across region boundries. Move code for Velocity, ForceVelocity and SetMomentum to BSPhysObject and have both BSPrim and BSCharacter share the code. --- .../Region/PhysicsModules/BulletS/BSCharacter.cs | 19 ++------ .../Region/PhysicsModules/BulletS/BSPhysObject.cs | 45 +++++++++++++++++- OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs | 53 ++++------------------ 3 files changed, 58 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 5ad2136..213f2eb 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -52,7 +52,6 @@ public sealed class BSCharacter : BSPhysObject private bool _setAlwaysRun; private bool _throttleUpdates; private bool _floatOnWater; - private OMV.Vector3 _rotationalVelocity; private bool _kinematic; private float _buoyancy; @@ -291,7 +290,7 @@ public sealed class BSCharacter : BSPhysObject { RawVelocity = OMV.Vector3.Zero; _acceleration = OMV.Vector3.Zero; - _rotationalVelocity = OMV.Vector3.Zero; + RawRotationalVelocity = OMV.Vector3.Zero; // Zero some other properties directly into the physics engine PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate() @@ -303,7 +302,7 @@ public sealed class BSCharacter : BSPhysObject public override void ZeroAngularMotion(bool inTaintTime) { - _rotationalVelocity = OMV.Vector3.Zero; + RawRotationalVelocity = OMV.Vector3.Zero; PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate() { @@ -618,14 +617,6 @@ public sealed class BSCharacter : BSPhysObject }); } } - public override OMV.Vector3 RotationalVelocity { - get { return _rotationalVelocity; } - set { _rotationalVelocity = value; } - } - public override OMV.Vector3 ForceRotationalVelocity { - get { return _rotationalVelocity; } - set { _rotationalVelocity = value; } - } public override bool Kinematic { get { return _kinematic; } set { _kinematic = value; } @@ -716,8 +707,6 @@ public sealed class BSCharacter : BSPhysObject public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) { } - public override void SetMomentum(OMV.Vector3 momentum) { - } // The avatar's physical shape (whether capsule or cube) is unit sized. BulletSim sets // the scale of that unit shape to create the avatars full size. @@ -841,7 +830,7 @@ public sealed class BSCharacter : BSPhysObject RawVelocity = entprop.Velocity; _acceleration = entprop.Acceleration; - _rotationalVelocity = entprop.RotationalVelocity; + RawRotationalVelocity = entprop.RotationalVelocity; // Do some sanity checking for the avatar. Make sure it's above ground and inbounds. if (PositionSanityCheck(true)) @@ -861,7 +850,7 @@ public sealed class BSCharacter : BSPhysObject // PhysScene.PostUpdate(this); DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", - LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity); + LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, RawRotationalVelocity); } } } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index bb21f0c..7c6f213 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -239,6 +239,8 @@ public abstract class BSPhysObject : PhysicsActor public virtual OMV.Vector3 RawVelocity { get; set; } public abstract OMV.Vector3 ForceVelocity { get; set; } + public OMV.Vector3 RawRotationalVelocity { get; set; } + // RawForce is a constant force applied to object (see Force { set; } ) public OMV.Vector3 RawForce { get; set; } public OMV.Vector3 RawTorque { get; set; } @@ -250,7 +252,48 @@ public abstract class BSPhysObject : PhysicsActor public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); - public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } + // PhysicsActor.SetMomentum + // All the physics engined use this as a way of forcing the velocity to something. + public override void SetMomentum(OMV.Vector3 momentum) + { + // This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor) + RawVelocity = momentum; + PhysScene.TaintedObject(LocalID, TypeName + ".SetMomentum", delegate() + { + // DetailLog("{0},BSPrim.SetMomentum,taint,vel={1}", LocalID, RawVelocity); + ForceVelocity = RawVelocity; + }); + } + + public override OMV.Vector3 RotationalVelocity { + get { + return RawRotationalVelocity; + } + set { + RawRotationalVelocity = value; + Util.ClampV(RawRotationalVelocity, BSParam.MaxAngularVelocity); + // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); + PhysScene.TaintedObject(LocalID, TypeName + ".setRotationalVelocity", delegate() + { + ForceRotationalVelocity = RawRotationalVelocity; + }); + } + } + public OMV.Vector3 ForceRotationalVelocity { + get { + return RawRotationalVelocity; + } + set { + RawRotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity); + if (PhysBody.HasPhysicalBody) + { + DetailLog("{0},{1}.ForceRotationalVel,taint,rotvel={2}", LocalID, TypeName, RawRotationalVelocity); + PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity); + // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); + ActivateIfPhysical(false); + } + } + } public abstract float ForceBuoyancy { get; set; } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index fd9b834..78a617d 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -59,7 +59,6 @@ public class BSPrim : BSPhysObject private bool _setAlwaysRun; private bool _throttleUpdates; private bool _floatOnWater; - private OMV.Vector3 _rotationalVelocity; private bool _kinematic; private float _buoyancy; @@ -90,7 +89,7 @@ public class BSPrim : BSPhysObject RawOrientation = rotation; _buoyancy = 0f; RawVelocity = OMV.Vector3.Zero; - _rotationalVelocity = OMV.Vector3.Zero; + RawRotationalVelocity = OMV.Vector3.Zero; BaseShape = pbs; _isPhysical = pisPhysical; _isVolumeDetect = false; @@ -256,7 +255,7 @@ public class BSPrim : BSPhysObject { RawVelocity = OMV.Vector3.Zero; _acceleration = OMV.Vector3.Zero; - _rotationalVelocity = OMV.Vector3.Zero; + RawRotationalVelocity = OMV.Vector3.Zero; // Zero some other properties in the physics engine PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate() @@ -267,15 +266,15 @@ public class BSPrim : BSPhysObject } public override void ZeroAngularMotion(bool inTaintTime) { - _rotationalVelocity = OMV.Vector3.Zero; + RawRotationalVelocity = OMV.Vector3.Zero; // Zero some other properties in the physics engine PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate() { // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); if (PhysBody.HasPhysicalBody) { - PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); - PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); + PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, RawRotationalVelocity); + PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity); } }); } @@ -426,9 +425,9 @@ public class BSPrim : BSPhysObject RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); ret = true; } - if (_rotationalVelocity.LengthSquared() > BSParam.MaxAngularVelocitySquared) + if (RawRotationalVelocity.LengthSquared() > BSParam.MaxAngularVelocitySquared) { - _rotationalVelocity = Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); + RawRotationalVelocity = Util.ClampV(RawRotationalVelocity, BSParam.MaxAngularVelocity); ret = true; } @@ -1008,7 +1007,7 @@ public class BSPrim : BSPhysObject // For good measure, make sure the transform is set through to the motion state ForcePosition = RawPosition; ForceVelocity = RawVelocity; - ForceRotationalVelocity = _rotationalVelocity; + ForceRotationalVelocity = RawRotationalVelocity; // A dynamic object has mass UpdatePhysicalMassProperties(RawMass, false); @@ -1128,35 +1127,6 @@ public class BSPrim : BSPhysObject }); } } - public override OMV.Vector3 RotationalVelocity { - get { - return _rotationalVelocity; - } - set { - _rotationalVelocity = value; - Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); - // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); - PhysScene.TaintedObject(LocalID, "BSPrim.setRotationalVelocity", delegate() - { - ForceRotationalVelocity = _rotationalVelocity; - }); - } - } - public override OMV.Vector3 ForceRotationalVelocity { - get { - return _rotationalVelocity; - } - set { - _rotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity); - if (PhysBody.HasPhysicalBody) - { - DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); - PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); - // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); - ActivateIfPhysical(false); - } - } - } public override bool Kinematic { get { return _kinematic; } set { _kinematic = value; @@ -1358,9 +1328,6 @@ public class BSPrim : BSPhysObject }); } - public override void SetMomentum(OMV.Vector3 momentum) { - // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); - } #region Mass Calculation private float CalculateMass() @@ -1930,7 +1897,7 @@ public class BSPrim : BSPhysObject if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold)) RawVelocity = entprop.Velocity; _acceleration = entprop.Acceleration; - _rotationalVelocity = entprop.RotationalVelocity; + RawRotationalVelocity = entprop.RotationalVelocity; // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG @@ -1939,7 +1906,7 @@ public class BSPrim : BSPhysObject { entprop.Position = RawPosition; entprop.Velocity = RawVelocity; - entprop.RotationalVelocity = _rotationalVelocity; + entprop.RotationalVelocity = RawRotationalVelocity; entprop.Acceleration = _acceleration; } -- cgit v1.1 From cd9d176c3cd710b29b43dd4420c7616ff0f01f43 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 2 Oct 2016 11:12:03 +0100 Subject: change avatar and attachments priority (downgraded) in priritizer option SimpleAngularDistance --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 65 ++++++++++++-------------- 1 file changed, 30 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 5669c43..ed80b3a 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -274,50 +274,45 @@ namespace OpenSim.Region.Framework.Scenes private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity) { - uint pqueue = 2; // keep compiler happy - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence == null) return PriorityQueue.NumberOfQueues - 1; - // All avatars other than our own go into pqueue 1 - if (entity is ScenePresence) - return 1; - - if (entity is SceneObjectPart) - { - // Attachments are high priority, - if (((SceneObjectPart)entity).ParentGroup.IsAttachment) - return 2; - - pqueue = ComputeAngleDistancePriority(presence, entity); - - // Non physical prims are lower priority than physical prims - PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; - if (physActor == null || !physActor.IsPhysical) - pqueue++; - } - + uint pqueue = ComputeAngleDistancePriority(presence, entity); return pqueue; } private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity) { - double distance; - - Vector3 presencePos = presence.AbsolutePosition; - - SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; - float bradius = group.GetBoundsRadius(); - Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); - distance = Vector3.Distance(presencePos, grppos); - distance -= bradius; - distance *= group.getAreaFactor(); - // And convert the distance to a priority queue, this computation gives queues // at 10, 20, 40, 80, 160, 320, 640, and 1280m - uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue - uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; + uint minpqueue = PriorityQueue.NumberOfImmediateQueues; + uint maxqueue = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues -1; + uint pqueue = minpqueue; + float distance; + + Vector3 presencePos = presence.AbsolutePosition; + if(entity is ScenePresence) + { + ScenePresence sp = entity as ScenePresence; + distance = Vector3.Distance(presencePos, sp.AbsolutePosition); + distance *= 0.5f; + } + else + { + SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; + float bradius = group.GetBoundsRadius(); + Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); + distance = Vector3.Distance(presencePos, grppos); + distance -= bradius; + distance *= group.getAreaFactor(); + if(group.IsAttachment) + distance *= 0.5f; + else if(group.GetSittingAvatarsCount() > 0) + distance *= 0.5f; + else if(group.UsesPhysics) + distance *= 0.6f; + } if (distance > 10f) { @@ -328,8 +323,8 @@ namespace OpenSim.Region.Framework.Scenes // 2st constant makes it be log2(distance/10) pqueue += (uint)tmp; - if (pqueue > queues - 1) - pqueue = queues - 1; + if (pqueue > maxqueue) + pqueue = maxqueue; } return pqueue; -- cgit v1.1 From f3e7603c37a5448f5a4ac59a2621b24724707288 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 2 Oct 2016 11:54:07 +0100 Subject: minor cleanup --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index ed80b3a..97009a0 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -286,9 +286,10 @@ namespace OpenSim.Region.Framework.Scenes { // And convert the distance to a priority queue, this computation gives queues // at 10, 20, 40, 80, 160, 320, 640, and 1280m - uint minpqueue = PriorityQueue.NumberOfImmediateQueues; +// uint minpqueue = PriorityQueue.NumberOfImmediateQueues; uint maxqueue = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues -1; - uint pqueue = minpqueue; +// uint pqueue = minpqueue; + uint pqueue = PriorityQueue.NumberOfImmediateQueues; float distance; Vector3 presencePos = presence.AbsolutePosition; @@ -308,10 +309,10 @@ namespace OpenSim.Region.Framework.Scenes distance *= group.getAreaFactor(); if(group.IsAttachment) distance *= 0.5f; - else if(group.GetSittingAvatarsCount() > 0) - distance *= 0.5f; else if(group.UsesPhysics) distance *= 0.6f; + else if(group.GetSittingAvatarsCount() > 0) + distance *= 0.5f; } if (distance > 10f) -- cgit v1.1 From e13fecfd3d465cd51f4d0802b3f2a4d9b2c989b7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 3 Oct 2016 20:47:30 -0700 Subject: BulletSim: zero velocity target when setting velocity through the SetMomentum method. --- OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | 12 +++++++++++- OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 213f2eb..757f06c 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -350,7 +350,6 @@ public sealed class BSCharacter : BSPhysObject } } - // Check that the current position is sane and, if not, modify the position to make it so. // Check for being below terrain or on water. // Returns 'true' of the position was made sane by some action. @@ -502,6 +501,17 @@ public sealed class BSCharacter : BSPhysObject } } + // SetMomentum just sets the velocity without a target. We need to stop the movement actor if a character. + public override void SetMomentum(OMV.Vector3 momentum) + { + if (m_moveActor != null) + { + m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */); + } + base.SetMomentum(momentum); + } + + public override OMV.Vector3 Torque { get { return RawTorque; } set { RawTorque = value; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 7c6f213..3682455 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -625,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor { CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", - LocalID, TypeName, ms, CurrentCollisionFlags); + LocalID, TypeName, SubscribedEventsMs, CurrentCollisionFlags); } }); } -- cgit v1.1 From 8a3958ad048535ad4f8a752cbd71d9114e53a42b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 5 Oct 2016 13:17:23 +0100 Subject: dont let ignored AgentUpdates change their throttles. Apply respective movement to physics on the handling thread, not heartbeat, avoiding missing transitions that should get into physics. Make some usefull sp state flags visible everywhere --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 87 +++++++++++----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 ++++++++---- 2 files changed, 76 insertions(+), 60 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8194260..2650be4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; - m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; +// m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; + m_thisAgentUpdateArgs.ControlFlags = 0; AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); mov.SimData.ChannelVersion = m_channelVersion; @@ -6196,27 +6197,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); - //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); - - bool movementSignificant = + if( (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed - || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands + || ((x.ControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0 && + (x.ControlFlags & 0x3f8dfff) != 0) // we need to rotate the av on fly || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed - || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold - // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed - ; - //if (movementSignificant) - //{ - //m_log.DebugFormat("[LLCLIENTVIEW]: Bod {0} {1}", - // qdelta1, qdelta2); - //m_log.DebugFormat("[LLCLIENTVIEW]: St {0} {1} {2} {3}", - // x.ControlFlags, x.Flags, x.Far, x.State); - //} - return movementSignificant; + ) + return true; + + float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); + //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); + + if( + qdelta1 < QDELTABody // significant if body rotation above(below cos) threshold + // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack + // || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold + ) + return true; + + return false; } /// @@ -6227,33 +6228,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); - float vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); - float vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); - float vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); + float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); + if((vdelta > VDELTA)) + return true; + + vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); + if((vdelta > VDELTA)) + return true; - bool cameraSignificant = - (vdelta1 > VDELTA) || - (vdelta2 > VDELTA) || - (vdelta3 > VDELTA) || - (vdelta4 > VDELTA) - ; + vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); + if((vdelta > VDELTA)) + return true; - //if (cameraSignificant) - //{ - //m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}", - // x.CameraAtAxis, x.CameraCenter); - //m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}", - // x.CameraLeftAxis, x.CameraUpAxis); - //} + vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); + if((vdelta > VDELTA)) + return true; - return cameraSignificant; + return false; } private bool HandleAgentUpdate(IClientAPI sender, Packet packet) { - // We got here, which means that something in agent update was significant - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; @@ -6264,10 +6259,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } TotalAgentUpdates++; + // dont let ignored updates pollute this throttles + if(SceneAgent == null || SceneAgent.IsChildAgent || SceneAgent.IsInTransit) + { + // throttle reset is done at MoveAgentIntoRegion() + // called by scenepresence on completemovement + PacketPool.Instance.ReturnPacket(packet); + return true; + } bool movement = CheckAgentMovementUpdateSignificance(x); bool camera = CheckAgentCameraUpdateSignificance(x); - + // Was there a significant movement/state change? if (movement) { @@ -6276,7 +6279,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_thisAgentUpdateArgs.Far = x.Far; m_thisAgentUpdateArgs.Flags = x.Flags; m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; -// m_thisAgentUpdateArgs.SessionID = x.SessionID; m_thisAgentUpdateArgs.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; @@ -6287,9 +6289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerAgentUpdate != null) OnAgentUpdate(this, m_thisAgentUpdateArgs); - - handlerAgentUpdate = null; - handlerPreAgentUpdate = null; + } // Was there a significant camera(s) change? @@ -6305,7 +6305,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerAgentCameraUpdate != null) handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); - handlerAgentCameraUpdate = null; } PacketPool.Instance.ReturnPacket(packet); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bb6e89b..6f4d6c3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -281,7 +281,9 @@ namespace OpenSim.Region.Framework.Scenes private bool m_followCamAuto = false; - private Vector3? m_forceToApply; +// private object m_forceToApplyLock = new object(); +// private bool m_forceToApplyValid; +// private Vector3 m_forceToApply; private int m_userFlags; public int UserFlags { @@ -582,11 +584,11 @@ namespace OpenSim.Region.Framework.Scenes { get { - return m_drawDistance; + return m_drawDistance; } set { - m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance); + m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance); } } @@ -594,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); + return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); } } @@ -2120,6 +2122,7 @@ namespace OpenSim.Region.Framework.Scenes if (haveAnims) SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); + // we should be able to receive updates, etc // so release them m_inTransit = false; @@ -2238,6 +2241,9 @@ namespace OpenSim.Region.Framework.Scenes } finally { + haveGroupInformation = false; + gotCrossUpdate = false; + crossingFlags = 0; m_inTransit = false; } // if hide force a check @@ -2247,9 +2253,6 @@ namespace OpenSim.Region.Framework.Scenes // m_currentParcelHide = newhide; // } - haveGroupInformation = false; - gotCrossUpdate = false; - crossingFlags = 0; m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; @@ -3006,7 +3009,8 @@ namespace OpenSim.Region.Framework.Scenes MovingToTarget = false; // MoveToPositionTarget = Vector3.Zero; - m_forceToApply = null; // cancel possible last action +// lock(m_forceToApplyLock) +// m_forceToApplyValid = false; // cancel possible last action // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. @@ -3638,8 +3642,14 @@ namespace OpenSim.Region.Framework.Scenes } // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); - - m_forceToApply = direc; +/* + lock(m_forceToApplyLock) + { + m_forceToApply = direc; + m_forceToApplyValid = true; + } +*/ + Velocity = direc; Animator.UpdateMovementAnimations(); } @@ -4734,17 +4744,21 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateMovement() { +/* if (IsInTransit) return; - if (m_forceToApply.HasValue) - { - Vector3 force = m_forceToApply.Value; - Velocity = force; + lock(m_forceToApplyLock) + { + if (m_forceToApplyValid) + { + Velocity = m_forceToApply; - m_forceToApply = null; - TriggerScenePresenceUpdated(); + m_forceToApplyValid = false; + TriggerScenePresenceUpdated(); + } } +*/ } /// @@ -4767,6 +4781,9 @@ namespace OpenSim.Region.Framework.Scenes // Appearance.SetHeight(); Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); +// lock(m_forceToApplyLock) +// m_forceToApplyValid = false; + PhysicsScene scene = m_scene.PhysicsScene; Vector3 pVec = AbsolutePosition; -- cgit v1.1 From 76a2d90dada467a16c462bbdc49fdc175be66e29 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 5 Oct 2016 13:38:12 +0100 Subject: remove attachment to event OnPreAgentUpdate that is doing nothing --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 68c9c97..11a6d9f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -212,7 +212,6 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelInfoRequest += ClientOnParcelInfoRequest; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; - client.OnPreAgentUpdate += ClientOnPreAgentUpdate; client.OnParcelEjectUser += ClientOnParcelEjectUser; client.OnParcelFreezeUser += ClientOnParcelFreezeUser; client.OnSetStartLocationRequest += ClientOnSetHome; @@ -223,10 +222,6 @@ namespace OpenSim.Region.CoreModules.World.Land avatar.currentParcelUUID = UUID.Zero; } - void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) - { - } - public void Close() { } -- cgit v1.1