aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs15
3 files changed, 49 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 6d74b8e..f4814ce 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -122,6 +122,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
122 m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; 122 m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
123 m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; 123 m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded;
124 m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave; 124 m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave;
125 m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy;
125 } 126 }
126 127
127 public void Close() 128 public void Close()
@@ -133,6 +134,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
133 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; 134 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
134 m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; 135 m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded;
135 m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave; 136 m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave;
137 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
136 } 138 }
137 139
138 public void OnRegisterCaps(UUID agentID, Caps caps) 140 public void OnRegisterCaps(UUID agentID, Caps caps)
@@ -264,6 +266,24 @@ namespace OpenSim.Region.CoreModules.Media.Moap
264 } 266 }
265 } 267 }
266 268
269 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original)
270 {
271 if (original.Shape.Media != null)
272 {
273 List<MediaEntry> dupeMedia = new List<MediaEntry>();
274
275 foreach (MediaEntry me in original.Shape.Media)
276 {
277 if (me != null)
278 dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD()));
279 else
280 dupeMedia.Add(null);
281 }
282
283 copy.Shape.Media = dupeMedia;
284 }
285 }
286
267 public MediaEntry GetMediaEntry(SceneObjectPart part, int face) 287 public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
268 { 288 {
269 MediaEntry me = null; 289 MediaEntry me = null;
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
350 /// </param> 350 /// </param>
351 public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; 351 public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
352 public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); 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 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
358 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original);
353 359
354 public delegate void RegionUp(GridRegion region); 360 public delegate void RegionUp(GridRegion region);
355 public event RegionUp OnRegionUp; 361 public event RegionUp OnRegionUp;
@@ -2073,6 +2079,27 @@ namespace OpenSim.Region.Framework.Scenes
2073 } 2079 }
2074 } 2080 }
2075 } 2081 }
2076 } 2082 }
2083
2084 public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original)
2085 {
2086 SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
2087 if (handler != null)
2088 {
2089 foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
2090 {
2091 try
2092 {
2093 d(copy, original);
2094 }
2095 catch (Exception e)
2096 {
2097 m_log.ErrorFormat(
2098 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
2099 e.Message, e.StackTrace);
2100 }
2101 }
2102 }
2103 }
2077 } 2104 }
2078} \ No newline at end of file 2105} \ 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
1617 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1617 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1618 } 1618 }
1619 1619
1620 if (Shape.Media != null) 1620 ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this);
1621 {
1622 List<MediaEntry> dupeMedia = new List<MediaEntry>();
1623
1624 foreach (MediaEntry me in Shape.Media)
1625 {
1626 if (me != null)
1627 dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD()));
1628 else
1629 dupeMedia.Add(null);
1630 }
1631
1632 dupe.Shape.Media = dupeMedia;
1633 }
1634 1621
1635// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); 1622// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
1636 1623