diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 96f304921e..b88895f442 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -450,13 +450,17 @@ namespace OpenSim.Framework public string GetOtherSetting(string key) { string val; - m_otherSettings.TryGetValue(key, out val); - return val; + string keylower = key.ToLower(); + if (m_otherSettings.TryGetValue(keylower, out val)) + return val; + m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key); + return null; } public void SetOtherSetting(string key, string value) { - m_otherSettings[key] = value; + string keylower = key.ToLower(); + m_otherSettings[keylower] = value; } private void ReadNiniConfig(IConfigSource source, string name) @@ -498,12 +502,12 @@ namespace OpenSim.Framework HashSet allKeys = new HashSet(); foreach (string s in config.GetKeys()) { - allKeys.Add(s.ToLower()); + allKeys.Add(s); } // RegionUUID // - allKeys.Remove(("RegionUUID").ToLower()); + allKeys.Remove("RegionUUID"); string regionUUID = config.GetString("RegionUUID", string.Empty); if (regionUUID == String.Empty) { @@ -518,7 +522,7 @@ namespace OpenSim.Framework // Location // - allKeys.Remove(("Location").ToLower()); + allKeys.Remove("Location"); string location = config.GetString("Location", String.Empty); if (location == String.Empty) { @@ -534,7 +538,7 @@ namespace OpenSim.Framework // InternalAddress // IPAddress address; - allKeys.Remove(("InternalAddress").ToLower()); + allKeys.Remove("InternalAddress"); if (config.Contains("InternalAddress")) { address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); @@ -548,7 +552,7 @@ namespace OpenSim.Framework // InternalPort // int port; - allKeys.Remove(("InternalPort").ToLower()); + allKeys.Remove("InternalPort"); if (config.Contains("InternalPort")) { port = config.GetInt("InternalPort", 9000); @@ -562,7 +566,7 @@ namespace OpenSim.Framework // AllowAlternatePorts // - allKeys.Remove(("AllowAlternatePorts").ToLower()); + allKeys.Remove("AllowAlternatePorts"); if (config.Contains("AllowAlternatePorts")) { m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); @@ -576,7 +580,7 @@ namespace OpenSim.Framework // ExternalHostName // - allKeys.Remove(("ExternalHostName").ToLower()); + allKeys.Remove("ExternalHostName"); string externalName; if (config.Contains("ExternalHostName")) { @@ -601,29 +605,30 @@ namespace OpenSim.Framework // RegionType m_regionType = config.GetString("RegionType", String.Empty); - allKeys.Remove(("RegionType").ToLower()); + allKeys.Remove("RegionType"); // Prim stuff // m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); - allKeys.Remove(("NonphysicalPrimMax").ToLower()); + allKeys.Remove("NonphysicalPrimMax"); m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); - allKeys.Remove(("PhysicalPrimMax").ToLower()); + allKeys.Remove("PhysicalPrimMax"); m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); - allKeys.Remove(("ClampPrimSize").ToLower()); + allKeys.Remove("ClampPrimSize"); m_objectCapacity = config.GetInt("MaxPrims", 15000); - allKeys.Remove(("MaxPrims").ToLower()); + allKeys.Remove("MaxPrims"); m_agentCapacity = config.GetInt("MaxAgents", 100); - allKeys.Remove(("MaxAgents").ToLower()); + allKeys.Remove("MaxAgents"); // Multi-tenancy // ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); - allKeys.Remove(("ScopeID").ToLower()); + allKeys.Remove("ScopeID"); foreach (String s in allKeys) { - m_otherSettings.Add(s, config.GetString(s)); + string val = config.GetString(s); + SetOtherSetting(s, config.GetString(s)); } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 74d9e60c49..57db4d6ec9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -402,12 +402,18 @@ namespace OpenSim.Region.Framework.Scenes public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); + public delegate void SceneObjectPartUpdated(SceneObjectPart sop); + public event SceneObjectPartUpdated OnSceneObjectPartUpdated; + public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; public delegate void RegionStarted(Scene scene); public event RegionStarted OnRegionStarted; + public delegate void RegionHeartbeatEnd(Scene scene); + public event RegionHeartbeatEnd OnRegionHeartbeatEnd; + public delegate void LoginsEnabled(string regionName); public event LoginsEnabled OnLoginsEnabled; @@ -2227,6 +2233,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerSceneObjectPartUpdated(SceneObjectPart sop) + { + SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; + if (handler != null) + { + foreach (SceneObjectPartUpdated d in handler.GetInvocationList()) + { + try + { + d(sop); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client) { @@ -2291,6 +2318,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerRegionHeartbeatEnd(Scene scene) + { + RegionHeartbeatEnd handler = OnRegionHeartbeatEnd; + + if (handler != null) + { + foreach (RegionHeartbeatEnd d in handler.GetInvocationList()) + { + try + { + d(scene); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerLoginsEnabled (string regionName) { LoginsEnabled handler = OnLoginsEnabled; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 128954fdf8..03ddbc5e82 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1431,6 +1431,8 @@ namespace OpenSim.Region.Framework.Scenes RegionInfo.RegionName, e.Message, e.StackTrace); } + EventManager.TriggerRegionHeartbeatEnd(this); + maintc = Util.EnvironmentTickCountSubtract(maintc); maintc = (int)(MinFrameTime * 1000) - maintc; @@ -2837,7 +2839,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectMaterial += m_sceneGraph.PrimMaterial; client.OnLinkObjects += LinkObjects; client.OnDelinkObjects += DelinkObjects; - client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; + client.OnObjectDuplicate += DuplicateObject; client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; @@ -2965,7 +2967,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; client.OnLinkObjects -= LinkObjects; client.OnDelinkObjects -= DelinkObjects; - client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; + client.OnObjectDuplicate -= DuplicateObject; client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; @@ -3058,6 +3060,21 @@ namespace OpenSim.Region.Framework.Scenes return false; } + /// + /// Duplicates object specified by localID. This is the event handler for IClientAPI. + /// + /// ID of object to duplicate + /// + /// + /// Agent doing the duplication + /// Group of new object + public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) + { + SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); + if (copy != null) + EventManager.TriggerObjectAddedToScene(copy); + } + /// /// Duplicates object specified by localID at position raycasted against RayTargetObject using /// RayEnd and RayStart to determine what the angle of the ray is @@ -3120,19 +3137,22 @@ namespace OpenSim.Region.Framework.Scenes // stick in offset format from the original prim pos = pos - target.ParentGroup.AbsolutePosition; + SceneObjectGroup copy; if (CopyRotates) { Quaternion worldRot = target2.GetWorldRotation(); // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); - m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); + copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); //obj.Rotation = worldRot; //obj.UpdateGroupRotationR(worldRot); } else { - m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); + copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); } + if (copy != null) + EventManager.TriggerObjectAddedToScene(copy); } } } @@ -4467,6 +4487,16 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.GetGroupByPrim(localID); } + /// + /// Get a scene object group that contains the prim with the given uuid + /// + /// + /// null if no scene object group containing that prim is found + public SceneObjectGroup GetGroupByPrim(UUID fullID) + { + return m_sceneGraph.GetGroupByPrim(fullID); + } + public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp) { return m_sceneGraph.TryGetScenePresence(agentID, out sp); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index aecca27f7d..17563bd537 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -343,6 +343,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// This method does not send updates to the client - callers need to handle this themselves. + /// Caller should also trigger EventManager.TriggerObjectAddedToScene /// /// /// Position of the object. If null then the position stored in the object is used. @@ -1002,7 +1003,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// null if no scene object group containing that prim is found - private SceneObjectGroup GetGroupByPrim(UUID fullID) + public SceneObjectGroup GetGroupByPrim(UUID fullID) { SceneObjectGroup sog; lock (SceneObjectGroupsByFullPartID) @@ -1992,22 +1993,6 @@ namespace OpenSim.Region.Framework.Scenes #pragma warning restore 0612 } - /// - /// Duplicate the given object, Fire and Forget, No rotation, no return wrapper - /// - /// - /// - /// - /// - /// - protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) - { - //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); - - // SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero); - DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); - } - /// /// Duplicate the given object. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5576ec9187..0d14963017 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -244,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes public bool IgnoreUndoUpdate = false; - private PrimFlags LocalFlags; + public PrimFlags LocalFlags; private float m_damage = -1.0f; private byte[] m_TextureAnimation; @@ -933,32 +933,18 @@ namespace OpenSim.Region.Framework.Scenes public Color Color { get { return m_color; } - set - { - m_color = value; - - /* ScheduleFullUpdate() need not be called b/c after - * setting the color, the text will be set, so then - * ScheduleFullUpdate() will be called. */ - //ScheduleFullUpdate(); - } + set { m_color = value; } } public string Text { get { - string returnstr = m_text; - if (returnstr.Length > 255) - { - returnstr = returnstr.Substring(0, 254); - } - return returnstr; - } - set - { - m_text = value; + if (m_text.Length > 255) + return m_text.Substring(0, 254); + return m_text; } + set { m_text = value; } } @@ -2795,6 +2781,10 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; + // When running OpenSim tests, Scene (and EventManager can be null). + // Need to fix tests before we can trigger this here + // ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); + ParentGroup.QueueForUpdateCheck(); int timeNow = Util.UnixTimeSinceEpoch(); @@ -2827,6 +2817,10 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; + // When running OpenSim tests, Scene (and EventManager can be null). + // Need to fix tests before we can trigger this here + // ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); + // This was pulled from SceneViewer. Attachments always receive full updates. // I could not verify if this is a requirement but this maintains existing behavior if (ParentGroup.IsAttachment)