ObjectAddedToScene event should be fired when duplicating objects

iar_mods
Dan Lake 2012-02-02 17:41:05 -08:00
parent ee2b2aadc3
commit 146d78edfa
2 changed files with 22 additions and 20 deletions

View File

@ -2716,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectMaterial += m_sceneGraph.PrimMaterial; client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
client.OnLinkObjects += LinkObjects; client.OnLinkObjects += LinkObjects;
client.OnDelinkObjects += DelinkObjects; client.OnDelinkObjects += DelinkObjects;
client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; client.OnObjectDuplicate += DuplicateObject;
client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
@ -2843,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
client.OnLinkObjects -= LinkObjects; client.OnLinkObjects -= LinkObjects;
client.OnDelinkObjects -= DelinkObjects; client.OnDelinkObjects -= DelinkObjects;
client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; client.OnObjectDuplicate -= DuplicateObject;
client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
@ -2935,6 +2935,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <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> /// <summary>
/// Duplicates object specified by localID at position raycasted against RayTargetObject using /// Duplicates object specified by localID at position raycasted against RayTargetObject using
/// RayEnd and RayStart to determine what the angle of the ray is /// 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 // stick in offset format from the original prim
pos = pos - target.ParentGroup.AbsolutePosition; pos = pos - target.ParentGroup.AbsolutePosition;
SceneObjectGroup copy;
if (CopyRotates) if (CopyRotates)
{ {
Quaternion worldRot = target2.GetWorldRotation(); Quaternion worldRot = target2.GetWorldRotation();
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); // 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.Rotation = worldRot;
//obj.UpdateGroupRotationR(worldRot); //obj.UpdateGroupRotationR(worldRot);
} }
else 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);
} }
} }
} }

View File

@ -1872,22 +1872,6 @@ namespace OpenSim.Region.Framework.Scenes
#pragma warning restore 0612 #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> /// <summary>
/// Duplicate the given object. /// Duplicate the given object.
/// </summary> /// </summary>