From 860b2a502f797e5822c6705d4639f370f3ac5861 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 16 Sep 2010 17:30:46 -0700 Subject: Changed SceneObjectGroup to store parts with the fast and thread-safe MapAndArray collection --- .../Shared/Api/Implementation/LSL_Api.cs | 91 +++++++++------------- 1 file changed, 38 insertions(+), 53 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0692fdb..01c026e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -236,8 +236,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.LINK_SET: if (m_host.ParentGroup != null) { - lock (m_host.ParentGroup.Children) - return new List(m_host.ParentGroup.Children.Values); + return new List(m_host.ParentGroup.Parts); } return ret; @@ -254,8 +253,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup == null) return new List(); - lock (m_host.ParentGroup.Children) - ret = new List(m_host.ParentGroup.Children.Values); + ret = new List(m_host.ParentGroup.Parts); if (ret.Contains(m_host)) ret.Remove(m_host); @@ -265,8 +263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup == null) return new List(); - lock (m_host.ParentGroup.Children) - ret = new List(m_host.ParentGroup.Children.Values); + ret = new List(m_host.ParentGroup.Parts); if (ret.Contains(m_host.ParentGroup.RootPart)) ret.Remove(m_host.ParentGroup.RootPart); @@ -1187,16 +1184,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (group == null) return; bool allow = true; - - lock (group.Children) + + foreach (SceneObjectPart part in group.Parts) { - foreach (SceneObjectPart part in group.Children.Values) + if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) { - if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) - { - allow = false; - break; - } + allow = false; + break; } } @@ -3617,18 +3611,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.LINK_ALL_OTHERS: case ScriptBaseClass.LINK_ALL_CHILDREN: case ScriptBaseClass.LINK_THIS: - lock (parentPrim.Children) + foreach (SceneObjectPart part in parentPrim.Parts) { - foreach (SceneObjectPart part in parentPrim.Children.Values) + if (part.UUID != m_host.UUID) { - if (part.UUID != m_host.UUID) - { - childPrim = part; - break; - } + childPrim = part; + break; } - break; } + break; default: childPrim = parentPrim.GetLinkNumPart(linknum); if (childPrim.UUID == m_host.UUID) @@ -3639,30 +3630,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (linknum == ScriptBaseClass.LINK_ROOT) { // Restructuring Multiple Prims. - lock (parentPrim.Children) + List parts = new List(parentPrim.Parts); + parts.Remove(parentPrim.RootPart); + foreach (SceneObjectPart part in parts) { - List parts = new List(parentPrim.Children.Values); - parts.Remove(parentPrim.RootPart); + parentPrim.DelinkFromGroup(part.LocalId, true); + } + parentPrim.HasGroupChanged = true; + parentPrim.ScheduleGroupForFullUpdate(); + parentPrim.TriggerScriptChangedEvent(Changed.LINK); + + if (parts.Count > 0) + { + SceneObjectPart newRoot = parts[0]; + parts.Remove(newRoot); foreach (SceneObjectPart part in parts) { - parentPrim.DelinkFromGroup(part.LocalId, true); - } - parentPrim.HasGroupChanged = true; - parentPrim.ScheduleGroupForFullUpdate(); - parentPrim.TriggerScriptChangedEvent(Changed.LINK); - - if (parts.Count > 0) - { - SceneObjectPart newRoot = parts[0]; - parts.Remove(newRoot); - foreach (SceneObjectPart part in parts) - { - part.UpdateFlag = 0; - newRoot.ParentGroup.LinkToGroup(part.ParentGroup); - } - newRoot.ParentGroup.HasGroupChanged = true; - newRoot.ParentGroup.ScheduleGroupForFullUpdate(); + part.UpdateFlag = 0; + newRoot.ParentGroup.LinkToGroup(part.ParentGroup); } + newRoot.ParentGroup.HasGroupChanged = true; + newRoot.ParentGroup.ScheduleGroupForFullUpdate(); } } else @@ -3684,19 +3672,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (parentPrim.RootPart.AttachmentPoint != 0) return; // Fail silently if attached - lock (parentPrim.Children) + List parts = new List(parentPrim.Parts); + parts.Remove(parentPrim.RootPart); + + foreach (SceneObjectPart part in parts) { - List parts = new List(parentPrim.Children.Values); - parts.Remove(parentPrim.RootPart); - - foreach (SceneObjectPart part in parts) - { - parentPrim.DelinkFromGroup(part.LocalId, true); - parentPrim.TriggerScriptChangedEvent(Changed.LINK); - } - parentPrim.HasGroupChanged = true; - parentPrim.ScheduleGroupForFullUpdate(); + parentPrim.DelinkFromGroup(part.LocalId, true); + parentPrim.TriggerScriptChangedEvent(Changed.LINK); } + parentPrim.HasGroupChanged = true; + parentPrim.ScheduleGroupForFullUpdate(); } public LSL_String llGetLinkKey(int linknum) -- cgit v1.1 From 7762301cea99215df4068cca71b78335df5a4a40 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Sep 2010 01:50:48 +0200 Subject: Revert "* Changed 11 calls for session info to the more optimized API method" This reverts commit 5dc9ea2f2487804d788b4b80d40d91bd792de4c2. Also makes online indicators and IM more robust --- .../Shared/Api/Implementation/LSL_Api.cs | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 01c026e..621d429 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3956,7 +3956,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - pinfo = World.PresenceService.GetAgent(uuid); + PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); + if (pinfos != null && pinfos.Length > 0) + { + foreach (PresenceInfo p in pinfos) + { + if (p.RegionID != UUID.Zero) + { + pinfo = p; + } + } + } ce = new UserInfoCacheEntry(); ce.time = Util.EnvironmentTickCount(); @@ -3974,7 +3984,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) { - pinfo = World.PresenceService.GetAgent(uuid); + PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); + if (pinfos != null && pinfos.Length > 0) + { + foreach (PresenceInfo p in pinfos) + { + if (p.RegionID != UUID.Zero) + { + pinfo = p; + } + } + } + else + pinfo = null; ce.time = Util.EnvironmentTickCount(); ce.pinfo = pinfo; -- cgit v1.1