diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 97 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 |
6 files changed, 179 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index e060c05..52e6e92 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -334,10 +334,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
334 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | 334 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then |
335 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | 335 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). |
336 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 336 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
337 | public event Attach OnAttach; | 337 | public event Attach OnAttach; |
338 | |||
339 | /// <summary> | ||
340 | /// Called immediately after an object is loaded from storage. | ||
341 | /// </summary> | ||
342 | public event SceneObjectDelegate OnSceneObjectLoaded; | ||
343 | public delegate void SceneObjectDelegate(SceneObjectGroup so); | ||
344 | |||
345 | /// <summary> | ||
346 | /// Called immediately before an object is saved to storage. | ||
347 | /// </summary> | ||
348 | /// <param name="persistingSo"> | ||
349 | /// The scene object being persisted. | ||
350 | /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. | ||
351 | /// </param> | ||
352 | /// <param name="originalSo"> | ||
353 | /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save. | ||
354 | /// </param> | ||
355 | public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; | ||
356 | public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); | ||
357 | |||
358 | /// <summary> | ||
359 | /// Called when a scene object part is cloned within the region. | ||
360 | /// </summary> | ||
361 | /// <param name="copy"></param> | ||
362 | /// <param name="original"></param> | ||
363 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | ||
364 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; | ||
365 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | ||
338 | 366 | ||
339 | public delegate void RegionUp(GridRegion region); | 367 | public delegate void RegionUp(GridRegion region); |
340 | public event RegionUp OnRegionUp; | 368 | public event RegionUp OnRegionUp; |
341 | 369 | ||
342 | public class MoneyTransferArgs : EventArgs | 370 | public class MoneyTransferArgs : EventArgs |
343 | { | 371 | { |
@@ -2037,5 +2065,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | } | 2065 | } |
2038 | } | 2066 | } |
2039 | } | 2067 | } |
2068 | |||
2069 | public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) | ||
2070 | { | ||
2071 | SceneObjectDelegate handler = OnSceneObjectLoaded; | ||
2072 | if (handler != null) | ||
2073 | { | ||
2074 | foreach (SceneObjectDelegate d in handler.GetInvocationList()) | ||
2075 | { | ||
2076 | try | ||
2077 | { | ||
2078 | d(so); | ||
2079 | } | ||
2080 | catch (Exception e) | ||
2081 | { | ||
2082 | m_log.ErrorFormat( | ||
2083 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", | ||
2084 | e.Message, e.StackTrace); | ||
2085 | } | ||
2086 | } | ||
2087 | } | ||
2088 | } | ||
2089 | |||
2090 | public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) | ||
2091 | { | ||
2092 | SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave; | ||
2093 | if (handler != null) | ||
2094 | { | ||
2095 | foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList()) | ||
2096 | { | ||
2097 | try | ||
2098 | { | ||
2099 | d(persistingSo, originalSo); | ||
2100 | } | ||
2101 | catch (Exception e) | ||
2102 | { | ||
2103 | m_log.ErrorFormat( | ||
2104 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}", | ||
2105 | e.Message, e.StackTrace); | ||
2106 | } | ||
2107 | } | ||
2108 | } | ||
2109 | } | ||
2110 | |||
2111 | public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) | ||
2112 | { | ||
2113 | SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy; | ||
2114 | if (handler != null) | ||
2115 | { | ||
2116 | foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList()) | ||
2117 | { | ||
2118 | try | ||
2119 | { | ||
2120 | d(copy, original, userExposed); | ||
2121 | } | ||
2122 | catch (Exception e) | ||
2123 | { | ||
2124 | m_log.ErrorFormat( | ||
2125 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", | ||
2126 | e.Message, e.StackTrace); | ||
2127 | } | ||
2128 | } | ||
2129 | } | ||
2130 | } | ||
2040 | } | 2131 | } |
2041 | } | 2132 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index a523351..4e80bf2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -82,6 +82,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); | 82 | public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); |
83 | public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); | 83 | public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); |
84 | public delegate bool TeleportHandler(UUID userID, Scene scene); | 84 | public delegate bool TeleportHandler(UUID userID, Scene scene); |
85 | public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); | ||
86 | public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); | ||
85 | #endregion | 87 | #endregion |
86 | 88 | ||
87 | public class ScenePermissions | 89 | public class ScenePermissions |
@@ -141,6 +143,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | public event CopyUserInventoryHandler OnCopyUserInventory; | 143 | public event CopyUserInventoryHandler OnCopyUserInventory; |
142 | public event DeleteUserInventoryHandler OnDeleteUserInventory; | 144 | public event DeleteUserInventoryHandler OnDeleteUserInventory; |
143 | public event TeleportHandler OnTeleport; | 145 | public event TeleportHandler OnTeleport; |
146 | public event ControlPrimMediaHandler OnControlPrimMedia; | ||
147 | public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; | ||
144 | #endregion | 148 | #endregion |
145 | 149 | ||
146 | #region Object Permission Checks | 150 | #region Object Permission Checks |
@@ -964,5 +968,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | } | 968 | } |
965 | return true; | 969 | return true; |
966 | } | 970 | } |
971 | |||
972 | public bool CanControlPrimMedia(UUID userID, UUID primID, int face) | ||
973 | { | ||
974 | ControlPrimMediaHandler handler = OnControlPrimMedia; | ||
975 | if (handler != null) | ||
976 | { | ||
977 | Delegate[] list = handler.GetInvocationList(); | ||
978 | foreach (ControlPrimMediaHandler h in list) | ||
979 | { | ||
980 | if (h(userID, primID, face) == false) | ||
981 | return false; | ||
982 | } | ||
983 | } | ||
984 | return true; | ||
985 | } | ||
986 | |||
987 | public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face) | ||
988 | { | ||
989 | InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia; | ||
990 | if (handler != null) | ||
991 | { | ||
992 | Delegate[] list = handler.GetInvocationList(); | ||
993 | foreach (InteractWithPrimMediaHandler h in list) | ||
994 | { | ||
995 | if (h(userID, primID, face) == false) | ||
996 | return false; | ||
997 | } | ||
998 | } | ||
999 | return true; | ||
1000 | } | ||
967 | } | 1001 | } |
968 | } | 1002 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 644fbb0..d55c7a1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1918,9 +1918,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1918 | 1918 | ||
1919 | foreach (SceneObjectGroup group in PrimsFromDB) | 1919 | foreach (SceneObjectGroup group in PrimsFromDB) |
1920 | { | 1920 | { |
1921 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1922 | |||
1921 | if (group.RootPart == null) | 1923 | if (group.RootPart == null) |
1922 | { | 1924 | { |
1923 | m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", | 1925 | m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", |
1924 | group.Children == null ? 0 : group.Children.Count); | 1926 | group.Children == null ? 0 : group.Children.Count); |
1925 | } | 1927 | } |
1926 | 1928 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5a3dc20..8ce79a2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1745,6 +1745,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1745 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; | 1745 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; |
1746 | HasGroupChanged = false; | 1746 | HasGroupChanged = false; |
1747 | 1747 | ||
1748 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | ||
1748 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); | 1749 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); |
1749 | 1750 | ||
1750 | backup_group.ForEachPart(delegate(SceneObjectPart part) | 1751 | backup_group.ForEachPart(delegate(SceneObjectPart part) |
@@ -1795,6 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1795 | /// <summary> | 1796 | /// <summary> |
1796 | /// Duplicates this object, including operations such as physics set up and attaching to the backup event. | 1797 | /// Duplicates this object, including operations such as physics set up and attaching to the backup event. |
1797 | /// </summary> | 1798 | /// </summary> |
1799 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | ||
1798 | /// <returns></returns> | 1800 | /// <returns></returns> |
1799 | public SceneObjectGroup Copy(bool userExposed) | 1801 | public SceneObjectGroup Copy(bool userExposed) |
1800 | { | 1802 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index badd357..efdc19c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
59 | REGION = 256, | 59 | REGION = 256, |
60 | TELEPORT = 512, | 60 | TELEPORT = 512, |
61 | REGION_RESTART = 1024, | 61 | REGION_RESTART = 1024, |
62 | MEDIA = 2048, | ||
62 | ANIMATION = 16384 | 63 | ANIMATION = 16384 |
63 | } | 64 | } |
64 | 65 | ||
@@ -330,6 +331,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
330 | protected Vector3 m_lastAcceleration; | 331 | protected Vector3 m_lastAcceleration; |
331 | protected Vector3 m_lastAngularVelocity; | 332 | protected Vector3 m_lastAngularVelocity; |
332 | protected int m_lastTerseSent; | 333 | protected int m_lastTerseSent; |
334 | |||
335 | /// <summary> | ||
336 | /// Stores media texture data | ||
337 | /// </summary> | ||
338 | protected string m_mediaUrl; | ||
333 | 339 | ||
334 | // TODO: Those have to be changed into persistent properties at some later point, | 340 | // TODO: Those have to be changed into persistent properties at some later point, |
335 | // or sit-camera on vehicles will break on sim-crossing. | 341 | // or sit-camera on vehicles will break on sim-crossing. |
@@ -984,18 +990,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
984 | TriggerScriptChangedEvent(Changed.SCALE); | 990 | TriggerScriptChangedEvent(Changed.SCALE); |
985 | } | 991 | } |
986 | } | 992 | } |
993 | |||
987 | public byte UpdateFlag | 994 | public byte UpdateFlag |
988 | { | 995 | { |
989 | get { return m_updateFlag; } | 996 | get { return m_updateFlag; } |
990 | set { m_updateFlag = value; } | 997 | set { m_updateFlag = value; } |
991 | } | 998 | } |
999 | |||
1000 | /// <summary> | ||
1001 | /// Used for media on a prim. | ||
1002 | /// </summary> | ||
1003 | /// Do not change this value directly - always do it through an IMoapModule. | ||
1004 | public string MediaUrl | ||
1005 | { | ||
1006 | get | ||
1007 | { | ||
1008 | return m_mediaUrl; | ||
1009 | } | ||
1010 | |||
1011 | set | ||
1012 | { | ||
1013 | m_mediaUrl = value; | ||
1014 | |||
1015 | if (ParentGroup != null) | ||
1016 | ParentGroup.HasGroupChanged = true; | ||
1017 | } | ||
1018 | } | ||
992 | 1019 | ||
993 | [XmlIgnore] | 1020 | [XmlIgnore] |
994 | public bool CreateSelected | 1021 | public bool CreateSelected |
995 | { | 1022 | { |
996 | get { return m_createSelected; } | 1023 | get { return m_createSelected; } |
997 | set { m_createSelected = value; } | 1024 | set { m_createSelected = value; } |
998 | } | 1025 | } |
999 | 1026 | ||
1000 | #endregion | 1027 | #endregion |
1001 | 1028 | ||
@@ -1553,6 +1580,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1553 | /// <summary> | 1580 | /// <summary> |
1554 | /// Duplicates this part. | 1581 | /// Duplicates this part. |
1555 | /// </summary> | 1582 | /// </summary> |
1583 | /// <param name="localID"></param> | ||
1584 | /// <param name="AgentID"></param> | ||
1585 | /// <param name="GroupID"></param> | ||
1586 | /// <param name="linkNum"></param> | ||
1587 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | ||
1556 | /// <returns></returns> | 1588 | /// <returns></returns> |
1557 | public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) | 1589 | public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) |
1558 | { | 1590 | { |
@@ -1616,7 +1648,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1616 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); | 1648 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); |
1617 | } | 1649 | } |
1618 | 1650 | ||
1619 | return dupe; | 1651 | ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); |
1652 | |||
1653 | // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); | ||
1654 | |||
1655 | return dupe; | ||
1620 | } | 1656 | } |
1621 | 1657 | ||
1622 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 1658 | protected void AssetReceived(string id, Object sender, AssetBase asset) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 44c3d12..b3fa2f4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1059,7 +1059,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1059 | /// </summary> | 1059 | /// </summary> |
1060 | public void MakeChildAgent() | 1060 | public void MakeChildAgent() |
1061 | { | 1061 | { |
1062 | Animator.ResetAnimations(); | 1062 | // It looks like m_animator is set to null somewhere, and MakeChild |
1063 | // is called after that. Probably in aborted teleports. | ||
1064 | if (m_animator == null) | ||
1065 | m_animator = new ScenePresenceAnimator(this); | ||
1066 | else | ||
1067 | Animator.ResetAnimations(); | ||
1063 | 1068 | ||
1064 | // m_log.DebugFormat( | 1069 | // m_log.DebugFormat( |
1065 | // "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", | 1070 | // "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", |