diff options
Diffstat (limited to '')
12 files changed, 117 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6122cc2..fc92fc3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -276,6 +276,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
276 | 276 | ||
277 | if (objatt != null) | 277 | if (objatt != null) |
278 | { | 278 | { |
279 | // Loading the inventory from XML will have set this, but | ||
280 | // there is no way the object could have changed yet, | ||
281 | // since scripts aren't running yet. So, clear it here. | ||
282 | objatt.HasGroupChanged = false; | ||
279 | bool tainted = false; | 283 | bool tainted = false; |
280 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 284 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) |
281 | tainted = true; | 285 | tainted = true; |
@@ -486,9 +490,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
486 | { | 490 | { |
487 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 491 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
488 | // CM / XMREngine!!!! Needed to conclude attach event | 492 | // CM / XMREngine!!!! Needed to conclude attach event |
489 | SceneObjectSerializer.ToOriginalXmlFormat(group); | 493 | //SceneObjectSerializer.ToOriginalXmlFormat(group); |
490 | group.DetachToInventoryPrep(); | 494 | group.DetachToInventoryPrep(); |
491 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 495 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
496 | |||
497 | // If an item contains scripts, it's always changed. | ||
498 | // This ensures script state is saved on detach | ||
499 | foreach (SceneObjectPart p in group.Parts) | ||
500 | if (p.Inventory.ContainsScripts()) | ||
501 | group.HasGroupChanged = true; | ||
502 | |||
492 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); | 503 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
493 | m_scene.DeleteSceneObject(group, false); | 504 | m_scene.DeleteSceneObject(group, false); |
494 | return; | 505 | return; |
@@ -497,25 +508,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
497 | } | 508 | } |
498 | } | 509 | } |
499 | 510 | ||
500 | public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) | ||
501 | { | ||
502 | // If this is an attachment, then we need to save the modified | ||
503 | // object back into the avatar's inventory. First we save the | ||
504 | // attachment point information, then we update the relative | ||
505 | // positioning (which caused this method to get driven in the | ||
506 | // first place. Then we have to mark the object as NOT an | ||
507 | // attachment. This is necessary in order to correctly save | ||
508 | // and retrieve GroupPosition information for the attachment. | ||
509 | // Then we save the asset back into the appropriate inventory | ||
510 | // entry. Finally, we restore the object's attachment status. | ||
511 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
512 | sog.UpdateGroupPosition(pos); | ||
513 | sog.RootPart.IsAttachment = false; | ||
514 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
515 | UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); | ||
516 | sog.SetAttachmentPoint(attachmentPoint); | ||
517 | } | ||
518 | |||
519 | /// <summary> | 511 | /// <summary> |
520 | /// Update the attachment asset for the new sog details if they have changed. | 512 | /// Update the attachment asset for the new sog details if they have changed. |
521 | /// </summary> | 513 | /// </summary> |
@@ -527,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
527 | /// <param name="grp"></param> | 519 | /// <param name="grp"></param> |
528 | /// <param name="itemID"></param> | 520 | /// <param name="itemID"></param> |
529 | /// <param name="agentID"></param> | 521 | /// <param name="agentID"></param> |
530 | protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | 522 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) |
531 | { | 523 | { |
532 | if (grp != null) | 524 | if (grp != null) |
533 | { | 525 | { |
@@ -542,7 +534,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
542 | grp.UUID, grp.GetAttachmentPoint()); | 534 | grp.UUID, grp.GetAttachmentPoint()); |
543 | 535 | ||
544 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 536 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
545 | |||
546 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 537 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
547 | item = m_scene.InventoryService.GetItem(item); | 538 | item = m_scene.InventoryService.GetItem(item); |
548 | 539 | ||
@@ -636,7 +627,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
636 | // In case it is later dropped again, don't let | 627 | // In case it is later dropped again, don't let |
637 | // it get cleaned up | 628 | // it get cleaned up |
638 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 629 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
639 | so.HasGroupChanged = false; | ||
640 | } | 630 | } |
641 | } | 631 | } |
642 | } | 632 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0700aa5..2e3db48 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -719,15 +719,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
719 | { | 719 | { |
720 | group.RootPart.Flags |= PrimFlags.Phantom; | 720 | group.RootPart.Flags |= PrimFlags.Phantom; |
721 | group.RootPart.IsAttachment = true; | 721 | group.RootPart.IsAttachment = true; |
722 | } | ||
723 | 722 | ||
724 | // If we're rezzing an attachment then don't ask | 723 | // If we're rezzing an attachment then don't ask |
725 | // AddNewSceneObject() to update the client since | 724 | // AddNewSceneObject() to update the client since |
726 | // we'll be doing that later on. Scheduling more than | 725 | // we'll be doing that later on. Scheduling more |
727 | // one full update during the attachment | 726 | // than one full update during the attachment |
728 | // process causes some clients to fail to display the | 727 | // process causes some clients to fail to display |
729 | // attachment properly. | 728 | // the attachment properly. |
730 | m_Scene.AddNewSceneObject(group, true, false); | 729 | // Also, don't persist attachments. |
730 | m_Scene.AddNewSceneObject(group, false, false); | ||
731 | } | ||
732 | else | ||
733 | { | ||
734 | m_Scene.AddNewSceneObject(group, true, false); | ||
735 | } | ||
731 | 736 | ||
732 | // if attachment we set it's asset id so object updates | 737 | // if attachment we set it's asset id so object updates |
733 | // can reflect that, if not, we set it's position in world. | 738 | // can reflect that, if not, we set it's position in world. |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index a675928..788f42b 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -127,11 +127,20 @@ namespace OpenSim.Region.Framework.Interfaces | |||
127 | void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); | 127 | void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Update the position of an attachment | 130 | /// Update the user inventory with a changed attachment |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <param name="client"></param> | 132 | /// <param name="remoteClient"> |
133 | /// <param name="sog"></param> | 133 | /// A <see cref="IClientAPI"/> |
134 | /// <param name="pos"></param> | 134 | /// </param> |
135 | void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos); | 135 | /// <param name="grp"> |
136 | /// A <see cref="SceneObjectGroup"/> | ||
137 | /// </param> | ||
138 | /// <param name="itemID"> | ||
139 | /// A <see cref="UUID"/> | ||
140 | /// </param> | ||
141 | /// <param name="agentID"> | ||
142 | /// A <see cref="UUID"/> | ||
143 | /// </param> | ||
144 | void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); | ||
136 | } | 145 | } |
137 | } | 146 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 59ce090..ed40da9 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -185,6 +185,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
185 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 185 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
186 | bool UpdateInventoryItem(TaskInventoryItem item); | 186 | bool UpdateInventoryItem(TaskInventoryItem item); |
187 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); | 187 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); |
188 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged); | ||
188 | 189 | ||
189 | /// <summary> | 190 | /// <summary> |
190 | /// Remove an item from this entity's inventory | 191 | /// Remove an item from this entity's inventory |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dd06be2..c4639c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3255,7 +3255,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3255 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | 3255 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); |
3256 | regions.Remove(RegionInfo.RegionHandle); | 3256 | regions.Remove(RegionInfo.RegionHandle); |
3257 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3257 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3258 | |||
3259 | } | 3258 | } |
3260 | m_log.Debug("[Scene] Beginning ClientClosed"); | 3259 | m_log.Debug("[Scene] Beginning ClientClosed"); |
3261 | m_eventManager.TriggerClientClosed(agentID, this); | 3260 | m_eventManager.TriggerClientClosed(agentID, this); |
@@ -3271,6 +3270,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3271 | m_eventManager.TriggerOnRemovePresence(agentID); | 3270 | m_eventManager.TriggerOnRemovePresence(agentID); |
3272 | m_log.Debug("[Scene] Finished OnRemovePresence"); | 3271 | m_log.Debug("[Scene] Finished OnRemovePresence"); |
3273 | 3272 | ||
3273 | if (avatar != null && (!avatar.IsChildAgent)) | ||
3274 | avatar.SaveChangedAttachments(); | ||
3275 | |||
3274 | ForEachClient( | 3276 | ForEachClient( |
3275 | delegate(IClientAPI client) | 3277 | delegate(IClientAPI client) |
3276 | { | 3278 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a462133..b2d9358 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -281,7 +281,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | if (!alreadyPersisted) | 284 | if (attachToBackup && (!alreadyPersisted)) |
285 | { | 285 | { |
286 | sceneObject.ForceInventoryPersistence(); | 286 | sceneObject.ForceInventoryPersistence(); |
287 | sceneObject.HasGroupChanged = true; | 287 | sceneObject.HasGroupChanged = true; |
@@ -304,8 +304,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
304 | /// </returns> | 304 | /// </returns> |
305 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 305 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
306 | { | 306 | { |
307 | // Ensure that we persist this new scene object | 307 | // Ensure that we persist this new scene object if it's not an |
308 | sceneObject.HasGroupChanged = true; | 308 | // attachment |
309 | if (attachToBackup) | ||
310 | sceneObject.HasGroupChanged = true; | ||
309 | 311 | ||
310 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 312 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
311 | } | 313 | } |
@@ -1342,8 +1344,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | { | 1344 | { |
1343 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1345 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1344 | { | 1346 | { |
1345 | if (m_parentScene.AttachmentsModule != null) | 1347 | // Set the new attachment point data in the object |
1346 | m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos); | 1348 | byte attachmentPoint = group.GetAttachmentPoint(); |
1349 | group.UpdateGroupPosition(pos); | ||
1350 | group.RootPart.IsAttachment = false; | ||
1351 | group.AbsolutePosition = group.RootPart.AttachedPos; | ||
1352 | group.SetAttachmentPoint(attachmentPoint); | ||
1353 | group.HasGroupChanged = true; | ||
1347 | } | 1354 | } |
1348 | else | 1355 | else |
1349 | { | 1356 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 79f7162..ee08072 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -586,13 +586,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
586 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); | 586 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); |
587 | if (nodes.Count > 0) | 587 | if (nodes.Count > 0) |
588 | { | 588 | { |
589 | m_savedScriptState = new Dictionary<UUID, string>(); | 589 | if (m_savedScriptState == null) |
590 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
590 | foreach (XmlNode node in nodes) | 591 | foreach (XmlNode node in nodes) |
591 | { | 592 | { |
592 | if (node.Attributes["UUID"] != null) | 593 | if (node.Attributes["UUID"] != null) |
593 | { | 594 | { |
594 | UUID itemid = new UUID(node.Attributes["UUID"].Value); | 595 | UUID itemid = new UUID(node.Attributes["UUID"].Value); |
595 | m_savedScriptState.Add(itemid, node.InnerXml); | 596 | if (itemid != UUID.Zero) |
597 | m_savedScriptState[itemid] = node.InnerXml; | ||
596 | } | 598 | } |
597 | } | 599 | } |
598 | } | 600 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index be3e87f..b615d42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4822,7 +4822,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4822 | { | 4822 | { |
4823 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | 4823 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); |
4824 | item.OwnerChanged = false; | 4824 | item.OwnerChanged = false; |
4825 | Inventory.UpdateInventoryItem(item); | 4825 | Inventory.UpdateInventoryItem(item, false, false); |
4826 | } | 4826 | } |
4827 | } | 4827 | } |
4828 | } | 4828 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 522f75e..8fcfcc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -131,12 +131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | 133 | ||
134 | HasInventoryChanged = true; | ||
135 | if (m_part.ParentGroup != null) | ||
136 | { | ||
137 | m_part.ParentGroup.HasGroupChanged = true; | ||
138 | } | ||
139 | |||
140 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 134 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
141 | Items.Clear(); | 135 | Items.Clear(); |
142 | 136 | ||
@@ -158,12 +152,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
158 | return; | 152 | return; |
159 | } | 153 | } |
160 | 154 | ||
161 | HasInventoryChanged = true; | ||
162 | if (m_part.ParentGroup != null) | ||
163 | { | ||
164 | m_part.ParentGroup.HasGroupChanged = true; | ||
165 | } | ||
166 | |||
167 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 155 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
168 | Items.Clear(); | 156 | Items.Clear(); |
169 | 157 | ||
@@ -216,8 +204,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
216 | return; | 204 | return; |
217 | } | 205 | } |
218 | 206 | ||
219 | HasInventoryChanged = true; | 207 | // Don't let this set the HasGroupChanged flag for attachments |
220 | m_part.ParentGroup.HasGroupChanged = true; | 208 | // as this happens during rez and we don't want a new asset |
209 | // for each attachment each time | ||
210 | if (!m_part.ParentGroup.RootPart.IsAttachment) | ||
211 | { | ||
212 | HasInventoryChanged = true; | ||
213 | m_part.ParentGroup.HasGroupChanged = true; | ||
214 | } | ||
215 | |||
221 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 216 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
222 | foreach (TaskInventoryItem item in items) | 217 | foreach (TaskInventoryItem item in items) |
223 | { | 218 | { |
@@ -824,11 +819,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
824 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 819 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
825 | public bool UpdateInventoryItem(TaskInventoryItem item) | 820 | public bool UpdateInventoryItem(TaskInventoryItem item) |
826 | { | 821 | { |
827 | return UpdateInventoryItem(item, true); | 822 | return UpdateInventoryItem(item, true, true); |
828 | } | 823 | } |
829 | 824 | ||
830 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | 825 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) |
831 | { | 826 | { |
827 | return UpdateInventoryItem(item, fireScriptEvents, true); | ||
828 | } | ||
829 | |||
830 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) | ||
831 | { | ||
832 | m_items.LockItemsForWrite(true); | 832 | m_items.LockItemsForWrite(true); |
833 | 833 | ||
834 | if (m_items.ContainsKey(item.ItemID)) | 834 | if (m_items.ContainsKey(item.ItemID)) |
@@ -849,8 +849,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
849 | m_inventorySerial++; | 849 | m_inventorySerial++; |
850 | if (fireScriptEvents) | 850 | if (fireScriptEvents) |
851 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 851 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
852 | HasInventoryChanged = true; | 852 | if (considerChanged) |
853 | m_part.ParentGroup.HasGroupChanged = true; | 853 | { |
854 | HasInventoryChanged = true; | ||
855 | m_part.ParentGroup.HasGroupChanged = true; | ||
856 | } | ||
854 | m_items.LockItemsForWrite(false); | 857 | m_items.LockItemsForWrite(false); |
855 | return true; | 858 | return true; |
856 | } | 859 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fd23ed2..b340bda 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4354,6 +4354,24 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4354 | return(new Vector3(x,y,z)); | 4354 | return(new Vector3(x,y,z)); |
4355 | } | 4355 | } |
4356 | 4356 | ||
4357 | public void SaveChangedAttachments() | ||
4358 | { | ||
4359 | // Need to copy this list because DetachToInventoryPrep mods it | ||
4360 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray()); | ||
4357 | 4361 | ||
4362 | IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule; | ||
4363 | if (attachmentsModule != null) | ||
4364 | { | ||
4365 | foreach (SceneObjectGroup grp in attachments) | ||
4366 | { | ||
4367 | if (grp.HasGroupChanged) // Resizer scripts? | ||
4368 | { | ||
4369 | grp.DetachToInventoryPrep(); | ||
4370 | attachmentsModule.UpdateKnownItem(ControllingClient, | ||
4371 | grp, grp.GetFromItemID(), grp.OwnerID); | ||
4372 | } | ||
4373 | } | ||
4374 | } | ||
4375 | } | ||
4358 | } | 4376 | } |
4359 | } | 4377 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index a398dfd..dfc69d8 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -735,7 +735,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
735 | 735 | ||
736 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) | 736 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) |
737 | { | 737 | { |
738 | item.OldItemID = ReadUUID(reader, "OldItemID"); | 738 | ReadUUID(reader, "OldItemID"); |
739 | // On deserialization, the old item id MUST BE UUID.Zero!!!!! | ||
740 | // Setting this to the saved value will BREAK script persistence! | ||
741 | // item.OldItemID = ReadUUID(reader, "OldItemID"); | ||
739 | } | 742 | } |
740 | 743 | ||
741 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) | 744 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8f05359..c602307 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3213,17 +3213,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3213 | 3213 | ||
3214 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3214 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3215 | { | 3215 | { |
3216 | SceneObjectGroup grp = m_host.ParentGroup; | ||
3217 | UUID itemID = grp.GetFromItemID(); | ||
3218 | |||
3219 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | ||
3220 | |||
3221 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3216 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3222 | if (attachmentsModule != null) | 3217 | if (attachmentsModule != null) |
3223 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | 3218 | Util.FireAndForget(DetachWrapper, m_host); |
3224 | } | 3219 | } |
3225 | } | 3220 | } |
3226 | 3221 | ||
3222 | private void DetachWrapper(object o) | ||
3223 | { | ||
3224 | SceneObjectPart host = (SceneObjectPart)o; | ||
3225 | |||
3226 | SceneObjectGroup grp = host.ParentGroup; | ||
3227 | UUID itemID = grp.GetFromItemID(); | ||
3228 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3229 | |||
3230 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3231 | if (attachmentsModule != null) | ||
3232 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | ||
3233 | } | ||
3234 | |||
3227 | public void llTakeCamera(string avatar) | 3235 | public void llTakeCamera(string avatar) |
3228 | { | 3236 | { |
3229 | m_host.AddScriptLPS(1); | 3237 | m_host.AddScriptLPS(1); |