diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 48 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 34 |
4 files changed, 98 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 74d9e60..57db4d6 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -402,12 +402,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
402 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; | 402 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; |
403 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | 403 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); |
404 | 404 | ||
405 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); | ||
406 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; | ||
407 | |||
405 | public delegate void RegionUp(GridRegion region); | 408 | public delegate void RegionUp(GridRegion region); |
406 | public event RegionUp OnRegionUp; | 409 | public event RegionUp OnRegionUp; |
407 | 410 | ||
408 | public delegate void RegionStarted(Scene scene); | 411 | public delegate void RegionStarted(Scene scene); |
409 | public event RegionStarted OnRegionStarted; | 412 | public event RegionStarted OnRegionStarted; |
410 | 413 | ||
414 | public delegate void RegionHeartbeatEnd(Scene scene); | ||
415 | public event RegionHeartbeatEnd OnRegionHeartbeatEnd; | ||
416 | |||
411 | public delegate void LoginsEnabled(string regionName); | 417 | public delegate void LoginsEnabled(string regionName); |
412 | public event LoginsEnabled OnLoginsEnabled; | 418 | public event LoginsEnabled OnLoginsEnabled; |
413 | 419 | ||
@@ -2227,6 +2233,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2227 | } | 2233 | } |
2228 | } | 2234 | } |
2229 | 2235 | ||
2236 | public void TriggerSceneObjectPartUpdated(SceneObjectPart sop) | ||
2237 | { | ||
2238 | SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; | ||
2239 | if (handler != null) | ||
2240 | { | ||
2241 | foreach (SceneObjectPartUpdated d in handler.GetInvocationList()) | ||
2242 | { | ||
2243 | try | ||
2244 | { | ||
2245 | d(sop); | ||
2246 | } | ||
2247 | catch (Exception e) | ||
2248 | { | ||
2249 | m_log.ErrorFormat( | ||
2250 | "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}", | ||
2251 | e.Message, e.StackTrace); | ||
2252 | } | ||
2253 | } | ||
2254 | } | ||
2255 | } | ||
2256 | |||
2230 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, | 2257 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, |
2231 | int local_id, IClientAPI remote_client) | 2258 | int local_id, IClientAPI remote_client) |
2232 | { | 2259 | { |
@@ -2291,6 +2318,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2291 | } | 2318 | } |
2292 | } | 2319 | } |
2293 | 2320 | ||
2321 | public void TriggerRegionHeartbeatEnd(Scene scene) | ||
2322 | { | ||
2323 | RegionHeartbeatEnd handler = OnRegionHeartbeatEnd; | ||
2324 | |||
2325 | if (handler != null) | ||
2326 | { | ||
2327 | foreach (RegionHeartbeatEnd d in handler.GetInvocationList()) | ||
2328 | { | ||
2329 | try | ||
2330 | { | ||
2331 | d(scene); | ||
2332 | } | ||
2333 | catch (Exception e) | ||
2334 | { | ||
2335 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}", | ||
2336 | e.Message, e.StackTrace); | ||
2337 | } | ||
2338 | } | ||
2339 | } | ||
2340 | } | ||
2341 | |||
2294 | public void TriggerLoginsEnabled (string regionName) | 2342 | public void TriggerLoginsEnabled (string regionName) |
2295 | { | 2343 | { |
2296 | LoginsEnabled handler = OnLoginsEnabled; | 2344 | LoginsEnabled handler = OnLoginsEnabled; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 128954f..03ddbc5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1431,6 +1431,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1431 | RegionInfo.RegionName, e.Message, e.StackTrace); | 1431 | RegionInfo.RegionName, e.Message, e.StackTrace); |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | EventManager.TriggerRegionHeartbeatEnd(this); | ||
1435 | |||
1434 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1436 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1435 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1437 | maintc = (int)(MinFrameTime * 1000) - maintc; |
1436 | 1438 | ||
@@ -2837,7 +2839,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2837 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 2839 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
2838 | client.OnLinkObjects += LinkObjects; | 2840 | client.OnLinkObjects += LinkObjects; |
2839 | client.OnDelinkObjects += DelinkObjects; | 2841 | client.OnDelinkObjects += DelinkObjects; |
2840 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; | 2842 | client.OnObjectDuplicate += DuplicateObject; |
2841 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | 2843 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; |
2842 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 2844 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
2843 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 2845 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
@@ -2965,7 +2967,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2965 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | 2967 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; |
2966 | client.OnLinkObjects -= LinkObjects; | 2968 | client.OnLinkObjects -= LinkObjects; |
2967 | client.OnDelinkObjects -= DelinkObjects; | 2969 | client.OnDelinkObjects -= DelinkObjects; |
2968 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | 2970 | client.OnObjectDuplicate -= DuplicateObject; |
2969 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | 2971 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; |
2970 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | 2972 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; |
2971 | client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; | 2973 | client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; |
@@ -3059,6 +3061,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3059 | } | 3061 | } |
3060 | 3062 | ||
3061 | /// <summary> | 3063 | /// <summary> |
3064 | /// Duplicates object specified by localID. This is the event handler for IClientAPI. | ||
3065 | /// </summary> | ||
3066 | /// <param name="originalPrim">ID of object to duplicate</param> | ||
3067 | /// <param name="offset"></param> | ||
3068 | /// <param name="flags"></param> | ||
3069 | /// <param name="AgentID">Agent doing the duplication</param> | ||
3070 | /// <param name="GroupID">Group of new object</param> | ||
3071 | public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) | ||
3072 | { | ||
3073 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | ||
3074 | if (copy != null) | ||
3075 | EventManager.TriggerObjectAddedToScene(copy); | ||
3076 | } | ||
3077 | |||
3078 | /// <summary> | ||
3062 | /// Duplicates object specified by localID at position raycasted against RayTargetObject using | 3079 | /// Duplicates object specified by localID at position raycasted against RayTargetObject using |
3063 | /// RayEnd and RayStart to determine what the angle of the ray is | 3080 | /// RayEnd and RayStart to determine what the angle of the ray is |
3064 | /// </summary> | 3081 | /// </summary> |
@@ -3120,19 +3137,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3120 | 3137 | ||
3121 | // stick in offset format from the original prim | 3138 | // stick in offset format from the original prim |
3122 | pos = pos - target.ParentGroup.AbsolutePosition; | 3139 | pos = pos - target.ParentGroup.AbsolutePosition; |
3140 | SceneObjectGroup copy; | ||
3123 | if (CopyRotates) | 3141 | if (CopyRotates) |
3124 | { | 3142 | { |
3125 | Quaternion worldRot = target2.GetWorldRotation(); | 3143 | Quaternion worldRot = target2.GetWorldRotation(); |
3126 | 3144 | ||
3127 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3145 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3128 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3146 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3129 | //obj.Rotation = worldRot; | 3147 | //obj.Rotation = worldRot; |
3130 | //obj.UpdateGroupRotationR(worldRot); | 3148 | //obj.UpdateGroupRotationR(worldRot); |
3131 | } | 3149 | } |
3132 | else | 3150 | else |
3133 | { | 3151 | { |
3134 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | 3152 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); |
3135 | } | 3153 | } |
3154 | if (copy != null) | ||
3155 | EventManager.TriggerObjectAddedToScene(copy); | ||
3136 | } | 3156 | } |
3137 | } | 3157 | } |
3138 | } | 3158 | } |
@@ -4467,6 +4487,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4467 | return m_sceneGraph.GetGroupByPrim(localID); | 4487 | return m_sceneGraph.GetGroupByPrim(localID); |
4468 | } | 4488 | } |
4469 | 4489 | ||
4490 | /// <summary> | ||
4491 | /// Get a scene object group that contains the prim with the given uuid | ||
4492 | /// </summary> | ||
4493 | /// <param name="fullID"></param> | ||
4494 | /// <returns>null if no scene object group containing that prim is found</returns> | ||
4495 | public SceneObjectGroup GetGroupByPrim(UUID fullID) | ||
4496 | { | ||
4497 | return m_sceneGraph.GetGroupByPrim(fullID); | ||
4498 | } | ||
4499 | |||
4470 | public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp) | 4500 | public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp) |
4471 | { | 4501 | { |
4472 | return m_sceneGraph.TryGetScenePresence(agentID, out sp); | 4502 | return m_sceneGraph.TryGetScenePresence(agentID, out sp); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index aecca27..17563bd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -343,6 +343,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | /// </summary> | 343 | /// </summary> |
344 | /// | 344 | /// |
345 | /// This method does not send updates to the client - callers need to handle this themselves. | 345 | /// This method does not send updates to the client - callers need to handle this themselves. |
346 | /// Caller should also trigger EventManager.TriggerObjectAddedToScene | ||
346 | /// <param name="sceneObject"></param> | 347 | /// <param name="sceneObject"></param> |
347 | /// <param name="attachToBackup"></param> | 348 | /// <param name="attachToBackup"></param> |
348 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> | 349 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
@@ -1002,7 +1003,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | /// </summary> | 1003 | /// </summary> |
1003 | /// <param name="fullID"></param> | 1004 | /// <param name="fullID"></param> |
1004 | /// <returns>null if no scene object group containing that prim is found</returns> | 1005 | /// <returns>null if no scene object group containing that prim is found</returns> |
1005 | private SceneObjectGroup GetGroupByPrim(UUID fullID) | 1006 | public SceneObjectGroup GetGroupByPrim(UUID fullID) |
1006 | { | 1007 | { |
1007 | SceneObjectGroup sog; | 1008 | SceneObjectGroup sog; |
1008 | lock (SceneObjectGroupsByFullPartID) | 1009 | lock (SceneObjectGroupsByFullPartID) |
@@ -1993,22 +1994,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | } | 1994 | } |
1994 | 1995 | ||
1995 | /// <summary> | 1996 | /// <summary> |
1996 | /// Duplicate the given object, Fire and Forget, No rotation, no return wrapper | ||
1997 | /// </summary> | ||
1998 | /// <param name="originalPrim"></param> | ||
1999 | /// <param name="offset"></param> | ||
2000 | /// <param name="flags"></param> | ||
2001 | /// <param name="AgentID"></param> | ||
2002 | /// <param name="GroupID"></param> | ||
2003 | protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) | ||
2004 | { | ||
2005 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | ||
2006 | |||
2007 | // SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero); | ||
2008 | DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | ||
2009 | } | ||
2010 | |||
2011 | /// <summary> | ||
2012 | /// Duplicate the given object. | 1997 | /// Duplicate the given object. |
2013 | /// </summary> | 1998 | /// </summary> |
2014 | /// <param name="originalPrim"></param> | 1999 | /// <param name="originalPrim"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5576ec9..0d14963 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | 244 | ||
245 | public bool IgnoreUndoUpdate = false; | 245 | public bool IgnoreUndoUpdate = false; |
246 | 246 | ||
247 | private PrimFlags LocalFlags; | 247 | public PrimFlags LocalFlags; |
248 | 248 | ||
249 | private float m_damage = -1.0f; | 249 | private float m_damage = -1.0f; |
250 | private byte[] m_TextureAnimation; | 250 | private byte[] m_TextureAnimation; |
@@ -933,32 +933,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
933 | public Color Color | 933 | public Color Color |
934 | { | 934 | { |
935 | get { return m_color; } | 935 | get { return m_color; } |
936 | set | 936 | set { m_color = value; } |
937 | { | ||
938 | m_color = value; | ||
939 | |||
940 | /* ScheduleFullUpdate() need not be called b/c after | ||
941 | * setting the color, the text will be set, so then | ||
942 | * ScheduleFullUpdate() will be called. */ | ||
943 | //ScheduleFullUpdate(); | ||
944 | } | ||
945 | } | 937 | } |
946 | 938 | ||
947 | public string Text | 939 | public string Text |
948 | { | 940 | { |
949 | get | 941 | get |
950 | { | 942 | { |
951 | string returnstr = m_text; | 943 | if (m_text.Length > 255) |
952 | if (returnstr.Length > 255) | 944 | return m_text.Substring(0, 254); |
953 | { | 945 | return m_text; |
954 | returnstr = returnstr.Substring(0, 254); | ||
955 | } | ||
956 | return returnstr; | ||
957 | } | ||
958 | set | ||
959 | { | ||
960 | m_text = value; | ||
961 | } | 946 | } |
947 | set { m_text = value; } | ||
962 | } | 948 | } |
963 | 949 | ||
964 | 950 | ||
@@ -2795,6 +2781,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | if (ParentGroup == null) | 2781 | if (ParentGroup == null) |
2796 | return; | 2782 | return; |
2797 | 2783 | ||
2784 | // When running OpenSim tests, Scene (and EventManager can be null). | ||
2785 | // Need to fix tests before we can trigger this here | ||
2786 | // ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); | ||
2787 | |||
2798 | ParentGroup.QueueForUpdateCheck(); | 2788 | ParentGroup.QueueForUpdateCheck(); |
2799 | 2789 | ||
2800 | int timeNow = Util.UnixTimeSinceEpoch(); | 2790 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -2827,6 +2817,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2827 | if (ParentGroup == null) | 2817 | if (ParentGroup == null) |
2828 | return; | 2818 | return; |
2829 | 2819 | ||
2820 | // When running OpenSim tests, Scene (and EventManager can be null). | ||
2821 | // Need to fix tests before we can trigger this here | ||
2822 | // ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); | ||
2823 | |||
2830 | // This was pulled from SceneViewer. Attachments always receive full updates. | 2824 | // This was pulled from SceneViewer. Attachments always receive full updates. |
2831 | // I could not verify if this is a requirement but this maintains existing behavior | 2825 | // I could not verify if this is a requirement but this maintains existing behavior |
2832 | if (ParentGroup.IsAttachment) | 2826 | if (ParentGroup.IsAttachment) |