diff options
author | Justin Clark-Casey (justincc) | 2010-03-06 00:07:47 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-03-06 00:07:47 +0000 |
commit | 395f343498bc429c0360201991147c6e089b0730 (patch) | |
tree | 70dedf88258e3496a5cbd267bc5db7e067b88e57 /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-395f343498bc429c0360201991147c6e089b0730.zip opensim-SC-395f343498bc429c0360201991147c6e089b0730.tar.gz opensim-SC-395f343498bc429c0360201991147c6e089b0730.tar.bz2 opensim-SC-395f343498bc429c0360201991147c6e089b0730.tar.xz |
refactor: Move DetachSingleAttachmentToInv to region module
need to rationalize method names later
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 35 |
3 files changed, 12 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index bd3b433..dad0efd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1858,7 +1858,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1858 | 1858 | ||
1859 | if (att == null) | 1859 | if (att == null) |
1860 | { | 1860 | { |
1861 | DetachSingleAttachmentToInv(itemID, remoteClient); | 1861 | AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient); |
1862 | return UUID.Zero; | 1862 | return UUID.Zero; |
1863 | } | 1863 | } |
1864 | 1864 | ||
@@ -1904,24 +1904,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1904 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); | 1904 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
1908 | { | ||
1909 | ScenePresence presence; | ||
1910 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1911 | { | ||
1912 | presence.Appearance.DetachAttachment(itemID); | ||
1913 | |||
1914 | // Save avatar attachment information | ||
1915 | if (m_AvatarFactory != null) | ||
1916 | { | ||
1917 | m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); | ||
1918 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
1919 | } | ||
1920 | } | ||
1921 | |||
1922 | m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); | ||
1923 | } | ||
1924 | |||
1925 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 1907 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
1926 | { | 1908 | { |
1927 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); | 1909 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c83132f..7c0375e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2646,10 +2646,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2646 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) | 2646 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) |
2647 | { | 2647 | { |
2648 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | 2648 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; |
2649 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; | 2649 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; |
2650 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; | ||
2651 | client.OnObjectAttach += m_sceneGraph.AttachObject; | 2650 | client.OnObjectAttach += m_sceneGraph.AttachObject; |
2652 | client.OnObjectDetach += m_sceneGraph.DetachObject; | 2651 | client.OnObjectDetach += m_sceneGraph.DetachObject; |
2652 | |||
2653 | if (AttachmentsModule != null) | ||
2654 | client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; | ||
2653 | } | 2655 | } |
2654 | 2656 | ||
2655 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) | 2657 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) |
@@ -2696,8 +2698,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2696 | } | 2698 | } |
2697 | 2699 | ||
2698 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) | 2700 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) |
2699 | { | 2701 | { |
2700 | |||
2701 | } | 2702 | } |
2702 | 2703 | ||
2703 | /// <summary> | 2704 | /// <summary> |
@@ -2719,7 +2720,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2719 | 2720 | ||
2720 | UnSubscribeToClientNetworkEvents(client); | 2721 | UnSubscribeToClientNetworkEvents(client); |
2721 | 2722 | ||
2722 | |||
2723 | // EventManager.TriggerOnNewClient(client); | 2723 | // EventManager.TriggerOnNewClient(client); |
2724 | } | 2724 | } |
2725 | 2725 | ||
@@ -2799,12 +2799,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2799 | } | 2799 | } |
2800 | 2800 | ||
2801 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) | 2801 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) |
2802 | { | 2802 | { |
2803 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; | ||
2804 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; | 2803 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; |
2805 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; | 2804 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; |
2806 | client.OnObjectAttach -= m_sceneGraph.AttachObject; | 2805 | client.OnObjectAttach -= m_sceneGraph.AttachObject; |
2807 | client.OnObjectDetach -= m_sceneGraph.DetachObject; | 2806 | client.OnObjectDetach -= m_sceneGraph.DetachObject; |
2807 | |||
2808 | if (AttachmentsModule != null) | ||
2809 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; | ||
2808 | } | 2810 | } |
2809 | 2811 | ||
2810 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) | 2812 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 48744d7..380722d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -452,7 +452,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
452 | if (group != null) | 452 | if (group != null) |
453 | { | 453 | { |
454 | //group.DetachToGround(); | 454 | //group.DetachToGround(); |
455 | m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient); | 455 | m_parentScene.AttachmentsModule.ShowDetachInUserInventory(group.GetFromItemID(), remoteClient); |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
@@ -574,39 +574,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
574 | return null; | 574 | return null; |
575 | } | 575 | } |
576 | 576 | ||
577 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | ||
578 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | ||
579 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
580 | { | ||
581 | if (itemID == UUID.Zero) // If this happened, someone made a mistake.... | ||
582 | return; | ||
583 | |||
584 | // We can NOT use the dictionries here, as we are looking | ||
585 | // for an entity by the fromAssetID, which is NOT the prim UUID | ||
586 | // | ||
587 | List<EntityBase> detachEntities = GetEntities(); | ||
588 | SceneObjectGroup group; | ||
589 | |||
590 | foreach (EntityBase entity in detachEntities) | ||
591 | { | ||
592 | if (entity is SceneObjectGroup) | ||
593 | { | ||
594 | group = (SceneObjectGroup)entity; | ||
595 | if (group.GetFromItemID() == itemID) | ||
596 | { | ||
597 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | ||
598 | group.DetachToInventoryPrep(); | ||
599 | m_log.Debug("[DETACH]: Saving attachpoint: " + | ||
600 | ((uint)group.GetAttachmentPoint()).ToString()); | ||
601 | m_parentScene.UpdateKnownItem(remoteClient, group, | ||
602 | group.GetFromItemID(), group.OwnerID); | ||
603 | m_parentScene.DeleteSceneObject(group, false); | ||
604 | return; | ||
605 | } | ||
606 | } | ||
607 | } | ||
608 | } | ||
609 | |||
610 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 577 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
611 | { | 578 | { |
612 | ScenePresence newAvatar = null; | 579 | ScenePresence newAvatar = null; |