From 6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 19 Aug 2008 02:12:40 +0000 Subject: Attachment persistence!!! Patch #9169 (Mantis #1171) Attachments now save to MySQL. No reattach on login yet. --- .../Region/Communications/OGS1/OGS1UserServices.cs | 16 -------- OpenSim/Region/Environment/Scenes/InnerScene.cs | 7 ++-- .../Region/Environment/Scenes/Scene.Inventory.cs | 43 ++++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 5 ++- 4 files changed, 50 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 1d86646..2223aeb 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -776,21 +776,5 @@ namespace OpenSim.Region.Communications.OGS1 // Return Empty list (no friends) } } - - public void AddAttachment(LLUUID user, LLUUID item) - { - return; - } - - public void RemoveAttachment(LLUUID user, LLUUID item) - { - return; - } - - public List GetAttachments(LLUUID user) - { - return new List(); - } - } } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 6695dbf..b98f2d6 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -380,7 +380,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = (SceneObjectGroup)obj; //group.DetachToGround(); - DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient); + m_parentScene.DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient); } } } @@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); } - protected internal void RezSingleAttachment( + public SceneObjectGroup RezSingleAttachment( IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask) { SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, @@ -446,11 +446,12 @@ namespace OpenSim.Region.Environment.Scenes AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition); objatt.ScheduleGroupForFullUpdate(); } + return objatt; } // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? - protected internal void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) + public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) { if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... return; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 0148d76..784d04c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -2316,5 +2316,48 @@ namespace OpenSim.Region.Environment.Scenes // // imod.TestFunction(); // } + + public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, + uint AttachmentPt, uint ItemFlags, uint NextOwnerMask) + { + SceneObjectGroup att = m_innerScene.RezSingleAttachment(remoteClient, itemID, AttachmentPt, ItemFlags, NextOwnerMask); + + if (att == null) + { + DetachSingleAttachmentToInv(itemID, remoteClient); + return; + } + + if (att.RootPart != null) + AttachmentPt = att.RootPart.AttachmentPoint; + + ScenePresence presence; + if(TryGetAvatar(remoteClient.AgentId, out presence)) + { + presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.GetFromAssetID()); + IAvatarFactory ava = RequestModuleInterface(); + if(ava != null) + { + ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } + + } + } + + public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) + { + ScenePresence presence; + if(TryGetAvatar(remoteClient.AgentId, out presence)) + { + presence.Appearance.DetachAttachment(itemID); + IAvatarFactory ava = RequestModuleInterface(); + if(ava != null) + { + ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } + + } + m_innerScene.DetachSingleAttachmentToInv(itemID, remoteClient); + } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 474f062..4564cf1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2109,8 +2109,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnGrabUpdate += m_innerScene.MoveObject; client.OnDeRezObject += DeRezObject; client.OnRezObject += RezObject; - client.OnRezSingleAttachmentFromInv += m_innerScene.RezSingleAttachment; - client.OnDetachAttachmentIntoInv += m_innerScene.DetachSingleAttachmentToInv; + client.OnRezSingleAttachmentFromInv += RezSingleAttachment; + client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; client.OnObjectAttach += m_innerScene.AttachObject; client.OnObjectDetach += m_innerScene.DetachObject; client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; @@ -3859,5 +3859,6 @@ namespace OpenSim.Region.Environment.Scenes //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); } + } } -- cgit v1.1