diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bbd216372c..186e01c94f 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; @@ -2935,6 +2935,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 1487facf00..7d801b52c1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1872,22 +1872,6 @@ namespace OpenSim.Region.Framework.Scenes #pragma warning restore 0612 } - /// - /// 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. ///