mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
This commit is contained in:
67
OpenSim/Region/Framework/Interfaces/IMoapModule.cs
Normal file
67
OpenSim/Region/Framework/Interfaces/IMoapModule.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides methods from manipulating media-on-a-prim
|
||||
/// </summary>
|
||||
public interface IMoapModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the media entry for a given prim face.
|
||||
/// </summary>
|
||||
/// A copy of the media entry is returned rather than the original, so this can be altered at will without
|
||||
/// affecting the original settings.
|
||||
/// <param name="part"></param>
|
||||
/// <param name="face"></param>
|
||||
/// <returns></returns>
|
||||
MediaEntry GetMediaEntry(SceneObjectPart part, int face);
|
||||
|
||||
/// <summary>
|
||||
/// Set the media entry for a given prim face.
|
||||
/// </summary>
|
||||
/// <param name="SceneObjectPart"></param>
|
||||
/// <param name="face"></param>
|
||||
/// <param name="me"></param>
|
||||
void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me);
|
||||
|
||||
/// <summary>
|
||||
/// Clear the media entry for a given prim face.
|
||||
/// </summary>
|
||||
///
|
||||
/// This is the equivalent of setting a media entry of null
|
||||
///
|
||||
/// <param name="part"></param>
|
||||
/// <param name="face">/param>
|
||||
void ClearMediaEntry(SceneObjectPart part, int face);
|
||||
}
|
||||
}
|
||||
@@ -334,10 +334,38 @@ 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 event Attach OnAttach;
|
||||
|
||||
/// <summary>
|
||||
/// Called immediately after an object is loaded from storage.
|
||||
/// </summary>
|
||||
public event SceneObjectDelegate OnSceneObjectLoaded;
|
||||
public delegate void SceneObjectDelegate(SceneObjectGroup so);
|
||||
|
||||
/// <summary>
|
||||
/// Called immediately before an object is saved to storage.
|
||||
/// </summary>
|
||||
/// <param name="persistingSo">
|
||||
/// 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.
|
||||
/// </param>
|
||||
/// <param name="originalSo">
|
||||
/// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
|
||||
/// </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>
|
||||
/// <param name="copy"></param>
|
||||
/// <param name="original"></param>
|
||||
/// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
|
||||
public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
|
||||
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
|
||||
|
||||
public delegate void RegionUp(GridRegion region);
|
||||
public event RegionUp OnRegionUp;
|
||||
public event RegionUp OnRegionUp;
|
||||
|
||||
public class MoneyTransferArgs : EventArgs
|
||||
{
|
||||
@@ -2037,5 +2065,68 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
|
||||
{
|
||||
SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(copy, original, userExposed);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -82,6 +82,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool TeleportHandler(UUID userID, Scene scene);
|
||||
public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
#endregion
|
||||
|
||||
public class ScenePermissions
|
||||
@@ -141,6 +143,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event CopyUserInventoryHandler OnCopyUserInventory;
|
||||
public event DeleteUserInventoryHandler OnDeleteUserInventory;
|
||||
public event TeleportHandler OnTeleport;
|
||||
public event ControlPrimMediaHandler OnControlPrimMedia;
|
||||
public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
|
||||
#endregion
|
||||
|
||||
#region Object Permission Checks
|
||||
@@ -964,5 +968,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanControlPrimMedia(UUID userID, UUID primID, int face)
|
||||
{
|
||||
ControlPrimMediaHandler handler = OnControlPrimMedia;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (ControlPrimMediaHandler h in list)
|
||||
{
|
||||
if (h(userID, primID, face) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face)
|
||||
{
|
||||
InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (InteractWithPrimMediaHandler h in list)
|
||||
{
|
||||
if (h(userID, primID, face) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1918,9 +1918,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
foreach (SceneObjectGroup group in PrimsFromDB)
|
||||
{
|
||||
EventManager.TriggerOnSceneObjectLoaded(group);
|
||||
|
||||
if (group.RootPart == null)
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children",
|
||||
m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
|
||||
group.Children == null ? 0 : group.Children.Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1745,6 +1745,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
|
||||
HasGroupChanged = false;
|
||||
|
||||
m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
|
||||
datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
|
||||
|
||||
backup_group.ForEachPart(delegate(SceneObjectPart part)
|
||||
@@ -1795,6 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Duplicates this object, including operations such as physics set up and attaching to the backup event.
|
||||
/// </summary>
|
||||
/// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
|
||||
/// <returns></returns>
|
||||
public SceneObjectGroup Copy(bool userExposed)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
REGION = 256,
|
||||
TELEPORT = 512,
|
||||
REGION_RESTART = 1024,
|
||||
MEDIA = 2048,
|
||||
ANIMATION = 16384
|
||||
}
|
||||
|
||||
@@ -330,6 +331,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected Vector3 m_lastAcceleration;
|
||||
protected Vector3 m_lastAngularVelocity;
|
||||
protected int m_lastTerseSent;
|
||||
|
||||
/// <summary>
|
||||
/// Stores media texture data
|
||||
/// </summary>
|
||||
protected string m_mediaUrl;
|
||||
|
||||
// TODO: Those have to be changed into persistent properties at some later point,
|
||||
// or sit-camera on vehicles will break on sim-crossing.
|
||||
@@ -984,18 +990,39 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
TriggerScriptChangedEvent(Changed.SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
public byte UpdateFlag
|
||||
{
|
||||
get { return m_updateFlag; }
|
||||
set { m_updateFlag = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used for media on a prim.
|
||||
/// </summary>
|
||||
/// Do not change this value directly - always do it through an IMoapModule.
|
||||
public string MediaUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_mediaUrl;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_mediaUrl = value;
|
||||
|
||||
if (ParentGroup != null)
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool CreateSelected
|
||||
{
|
||||
get { return m_createSelected; }
|
||||
set { m_createSelected = value; }
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1553,6 +1580,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Duplicates this part.
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="AgentID"></param>
|
||||
/// <param name="GroupID"></param>
|
||||
/// <param name="linkNum"></param>
|
||||
/// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
|
||||
/// <returns></returns>
|
||||
public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
|
||||
{
|
||||
@@ -1616,7 +1648,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
}
|
||||
|
||||
return dupe;
|
||||
ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed);
|
||||
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
|
||||
|
||||
return dupe;
|
||||
}
|
||||
|
||||
protected void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
|
||||
@@ -1059,7 +1059,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void MakeChildAgent()
|
||||
{
|
||||
Animator.ResetAnimations();
|
||||
// It looks like m_animator is set to null somewhere, and MakeChild
|
||||
// is called after that. Probably in aborted teleports.
|
||||
if (m_animator == null)
|
||||
m_animator = new ScenePresenceAnimator(this);
|
||||
else
|
||||
Animator.ResetAnimations();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
|
||||
|
||||
Reference in New Issue
Block a user