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 +++++++++++++++++++++-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 +----------
2 files changed, 29 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
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
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 085da19..71ca605 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1617,20 +1617,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
}
- if (Shape.Media != null)
- {
- List dupeMedia = new List();
-
- foreach (MediaEntry me in Shape.Media)
- {
- if (me != null)
- dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD()));
- else
- dupeMedia.Add(null);
- }
-
- dupe.Shape.Media = dupeMedia;
- }
+ ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this);
// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
--
cgit v1.1