relocate moap specific cloning code to MoapModule
parent
5aa56b1274
commit
0f15ccb2cf
|
@ -122,6 +122,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
|||
m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
|
||||
m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded;
|
||||
m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave;
|
||||
m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -133,6 +134,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
|||
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
|
||||
m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded;
|
||||
m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave;
|
||||
m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
|
||||
}
|
||||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
|
@ -264,6 +266,24 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
|||
}
|
||||
}
|
||||
|
||||
protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original)
|
||||
{
|
||||
if (original.Shape.Media != null)
|
||||
{
|
||||
List<MediaEntry> dupeMedia = new List<MediaEntry>();
|
||||
|
||||
foreach (MediaEntry me in original.Shape.Media)
|
||||
{
|
||||
if (me != null)
|
||||
dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD()));
|
||||
else
|
||||
dupeMedia.Add(null);
|
||||
}
|
||||
|
||||
copy.Shape.Media = dupeMedia;
|
||||
}
|
||||
}
|
||||
|
||||
public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
|
||||
{
|
||||
MediaEntry me = null;
|
||||
|
|
|
@ -350,6 +350,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </param>
|
||||
public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
|
||||
public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a scene object part is cloned within the region.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1617,20 +1617,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
}
|
||||
|
||||
if (Shape.Media != null)
|
||||
{
|
||||
List<MediaEntry> dupeMedia = new List<MediaEntry>();
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue