Merge branch 'master' into careminster

This commit is contained in:
Melanie
2012-02-03 08:47:26 +00:00
5 changed files with 121 additions and 59 deletions

View File

@@ -402,12 +402,18 @@ namespace OpenSim.Region.Framework.Scenes
public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
public delegate void RegionUp(GridRegion region);
public event RegionUp OnRegionUp;
public delegate void RegionStarted(Scene scene);
public event RegionStarted OnRegionStarted;
public delegate void RegionHeartbeatEnd(Scene scene);
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
public delegate void LoginsEnabled(string regionName);
public event LoginsEnabled OnLoginsEnabled;
@@ -2227,6 +2233,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerSceneObjectPartUpdated(SceneObjectPart sop)
{
SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
if (handler != null)
{
foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
{
try
{
d(sop);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
int local_id, IClientAPI remote_client)
{
@@ -2291,6 +2318,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerRegionHeartbeatEnd(Scene scene)
{
RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
if (handler != null)
{
foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
{
try
{
d(scene);
}
catch (Exception e)
{
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerLoginsEnabled (string regionName)
{
LoginsEnabled handler = OnLoginsEnabled;

View File

@@ -1431,6 +1431,8 @@ namespace OpenSim.Region.Framework.Scenes
RegionInfo.RegionName, e.Message, e.StackTrace);
}
EventManager.TriggerRegionHeartbeatEnd(this);
maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
@@ -2837,7 +2839,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
client.OnLinkObjects += LinkObjects;
client.OnDelinkObjects += DelinkObjects;
client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
client.OnObjectDuplicate += DuplicateObject;
client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
@@ -2965,7 +2967,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
client.OnLinkObjects -= LinkObjects;
client.OnDelinkObjects -= DelinkObjects;
client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
client.OnObjectDuplicate -= DuplicateObject;
client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
@@ -3058,6 +3060,21 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
/// <summary>
/// Duplicates object specified by localID. This is the event handler for IClientAPI.
/// </summary>
/// <param name="originalPrim">ID of object to duplicate</param>
/// <param name="offset"></param>
/// <param name="flags"></param>
/// <param name="AgentID">Agent doing the duplication</param>
/// <param name="GroupID">Group of new object</param>
public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
{
SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
if (copy != null)
EventManager.TriggerObjectAddedToScene(copy);
}
/// <summary>
/// Duplicates object specified by localID at position raycasted against RayTargetObject using
/// RayEnd and RayStart to determine what the angle of the ray is
@@ -3120,19 +3137,22 @@ namespace OpenSim.Region.Framework.Scenes
// stick in offset format from the original prim
pos = pos - target.ParentGroup.AbsolutePosition;
SceneObjectGroup copy;
if (CopyRotates)
{
Quaternion worldRot = target2.GetWorldRotation();
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
//obj.Rotation = worldRot;
//obj.UpdateGroupRotationR(worldRot);
}
else
{
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
}
if (copy != null)
EventManager.TriggerObjectAddedToScene(copy);
}
}
}
@@ -4467,6 +4487,16 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.GetGroupByPrim(localID);
}
/// <summary>
/// Get a scene object group that contains the prim with the given uuid
/// </summary>
/// <param name="fullID"></param>
/// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(UUID fullID)
{
return m_sceneGraph.GetGroupByPrim(fullID);
}
public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
{
return m_sceneGraph.TryGetScenePresence(agentID, out sp);

View File

@@ -343,6 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
///
/// This method does not send updates to the client - callers need to handle this themselves.
/// Caller should also trigger EventManager.TriggerObjectAddedToScene
/// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
@@ -1002,7 +1003,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="fullID"></param>
/// <returns>null if no scene object group containing that prim is found</returns>
private SceneObjectGroup GetGroupByPrim(UUID fullID)
public SceneObjectGroup GetGroupByPrim(UUID fullID)
{
SceneObjectGroup sog;
lock (SceneObjectGroupsByFullPartID)
@@ -1992,22 +1993,6 @@ namespace OpenSim.Region.Framework.Scenes
#pragma warning restore 0612
}
/// <summary>
/// Duplicate the given object, Fire and Forget, No rotation, no return wrapper
/// </summary>
/// <param name="originalPrim"></param>
/// <param name="offset"></param>
/// <param name="flags"></param>
/// <param name="AgentID"></param>
/// <param name="GroupID"></param>
protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
{
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
// SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero);
DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
}
/// <summary>
/// Duplicate the given object.
/// </summary>

View File

@@ -244,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool IgnoreUndoUpdate = false;
private PrimFlags LocalFlags;
public PrimFlags LocalFlags;
private float m_damage = -1.0f;
private byte[] m_TextureAnimation;
@@ -933,32 +933,18 @@ namespace OpenSim.Region.Framework.Scenes
public Color Color
{
get { return m_color; }
set
{
m_color = value;
/* ScheduleFullUpdate() need not be called b/c after
* setting the color, the text will be set, so then
* ScheduleFullUpdate() will be called. */
//ScheduleFullUpdate();
}
set { m_color = value; }
}
public string Text
{
get
{
string returnstr = m_text;
if (returnstr.Length > 255)
{
returnstr = returnstr.Substring(0, 254);
}
return returnstr;
}
set
{
m_text = value;
if (m_text.Length > 255)
return m_text.Substring(0, 254);
return m_text;
}
set { m_text = value; }
}
@@ -2795,6 +2781,10 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null)
return;
// When running OpenSim tests, Scene (and EventManager can be null).
// Need to fix tests before we can trigger this here
// ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
ParentGroup.QueueForUpdateCheck();
int timeNow = Util.UnixTimeSinceEpoch();
@@ -2827,6 +2817,10 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null)
return;
// When running OpenSim tests, Scene (and EventManager can be null).
// Need to fix tests before we can trigger this here
// ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
// This was pulled from SceneViewer. Attachments always receive full updates.
// I could not verify if this is a requirement but this maintains existing behavior
if (ParentGroup.IsAttachment)