aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-06 18:28:53 +0100
committerJustin Clark-Casey (justincc)2010-08-06 18:29:30 +0100
commit1270727c969db07831866947b611d49873031739 (patch)
tree8fd490eaf5c49d69be948fd9e58c0be1f7e38331 /OpenSim/Region/Framework/Scenes
parentChange XEngine to use the new constant (diff)
parentfix mysql/mssql prim serialization problem (diff)
downloadopensim-SC_OLD-1270727c969db07831866947b611d49873031739.zip
opensim-SC_OLD-1270727c969db07831866947b611d49873031739.tar.gz
opensim-SC_OLD-1270727c969db07831866947b611d49873031739.tar.bz2
opensim-SC_OLD-1270727c969db07831866947b611d49873031739.tar.xz
Merge branch 'moap'
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs97
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs40
5 files changed, 173 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 9db2e41..0ae3146 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -330,10 +330,38 @@ namespace OpenSim.Region.Framework.Scenes
330 /// If the object is being attached, then the avatarID will be present. If the object is being detached then 330 /// If the object is being attached, then the avatarID will be present. If the object is being detached then
331 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). 331 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
332 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 332 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
333 public event Attach OnAttach; 333 public event Attach OnAttach;
334
335 /// <summary>
336 /// Called immediately after an object is loaded from storage.
337 /// </summary>
338 public event SceneObjectDelegate OnSceneObjectLoaded;
339 public delegate void SceneObjectDelegate(SceneObjectGroup so);
340
341 /// <summary>
342 /// Called immediately before an object is saved to storage.
343 /// </summary>
344 /// <param name="persistingSo">
345 /// The scene object being persisted.
346 /// 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.
347 /// </param>
348 /// <param name="originalSo">
349 /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
350 /// </param>
351 public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
352 public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
353
354 /// <summary>
355 /// Called when a scene object part is cloned within the region.
356 /// </summary>
357 /// <param name="copy"></param>
358 /// <param name="original"></param>
359 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
360 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
361 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
334 362
335 public delegate void RegionUp(GridRegion region); 363 public delegate void RegionUp(GridRegion region);
336 public event RegionUp OnRegionUp; 364 public event RegionUp OnRegionUp;
337 365
338 public class MoneyTransferArgs : EventArgs 366 public class MoneyTransferArgs : EventArgs
339 { 367 {
@@ -2013,5 +2041,68 @@ namespace OpenSim.Region.Framework.Scenes
2013 } 2041 }
2014 } 2042 }
2015 } 2043 }
2044
2045 public void TriggerOnSceneObjectLoaded(SceneObjectGroup so)
2046 {
2047 SceneObjectDelegate handler = OnSceneObjectLoaded;
2048 if (handler != null)
2049 {
2050 foreach (SceneObjectDelegate d in handler.GetInvocationList())
2051 {
2052 try
2053 {
2054 d(so);
2055 }
2056 catch (Exception e)
2057 {
2058 m_log.ErrorFormat(
2059 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}",
2060 e.Message, e.StackTrace);
2061 }
2062 }
2063 }
2064 }
2065
2066 public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
2067 {
2068 SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
2069 if (handler != null)
2070 {
2071 foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
2072 {
2073 try
2074 {
2075 d(persistingSo, originalSo);
2076 }
2077 catch (Exception e)
2078 {
2079 m_log.ErrorFormat(
2080 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
2081 e.Message, e.StackTrace);
2082 }
2083 }
2084 }
2085 }
2086
2087 public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
2088 {
2089 SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
2090 if (handler != null)
2091 {
2092 foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
2093 {
2094 try
2095 {
2096 d(copy, original, userExposed);
2097 }
2098 catch (Exception e)
2099 {
2100 m_log.ErrorFormat(
2101 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
2102 e.Message, e.StackTrace);
2103 }
2104 }
2105 }
2106 }
2016 } 2107 }
2017} 2108} \ 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 93f684c..dcd7f3d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1887,9 +1887,11 @@ namespace OpenSim.Region.Framework.Scenes
1887 1887
1888 foreach (SceneObjectGroup group in PrimsFromDB) 1888 foreach (SceneObjectGroup group in PrimsFromDB)
1889 { 1889 {
1890 EventManager.TriggerOnSceneObjectLoaded(group);
1891
1890 if (group.RootPart == null) 1892 if (group.RootPart == null)
1891 { 1893 {
1892 m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", 1894 m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
1893 group.Children == null ? 0 : group.Children.Count); 1895 group.Children == null ? 0 : group.Children.Count);
1894 } 1896 }
1895 1897
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 17275d0..e26e4ae 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1479,6 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
1479 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1479 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1480 HasGroupChanged = false; 1480 HasGroupChanged = false;
1481 1481
1482 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
1482 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1483 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1483 1484
1484 backup_group.ForEachPart(delegate(SceneObjectPart part) 1485 backup_group.ForEachPart(delegate(SceneObjectPart part)
@@ -1527,6 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes
1527 /// <summary> 1528 /// <summary>
1528 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1529 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1529 /// </summary> 1530 /// </summary>
1531 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
1530 /// <returns></returns> 1532 /// <returns></returns>
1531 public SceneObjectGroup Copy(bool userExposed) 1533 public SceneObjectGroup Copy(bool userExposed)
1532 { 1534 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 69f9627..3dac0ad 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
@@ -321,6 +322,11 @@ namespace OpenSim.Region.Framework.Scenes
321 protected Vector3 m_lastAcceleration; 322 protected Vector3 m_lastAcceleration;
322 protected Vector3 m_lastAngularVelocity; 323 protected Vector3 m_lastAngularVelocity;
323 protected int m_lastTerseSent; 324 protected int m_lastTerseSent;
325
326 /// <summary>
327 /// Stores media texture data
328 /// </summary>
329 protected string m_mediaUrl;
324 330
325 // TODO: Those have to be changed into persistent properties at some later point, 331 // TODO: Those have to be changed into persistent properties at some later point,
326 // or sit-camera on vehicles will break on sim-crossing. 332 // or sit-camera on vehicles will break on sim-crossing.
@@ -965,18 +971,39 @@ namespace OpenSim.Region.Framework.Scenes
965 TriggerScriptChangedEvent(Changed.SCALE); 971 TriggerScriptChangedEvent(Changed.SCALE);
966 } 972 }
967 } 973 }
974
968 public byte UpdateFlag 975 public byte UpdateFlag
969 { 976 {
970 get { return m_updateFlag; } 977 get { return m_updateFlag; }
971 set { m_updateFlag = value; } 978 set { m_updateFlag = value; }
972 } 979 }
980
981 /// <summary>
982 /// Used for media on a prim.
983 /// </summary>
984 /// Do not change this value directly - always do it through an IMoapModule.
985 public string MediaUrl
986 {
987 get
988 {
989 return m_mediaUrl;
990 }
991
992 set
993 {
994 m_mediaUrl = value;
995
996 if (ParentGroup != null)
997 ParentGroup.HasGroupChanged = true;
998 }
999 }
973 1000
974 [XmlIgnore] 1001 [XmlIgnore]
975 public bool CreateSelected 1002 public bool CreateSelected
976 { 1003 {
977 get { return m_createSelected; } 1004 get { return m_createSelected; }
978 set { m_createSelected = value; } 1005 set { m_createSelected = value; }
979 } 1006 }
980 1007
981 #endregion 1008 #endregion
982 1009
@@ -1527,6 +1554,11 @@ namespace OpenSim.Region.Framework.Scenes
1527 /// <summary> 1554 /// <summary>
1528 /// Duplicates this part. 1555 /// Duplicates this part.
1529 /// </summary> 1556 /// </summary>
1557 /// <param name="localID"></param>
1558 /// <param name="AgentID"></param>
1559 /// <param name="GroupID"></param>
1560 /// <param name="linkNum"></param>
1561 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
1530 /// <returns></returns> 1562 /// <returns></returns>
1531 public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) 1563 public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
1532 { 1564 {
@@ -1590,7 +1622,11 @@ namespace OpenSim.Region.Framework.Scenes
1590 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1622 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1591 } 1623 }
1592 1624
1593 return dupe; 1625 ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed);
1626
1627// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
1628
1629 return dupe;
1594 } 1630 }
1595 1631
1596 protected void AssetReceived(string id, Object sender, AssetBase asset) 1632 protected void AssetReceived(string id, Object sender, AssetBase asset)