refactor: migrate DropObject handling fully into AttachmentsModule from Scene
parent
37a5cf5783
commit
1de68b34d9
|
@ -51,7 +51,7 @@ namespace OpenSim.Framework
|
||||||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||||
bool RezSelected, bool RemoveItem, UUID fromTaskID);
|
bool RezSelected, bool RemoveItem, UUID fromTaskID);
|
||||||
|
|
||||||
public delegate UUID RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
public delegate ISceneEntity RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||||
|
|
||||||
public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
||||||
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
|
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Scene m_scene = null;
|
private Scene m_scene;
|
||||||
private IDialogModule m_dialogModule;
|
private IDialogModule m_dialogModule;
|
||||||
|
|
||||||
public string Name { get { return "Attachments Module"; } }
|
public string Name { get { return "Attachments Module"; } }
|
||||||
|
@ -83,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
client.OnObjectAttach += AttachObject;
|
client.OnObjectAttach += AttachObject;
|
||||||
client.OnObjectDetach += DetachObject;
|
client.OnObjectDetach += DetachObject;
|
||||||
client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
|
client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
|
||||||
|
client.OnObjectDrop += DetachSingleAttachmentToGround;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnsubscribeFromClientEvents(IClientAPI client)
|
public void UnsubscribeFromClientEvents(IClientAPI client)
|
||||||
|
@ -92,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
client.OnObjectAttach -= AttachObject;
|
client.OnObjectAttach -= AttachObject;
|
||||||
client.OnObjectDetach -= DetachObject;
|
client.OnObjectDetach -= DetachObject;
|
||||||
client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
|
client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
|
||||||
|
client.OnObjectDrop -= DetachSingleAttachmentToGround;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -250,12 +252,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||||
{
|
{
|
||||||
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
|
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID RezSingleAttachmentFromInventory(
|
public ISceneEntity RezSingleAttachmentFromInventory(
|
||||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
|
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -269,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()",
|
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()",
|
||||||
remoteClient.Name, remoteClient.AgentId);
|
remoteClient.Name, remoteClient.AgentId);
|
||||||
return UUID.Zero;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||||
|
@ -286,10 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
|
ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == att)
|
return att;
|
||||||
return UUID.Zero;
|
|
||||||
else
|
|
||||||
return att.UUID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||||
|
@ -449,13 +448,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient)
|
public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
|
// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
|
||||||
// remoteClient.Name, sceneObjectID);
|
// remoteClient.Name, sceneObjectID);
|
||||||
|
|
||||||
SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID);
|
SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
|
||||||
|
|
||||||
if (so == null)
|
if (so == null)
|
||||||
return;
|
return;
|
||||||
|
@ -489,7 +488,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
remoteClient.SendRemoveInventoryItem(inventoryID);
|
remoteClient.SendRemoveInventoryItem(inventoryID);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
|
m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -168,12 +168,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
UserInventoryHelpers.CreateInventoryItem(
|
UserInventoryHelpers.CreateInventoryItem(
|
||||||
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
|
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
|
||||||
|
|
||||||
// Check item status
|
ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
|
||||||
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Not.Null);
|
|
||||||
|
|
||||||
UUID attSoId = m_attMod.RezSingleAttachmentFromInventory(
|
|
||||||
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
|
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
|
||||||
m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient);
|
m_attMod.DetachSingleAttachmentToGround(so.LocalId, m_presence.ControllingClient);
|
||||||
|
|
||||||
// Check scene presence status
|
// Check scene presence status
|
||||||
Assert.That(m_presence.HasAttachments(), Is.False);
|
Assert.That(m_presence.HasAttachments(), Is.False);
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
/// <param name="AttachmentPt"></param>
|
/// <param name="AttachmentPt"></param>
|
||||||
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
|
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
|
||||||
UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rez an attachment from user inventory
|
/// Rez an attachment from user inventory
|
||||||
|
@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// False is required so that we don't attempt to update information when a user enters a scene with the
|
/// False is required so that we don't attempt to update information when a user enters a scene with the
|
||||||
/// attachment already correctly set up in inventory.
|
/// attachment already correctly set up in inventory.
|
||||||
/// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
|
/// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
|
||||||
UUID RezSingleAttachmentFromInventory(
|
ISceneEntity RezSingleAttachmentFromInventory(
|
||||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
|
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -105,9 +105,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach the given item to the ground.
|
/// Detach the given item to the ground.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sceneObjectID"></param>
|
/// <param name="objectLocalID"></param>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient);
|
void DetachSingleAttachmentToGround(uint objectLocalID, IClientAPI remoteClient);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach the given item so that it remains in the user's inventory.
|
/// Detach the given item so that it remains in the user's inventory.
|
||||||
|
|
|
@ -2772,7 +2772,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnUndo += m_sceneGraph.HandleUndo;
|
client.OnUndo += m_sceneGraph.HandleUndo;
|
||||||
client.OnRedo += m_sceneGraph.HandleRedo;
|
client.OnRedo += m_sceneGraph.HandleRedo;
|
||||||
client.OnObjectDescription += m_sceneGraph.PrimDescription;
|
client.OnObjectDescription += m_sceneGraph.PrimDescription;
|
||||||
client.OnObjectDrop += m_sceneGraph.DropObject;
|
|
||||||
client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
|
client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
|
||||||
client.OnObjectOwner += ObjectOwner;
|
client.OnObjectOwner += ObjectOwner;
|
||||||
}
|
}
|
||||||
|
@ -2899,7 +2898,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnUndo -= m_sceneGraph.HandleUndo;
|
client.OnUndo -= m_sceneGraph.HandleUndo;
|
||||||
client.OnRedo -= m_sceneGraph.HandleRedo;
|
client.OnRedo -= m_sceneGraph.HandleRedo;
|
||||||
client.OnObjectDescription -= m_sceneGraph.PrimDescription;
|
client.OnObjectDescription -= m_sceneGraph.PrimDescription;
|
||||||
client.OnObjectDrop -= m_sceneGraph.DropObject;
|
|
||||||
client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable;
|
client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable;
|
||||||
client.OnObjectOwner -= ObjectOwner;
|
client.OnObjectOwner -= ObjectOwner;
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,13 +548,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_activeScripts += number;
|
m_activeScripts += number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DropObject(uint objectLocalID, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
|
|
||||||
if (group != null)
|
|
||||||
m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected internal void HandleUndo(IClientAPI remoteClient, UUID primId)
|
protected internal void HandleUndo(IClientAPI remoteClient, UUID primId)
|
||||||
{
|
{
|
||||||
if (primId != UUID.Zero)
|
if (primId != UUID.Zero)
|
||||||
|
|
Loading…
Reference in New Issue