aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs48
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs30
4 files changed, 94 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index fd35c62..d31d380 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -398,12 +398,18 @@ namespace OpenSim.Region.Framework.Scenes
398 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; 398 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
399 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); 399 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
400 400
401 public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
402 public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
403
401 public delegate void RegionUp(GridRegion region); 404 public delegate void RegionUp(GridRegion region);
402 public event RegionUp OnRegionUp; 405 public event RegionUp OnRegionUp;
403 406
404 public delegate void RegionStarted(Scene scene); 407 public delegate void RegionStarted(Scene scene);
405 public event RegionStarted OnRegionStarted; 408 public event RegionStarted OnRegionStarted;
406 409
410 public delegate void RegionHeartbeatEnd(Scene scene);
411 public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
412
407 public delegate void LoginsEnabled(string regionName); 413 public delegate void LoginsEnabled(string regionName);
408 public event LoginsEnabled OnLoginsEnabled; 414 public event LoginsEnabled OnLoginsEnabled;
409 415
@@ -2203,6 +2209,27 @@ namespace OpenSim.Region.Framework.Scenes
2203 } 2209 }
2204 } 2210 }
2205 2211
2212 public void TriggerSceneObjectPartUpdated(SceneObjectPart sop)
2213 {
2214 SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
2215 if (handler != null)
2216 {
2217 foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
2218 {
2219 try
2220 {
2221 d(sop);
2222 }
2223 catch (Exception e)
2224 {
2225 m_log.ErrorFormat(
2226 "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
2227 e.Message, e.StackTrace);
2228 }
2229 }
2230 }
2231 }
2232
2206 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, 2233 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
2207 int local_id, IClientAPI remote_client) 2234 int local_id, IClientAPI remote_client)
2208 { 2235 {
@@ -2267,6 +2294,27 @@ namespace OpenSim.Region.Framework.Scenes
2267 } 2294 }
2268 } 2295 }
2269 2296
2297 public void TriggerRegionHeartbeatEnd(Scene scene)
2298 {
2299 RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
2300
2301 if (handler != null)
2302 {
2303 foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
2304 {
2305 try
2306 {
2307 d(scene);
2308 }
2309 catch (Exception e)
2310 {
2311 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
2312 e.Message, e.StackTrace);
2313 }
2314 }
2315 }
2316 }
2317
2270 public void TriggerLoginsEnabled (string regionName) 2318 public void TriggerLoginsEnabled (string regionName)
2271 { 2319 {
2272 LoginsEnabled handler = OnLoginsEnabled; 2320 LoginsEnabled handler = OnLoginsEnabled;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 23fee4e..186e01c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1385,6 +1385,8 @@ namespace OpenSim.Region.Framework.Scenes
1385 RegionInfo.RegionName, e.Message, e.StackTrace); 1385 RegionInfo.RegionName, e.Message, e.StackTrace);
1386 } 1386 }
1387 1387
1388 EventManager.TriggerRegionHeartbeatEnd(this);
1389
1388 maintc = Util.EnvironmentTickCountSubtract(maintc); 1390 maintc = Util.EnvironmentTickCountSubtract(maintc);
1389 maintc = (int)(MinFrameTime * 1000) - maintc; 1391 maintc = (int)(MinFrameTime * 1000) - maintc;
1390 1392
@@ -2714,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes
2714 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 2716 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
2715 client.OnLinkObjects += LinkObjects; 2717 client.OnLinkObjects += LinkObjects;
2716 client.OnDelinkObjects += DelinkObjects; 2718 client.OnDelinkObjects += DelinkObjects;
2717 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; 2719 client.OnObjectDuplicate += DuplicateObject;
2718 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; 2720 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
2719 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2721 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
2720 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; 2722 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
@@ -2841,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
2841 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; 2843 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
2842 client.OnLinkObjects -= LinkObjects; 2844 client.OnLinkObjects -= LinkObjects;
2843 client.OnDelinkObjects -= DelinkObjects; 2845 client.OnDelinkObjects -= DelinkObjects;
2844 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; 2846 client.OnObjectDuplicate -= DuplicateObject;
2845 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; 2847 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
2846 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; 2848 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
2847 client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; 2849 client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
@@ -2934,6 +2936,21 @@ namespace OpenSim.Region.Framework.Scenes
2934 } 2936 }
2935 2937
2936 /// <summary> 2938 /// <summary>
2939 /// Duplicates object specified by localID. This is the event handler for IClientAPI.
2940 /// </summary>
2941 /// <param name="originalPrim">ID of object to duplicate</param>
2942 /// <param name="offset"></param>
2943 /// <param name="flags"></param>
2944 /// <param name="AgentID">Agent doing the duplication</param>
2945 /// <param name="GroupID">Group of new object</param>
2946 public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
2947 {
2948 SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
2949 if (copy != null)
2950 EventManager.TriggerObjectAddedToScene(copy);
2951 }
2952
2953 /// <summary>
2937 /// Duplicates object specified by localID at position raycasted against RayTargetObject using 2954 /// Duplicates object specified by localID at position raycasted against RayTargetObject using
2938 /// RayEnd and RayStart to determine what the angle of the ray is 2955 /// RayEnd and RayStart to determine what the angle of the ray is
2939 /// </summary> 2956 /// </summary>
@@ -2995,19 +3012,22 @@ namespace OpenSim.Region.Framework.Scenes
2995 3012
2996 // stick in offset format from the original prim 3013 // stick in offset format from the original prim
2997 pos = pos - target.ParentGroup.AbsolutePosition; 3014 pos = pos - target.ParentGroup.AbsolutePosition;
3015 SceneObjectGroup copy;
2998 if (CopyRotates) 3016 if (CopyRotates)
2999 { 3017 {
3000 Quaternion worldRot = target2.GetWorldRotation(); 3018 Quaternion worldRot = target2.GetWorldRotation();
3001 3019
3002 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3020 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3003 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3021 copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3004 //obj.Rotation = worldRot; 3022 //obj.Rotation = worldRot;
3005 //obj.UpdateGroupRotationR(worldRot); 3023 //obj.UpdateGroupRotationR(worldRot);
3006 } 3024 }
3007 else 3025 else
3008 { 3026 {
3009 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); 3027 copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
3010 } 3028 }
3029 if (copy != null)
3030 EventManager.TriggerObjectAddedToScene(copy);
3011 } 3031 }
3012 } 3032 }
3013 } 3033 }
@@ -4292,6 +4312,16 @@ namespace OpenSim.Region.Framework.Scenes
4292 return m_sceneGraph.GetGroupByPrim(localID); 4312 return m_sceneGraph.GetGroupByPrim(localID);
4293 } 4313 }
4294 4314
4315 /// <summary>
4316 /// Get a scene object group that contains the prim with the given uuid
4317 /// </summary>
4318 /// <param name="fullID"></param>
4319 /// <returns>null if no scene object group containing that prim is found</returns>
4320 public SceneObjectGroup GetGroupByPrim(UUID fullID)
4321 {
4322 return m_sceneGraph.GetGroupByPrim(fullID);
4323 }
4324
4295 public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp) 4325 public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
4296 { 4326 {
4297 return m_sceneGraph.TryGetScenePresence(agentID, out sp); 4327 return m_sceneGraph.TryGetScenePresence(agentID, out sp);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 06de72f..7d801b5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -301,6 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
301 /// </summary> 301 /// </summary>
302 /// 302 ///
303 /// This method does not send updates to the client - callers need to handle this themselves. 303 /// This method does not send updates to the client - callers need to handle this themselves.
304 /// Caller should also trigger EventManager.TriggerObjectAddedToScene
304 /// <param name="sceneObject"></param> 305 /// <param name="sceneObject"></param>
305 /// <param name="attachToBackup"></param> 306 /// <param name="attachToBackup"></param>
306 /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> 307 /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
@@ -921,7 +922,7 @@ namespace OpenSim.Region.Framework.Scenes
921 /// </summary> 922 /// </summary>
922 /// <param name="fullID"></param> 923 /// <param name="fullID"></param>
923 /// <returns>null if no scene object group containing that prim is found</returns> 924 /// <returns>null if no scene object group containing that prim is found</returns>
924 private SceneObjectGroup GetGroupByPrim(UUID fullID) 925 public SceneObjectGroup GetGroupByPrim(UUID fullID)
925 { 926 {
926 SceneObjectGroup sog; 927 SceneObjectGroup sog;
927 lock (SceneObjectGroupsByFullPartID) 928 lock (SceneObjectGroupsByFullPartID)
@@ -1872,22 +1873,6 @@ namespace OpenSim.Region.Framework.Scenes
1872 } 1873 }
1873 1874
1874 /// <summary> 1875 /// <summary>
1875 /// Duplicate the given object, Fire and Forget, No rotation, no return wrapper
1876 /// </summary>
1877 /// <param name="originalPrim"></param>
1878 /// <param name="offset"></param>
1879 /// <param name="flags"></param>
1880 /// <param name="AgentID"></param>
1881 /// <param name="GroupID"></param>
1882 protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
1883 {
1884 //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
1885
1886 // SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero);
1887 DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
1888 }
1889
1890 /// <summary>
1891 /// Duplicate the given object. 1876 /// Duplicate the given object.
1892 /// </summary> 1877 /// </summary>
1893 /// <param name="originalPrim"></param> 1878 /// <param name="originalPrim"></param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 36d3588..9b660b6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -235,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes
235 235
236 public bool IgnoreUndoUpdate = false; 236 public bool IgnoreUndoUpdate = false;
237 237
238 private PrimFlags LocalFlags; 238 public PrimFlags LocalFlags;
239 239
240 private float m_damage = -1.0f; 240 private float m_damage = -1.0f;
241 private byte[] m_TextureAnimation; 241 private byte[] m_TextureAnimation;
@@ -902,32 +902,18 @@ namespace OpenSim.Region.Framework.Scenes
902 public Color Color 902 public Color Color
903 { 903 {
904 get { return m_color; } 904 get { return m_color; }
905 set 905 set { m_color = value; }
906 {
907 m_color = value;
908
909 /* ScheduleFullUpdate() need not be called b/c after
910 * setting the color, the text will be set, so then
911 * ScheduleFullUpdate() will be called. */
912 //ScheduleFullUpdate();
913 }
914 } 906 }
915 907
916 public string Text 908 public string Text
917 { 909 {
918 get 910 get
919 { 911 {
920 string returnstr = m_text; 912 if (m_text.Length > 255)
921 if (returnstr.Length > 255) 913 return m_text.Substring(0, 254);
922 { 914 return m_text;
923 returnstr = returnstr.Substring(0, 254);
924 }
925 return returnstr;
926 }
927 set
928 {
929 m_text = value;
930 } 915 }
916 set { m_text = value; }
931 } 917 }
932 918
933 919
@@ -2743,6 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes
2743 if (ParentGroup == null) 2729 if (ParentGroup == null)
2744 return; 2730 return;
2745 2731
2732 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
2733
2746 ParentGroup.QueueForUpdateCheck(); 2734 ParentGroup.QueueForUpdateCheck();
2747 2735
2748 int timeNow = Util.UnixTimeSinceEpoch(); 2736 int timeNow = Util.UnixTimeSinceEpoch();
@@ -2775,6 +2763,8 @@ namespace OpenSim.Region.Framework.Scenes
2775 if (ParentGroup == null) 2763 if (ParentGroup == null)
2776 return; 2764 return;
2777 2765
2766 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
2767
2778 // This was pulled from SceneViewer. Attachments always receive full updates. 2768 // This was pulled from SceneViewer. Attachments always receive full updates.
2779 // I could not verify if this is a requirement but this maintains existing behavior 2769 // I could not verify if this is a requirement but this maintains existing behavior
2780 if (ParentGroup.IsAttachment) 2770 if (ParentGroup.IsAttachment)