aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs32
3 files changed, 23 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2c49ba8..732e3e3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -502,17 +502,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
502 if (group.GetFromItemID() == itemID) 502 if (group.GetFromItemID() == itemID)
503 { 503 {
504 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 504 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
505 group.DetachToInventoryPrep(); 505 sp.RemoveAttachment(group);
506// m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
507 506
508 // If an item contains scripts, it's always changed. 507 // Prepare sog for storage
509 // This ensures script state is saved on detach 508 group.ForEachPart(
510 foreach (SceneObjectPart p in group.Parts) 509 delegate(SceneObjectPart part)
511 if (p.Inventory.ContainsScripts()) 510 {
512 group.HasGroupChanged = true; 511 part.AttachedAvatar = UUID.Zero;
512
513 // If there are any scripts,
514 // then always trigger a new object and state persistence in UpdateKnownItem()
515 if (part.Inventory.ContainsScripts())
516 group.HasGroupChanged = true;
517 }
518 );
519
520 group.RootPart.SetParentLocalId(0);
521 group.RootPart.IsAttachment = false;
522 group.AbsolutePosition = group.RootPart.AttachedPos;
513 523
514 UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); 524 UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID);
515 m_scene.DeleteSceneObject(group, false); 525 m_scene.DeleteSceneObject(group, false);
526
516 return; 527 return;
517 } 528 }
518 } 529 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 859f6ff..afcf05a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
147 } 147 }
148 148
149 [Test] 149 [Test]
150 public void TestRemoveAttachment() 150 public void TestDetachAttachmentToInventory()
151 { 151 {
152 TestHelpers.InMethod(); 152 TestHelpers.InMethod();
153// log4net.Config.XmlConfigurator.Configure(); 153// log4net.Config.XmlConfigurator.Configure();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8f0fa55..00e3363 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -147,15 +147,16 @@ namespace OpenSim.Region.Framework.Scenes
147 return false; 147 return false;
148 } 148 }
149 149
150 /// <value> 150 /// <summary>
151 /// Is this scene object acting as an attachment? 151 /// Is this scene object acting as an attachment?
152 /// 152 /// </summary>
153 /// <remarks>
153 /// We return false if the group has already been deleted. 154 /// We return false if the group has already been deleted.
154 /// 155 ///
155 /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I 156 /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
156 /// presume either all or no parts in a linkset can be part of an attachment (in which 157 /// presume either all or no parts in a linkset can be part of an attachment (in which
157 /// case the value would get proprogated down into all the descendent parts). 158 /// case the value would get proprogated down into all the descendent parts).
158 /// </value> 159 /// </remarks>
159 public bool IsAttachment 160 public bool IsAttachment
160 { 161 {
161 get 162 get
@@ -1017,31 +1018,6 @@ namespace OpenSim.Region.Framework.Scenes
1017 m_rootPart.ClearUndoState(); 1018 m_rootPart.ClearUndoState();
1018 } 1019 }
1019 1020
1020 public void DetachToInventoryPrep()
1021 {
1022 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
1023 //Vector3 detachedpos = new Vector3(127f, 127f, 127f);
1024 if (avatar != null)
1025 {
1026 //detachedpos = avatar.AbsolutePosition;
1027 avatar.RemoveAttachment(this);
1028 }
1029
1030 m_rootPart.AttachedAvatar = UUID.Zero;
1031
1032 SceneObjectPart[] parts = m_parts.GetArray();
1033 for (int i = 0; i < parts.Length; i++)
1034 parts[i].AttachedAvatar = UUID.Zero;
1035
1036 m_rootPart.SetParentLocalId(0);
1037 //m_rootPart.SetAttachmentPoint((byte)0);
1038 m_rootPart.IsAttachment = false;
1039 AbsolutePosition = m_rootPart.AttachedPos;
1040 //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
1041 //AttachToBackup();
1042 //m_rootPart.ScheduleFullUpdate();
1043 }
1044
1045 /// <summary> 1021 /// <summary>
1046 /// 1022 ///
1047 /// </summary> 1023 /// </summary>