From 00947cf2ca7a9315ae1d508507db0c95348e25ec Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Feb 2010 19:02:20 +0000
Subject: Add EventManager.OnIncomingSceneObject event which is triggered by an
incoming scene object Add a read-only Attachments property to ScenePresence
---
OpenSim/Region/Framework/Scenes/Scene.cs | 36 +++++++++++++++++++-------------
1 file changed, 22 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 73b0b3e..039d074 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2406,9 +2406,14 @@ namespace OpenSim.Region.Framework.Scenes
return successYN;
}
+ ///
+ /// Called when objects or attachments cross the border between regions.
+ ///
+ ///
+ ///
public bool IncomingCreateObject(ISceneObject sog)
{
- //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
+ //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject;
try
{
@@ -2425,7 +2430,12 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false;
}
+
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
+
+ // Do this as late as possible so that listeners have full access to the incoming object
+ EventManager.TriggerOnIncomingSceneObject(newObject);
+
return true;
}
@@ -2437,6 +2447,8 @@ namespace OpenSim.Region.Framework.Scenes
/// False
public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
{
+ //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
+
ScenePresence sp = GetScenePresence(userID);
if (sp != null)
{
@@ -2496,29 +2508,25 @@ namespace OpenSim.Region.Framework.Scenes
//RootPrim.SetParentLocalId(parentLocalID);
- m_log.DebugFormat("[ATTACHMENT]: Received " +
- "attachment {0}, inworld asset id {1}",
- //grp.RootPart.LastOwnerID.ToString(),
- grp.GetFromItemID(),
- grp.UUID.ToString());
+ m_log.DebugFormat(
+ "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
- m_log.DebugFormat("[ATTACHMENT]: Attach " +
- "to avatar {0} at position {1}",
- sp.UUID.ToString(), grp.AbsolutePosition);
- AttachObject(sp.ControllingClient,
- grp.LocalId, (uint)0,
- grp.GroupRotation,
- grp.AbsolutePosition, false);
+ m_log.DebugFormat(
+ "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
+
+ AttachObject(
+ sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate();
+
+
}
else
{
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
}
-
}
else
{
--
cgit v1.1
From 9f4883d1468b5fe1c60e1831b24e1fed1eb5caeb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Feb 2010 19:10:54 +0000
Subject: refactor: Reuse SceneObjectGroup.IsAttachmentCheckFull() in
Scene.AddSceneObject since this wraps a check that is much less clear
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 039d074..ddebd0b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2483,7 +2483,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart p in sceneObject.Children.Values)
p.LocalId = 0;
- if ((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) // Attachment
+ if (sceneObject.IsAttachmentCheckFull()) // Attachment
{
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
@@ -2518,9 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes
AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
- grp.SendGroupFullUpdate();
-
-
+ grp.SendGroupFullUpdate();
}
else
{
--
cgit v1.1