From 146d78edfa2974038a7efe3f1c0f3d0e8d8520ae Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Thu, 2 Feb 2012 17:41:05 -0800
Subject: ObjectAddedToScene event should be fired when duplicating objects
---
OpenSim/Region/Framework/Scenes/Scene.cs | 26 ++++++++++++++++++++++----
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 16 ----------------
2 files changed, 22 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bbd2163..186e01c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2716,7 +2716,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;
@@ -2843,7 +2843,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;
@@ -2936,6 +2936,21 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Duplicates object specified by localID. This is the event handler for IClientAPI.
+ ///
+ /// ID of object to duplicate
+ ///
+ ///
+ /// Agent doing the duplication
+ /// Group of new object
+ 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);
+ }
+
+ ///
/// Duplicates object specified by localID at position raycasted against RayTargetObject using
/// RayEnd and RayStart to determine what the angle of the ray is
///
@@ -2997,19 +3012,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);
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1487fac..7d801b5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1873,22 +1873,6 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Duplicate the given object, Fire and Forget, No rotation, no return wrapper
- ///
- ///
- ///
- ///
- ///
- ///
- 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);
- }
-
- ///
/// Duplicate the given object.
///
///
--
cgit v1.1