From 586ae0f6a07358f8367c4f916bff9fd688a43aa3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Jul 2010 20:13:26 +0100 Subject: Add EventManager.OnSceneObjectLoaded() for future use. This is fired immediately after a scene object is loaded from storage. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 32 +++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 9db2e41..0b1f593 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -331,9 +331,16 @@ namespace OpenSim.Region.Framework.Scenes /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; + + public delegate void SceneObjectDelegate(SceneObjectGroup so); + + /// + /// Called immediately after an object is loaded from storage. + /// + public event SceneObjectDelegate OnSceneObjectLoaded; public delegate void RegionUp(GridRegion region); - public event RegionUp OnRegionUp; + public event RegionUp OnRegionUp; public class MoneyTransferArgs : EventArgs { @@ -2013,5 +2020,26 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) + { + SceneObjectDelegate handler = OnSceneObjectLoaded; + if (handler != null) + { + foreach (SceneObjectDelegate d in handler.GetInvocationList()) + { + try + { + d(so); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } } -} +} \ No newline at end of file -- cgit v1.1 From b51b2efdc8059548e1da7ac13ee858673b71592f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Jul 2010 20:36:28 +0100 Subject: Add EventManager.OnSceneObjectPreSave() for future use. This is triggered immediately before a copy of the group is persisted to storage --- OpenSim/Region/Framework/Scenes/EventManager.cs | 39 +++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 0b1f593..3b8d727 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -330,14 +330,26 @@ namespace OpenSim.Region.Framework.Scenes /// If the object is being attached, then the avatarID will be present. If the object is being detached then /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); - public event Attach OnAttach; - - public delegate void SceneObjectDelegate(SceneObjectGroup so); + public event Attach OnAttach; /// /// Called immediately after an object is loaded from storage. /// public event SceneObjectDelegate OnSceneObjectLoaded; + public delegate void SceneObjectDelegate(SceneObjectGroup so); + + /// + /// Called immediately before an object is saved to storage. + /// + /// + /// The scene object being persisted. + /// 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. + /// + /// + /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save. + /// + public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; + public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; @@ -2040,6 +2052,27 @@ namespace OpenSim.Region.Framework.Scenes } } } + } + + public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) + { + SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave; + if (handler != null) + { + foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList()) + { + try + { + d(persistingSo, originalSo); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } } } \ No newline at end of file -- cgit v1.1 From 0f15ccb2cf994c64fb8c7f71a64721a3e5fe3085 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 28 Jul 2010 19:23:30 +0100 Subject: relocate moap specific cloning code to MoapModule --- OpenSim/Region/Framework/Scenes/EventManager.cs | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 3b8d727..0a9a29e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -350,6 +350,12 @@ namespace OpenSim.Region.Framework.Scenes /// public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); + + /// + /// Called when a scene object part is cloned within the region. + /// + public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; + public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original); public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; @@ -2073,6 +2079,27 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } + + public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original) + { + SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy; + if (handler != null) + { + foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList()) + { + try + { + d(copy, original); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } } } \ No newline at end of file -- cgit v1.1 From f067f733ea60cc821d51889871f1f8d476aebd76 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 28 Jul 2010 19:38:20 +0100 Subject: add userExposed parameter to part copy event --- OpenSim/Region/Framework/Scenes/EventManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 0a9a29e..0ae3146 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -354,8 +354,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// Called when a scene object part is cloned within the region. /// + /// + /// + /// True if the duplicate will immediately be in the scene, false otherwise public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; - public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original); + public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; @@ -2081,7 +2084,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original) + public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) { SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy; if (handler != null) @@ -2090,7 +2093,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(copy, original); + d(copy, original, userExposed); } catch (Exception e) { -- cgit v1.1